I was trying to make a link for playing mp3's using the del.icio.us player.
Every link with the class mp3 will get the play button from del.icio.us.
$("a.mp3").prepend('<img src="http://del.icio.us/static/img/mp3/play.gif" alt="beluister" class="play"> ');
On clicking the play image the player should appear with the value from the href attribute of the link. But here something goes wrong.
$("img.play").click(function(){
var link = $(this).parent().html().split(';');
alert(link[1]);
var url = $(this).parent().attr("href");
alert(url);
$(this).parent().html('<img src="http://del.icio.us/static/img/mp3/stop.gif" alt="stop" class="stop"><object width="100" height="14" align="middle" id="player" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" style="vertical-align: bottom; margin-right: 0.2em;"<>param value="transparent" name="wmode"/><param value="sameDomain" name="allowScriptAccess"/><param value="'+url+'&fontColor=000000" name="flashVars"/><param value="http://del.icio.us/static/swf/playtagger.swf" name="movie"/><param value="high" name="quality"/><embed width="100" height="14" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="sameDomain" name="player" wmode="transparent" quality="high" flashvars="theLink='+url+'&fontColor=000000" src="http://del.icio.us/static/swf/playtagger.swf" style="vertical-align: bottom; margin-right: 0.2em;"/></object>'+link);
return false;
});
var link = $(this).parent().html().split(';');
alert(link[1]);
var url = $(this).parent().attr("href");
alert(url);
$(this).parent().html('<img src="http://del.icio.us/static/img/mp3/stop.gif" alt="stop" class="stop"><object width="100" height="14" align="middle" id="player" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" style="vertical-align: bottom; margin-right: 0.2em;"<>param value="transparent" name="wmode"/><param value="sameDomain" name="allowScriptAccess"/><param value="'+url+'&fontColor=000000" name="flashVars"/><param value="http://del.icio.us/static/swf/playtagger.swf" name="movie"/><param value="high" name="quality"/><embed width="100" height="14" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="sameDomain" name="player" wmode="transparent" quality="high" flashvars="theLink='+url+'&fontColor=000000" src="http://del.icio.us/static/swf/playtagger.swf" style="vertical-align: bottom; margin-right: 0.2em;"/></object>'+link);
return false;
});
test link : Cunts are still running the world
It gets the alert with innerhtml, without the play image, but not the alert with the value of the href attribute and it continues the link behaviour even with the return false; code. When i only alert the innerhtml it acts as expected.
The functional code of the site is found near the bottom of the source code. Blogspot doesn't execute javascript code inside the head tag.
The thirth part of the code would be the click event of the stop image.
I saw it on Mars needs guitars and i thought it was great so i wanted to add it to my blog too.
If it's a bug in jquery i hope it will be fixed soon. You just got to love the fast respons on their mailing list.
update : The problem was linking to an older version of jquery. I made some changes in the functional code now to make it work.
No comments:
Post a Comment