[wp-hackers] Prototype.js and Amazon Link-Enhancer Conflict

Mike Koepke mkoepke1 at mikekoepke.com
Sat Dec 16 15:10:48 GMT 2006


I've run across a compatibility issue with prototype.js and Amazon's 
Link-Enhancer script.  Amazon's script adds popup up functionality so 
that when someone mouses over an Amazon link, you get a popup window 
with the item, price, review, Buy Now etc.

The code Amazon you add to the footer is:

<script type="text/javascript" 
src="http://www.assoc-amazon.com/s/link-enhancer?tag=mytag-20">
</script>
<noscript>
    <img src="http://www.assoc-amazon.com/s/noscript?tag=mytag-20" alt="" />
</noscript>

I am trying to use Alex King's Share This, which has you include the new 
prototype.js (slotted in WP 2.1) into the wp-includes directory.  What 
happens when prototype.js and the Amazon script are both included is 
that the blog never fully loads the page.  A bunch of javascript 
warnings are generated:

http://www.mikekoepke.com/function%20(memo,%20iterator)%20%7B%20%20%20%20this.each(function%20(value,%20index)%20%7Bmemo%20=%20iterator(memo,%20value,%20index);});%20%20%20%20return%20memo;}
http://www.mikekoepke.com/function%20(iterator)%20%7B%20%20%20%20var%20result;%20%20%20%20this.each(function%20(value,%20index)%20{if%20(iterator(value,%20index))%20{result%20=%20value;throw%20$break;}});%20%20%20%20return%20result;}
http://www.mikekoepke.com/function%20(pattern,%20iterator)%20%7B%20%20%20%20var%20results%20=%20%5B%5D;%20%20%20%20this.each(function%20(value,%20index)%20{var%20stringValue%20=%20value.toString();if%20(stringValue.match(pattern))%20{results.push((iterator%20||%20Prototype.K)(value,%20index));}});%20%20%20%20return%20results;}
http://www.mikekoepke.com/function%20(object)%20%7B%20%20%20%20var%20found%20=%20false;%20%20%20%20this.each(function%20(value)%20{if%20(value%20==%20object)%20{found%20=%20true;throw%20$break;}});%20%20%20%20return%20found;}
etc.

I've done a bunch of web searching on this issue and haven't come up 
with anything.  I did run across a forum post where someone else ran 
across the same problem using WP and the K2 theme.  
http://getk2.com/forum/showthread.php?t=2227.  He never resolved it either.

We have both isolated the issue to the inclusion of the Amazon script 
along side of prototype.js.   As WP 2.1 will be including prototype.js, 
I thought I'd point out the potential problem to others in the future 
and see if someone has a fix for the conflicts.




More information about the wp-hackers mailing list