Closed (works as designed)
Project:
AddToAny Share Buttons
Version:
7.x-3.1
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Jul 2011 at 03:39 UTC
Updated:
7 Mar 2012 at 00:02 UTC
My site got a lot of script files so I want use the Headjs or Labjs to download them in parallel, hopefully for better performance.
However, after either of them is enabled, the AddToAny doesn't work, and the firebug captures an error of 'da2a is not defined'. When being hovered over, the 'Share' link behaves like it's dead and doesn't prompt the share menu.
The following is the difference I found before and after I enable the Labjs module:
<a id="da2a_1" class="da2a_button" href="http://www.addtoany.com/share_save#url=http%3A%2F%2projectwhatever.dev%2Fnode%2F4003&title=this%3A%20problem%20is%20%&description="> Share</a>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var a2a_config=a2a_config||{},da2a={done:false,html_done:false,script_ready:false,script_load:function(){var ........................2a_config.tracking_callback=['ready',da2a.script_onready];
//--><!]]>
</script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
da2a.targets=[
{title:'node title for node 4003',url:'http://myproject74.dev/node/4003'}];
da2a.html_done=true;if(da2a.script_ready&&!da2a.done)da2a.init();da2a.script_load();
//--><!]]>
</script>
But when it doesn't work:
<a class="da2a_button" href="http://www.addtoany.com/share_save" id="da2a_1"> Share</a>
The query string after 'share_save' disappear
<script type="text/javascript">
<!--//--><![CDATA[//><!--
$LAB.queue(function() {
var a2a_config=a2a_config||{},da2a={done:false,html_done:false,script_ready:false,script_load:function(){var ..................ge',{target:el});da2a.done=true;}}};a2a_config.tracking_callback=['ready',da2a.script_onready];
});
//--><!]]>
</script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
$LAB.queue(function() {
da2a.targets=[
{title:'node title for node 4003',url:'http://myproject74.dev/node/4003'}];
da2a.html_done=true;if(da2a.script_ready&&!da2a.done)da2a.init();da2a.script_load();
});
//--><!]]>
</script>
After I disable either of Labjs or Headjs, everything turns OK again.
What may cause this problem and is there anyway to get around this? Thanks.
Comments
Comment #1
micropat commentedI don't have experience with Headjs or Labjs, though I can say that modifying the inline JavaScript will indeed mess with the performant asynchronous loading of the external script. In fact, as you discovered, the script won't load at all if the inline JavaScript is removed!
This is more of an issue for Headjs or Labjs to tackle, though feel free to reply with thoughts/solutions. This module's maintainers are always open to discussion about elegant solutions to cross-module conflicts. :)