I searched around on the internet for a JQuery Plugin that would simply replace <A HREF="something.mp3">something</A> with a Flash based plug-in. The plug-ins I found all used an empty <div> and a playlist.
I logic being that if the visitor doesn't have javascript, they can still download and play the song. Plus, in most cases, it's easier for CMS users to create a link to an MP3 as opposed to an empty <DIV>
With WebMinster I was able to write the following JQuery script with worked great:
You'll need to include the JQuery main script (
http://jquery.com/) and change:
/webplayer/webplayer.swf
To the location of your webplayer.swf
Code:
// replace all .mp3 href's with an mp3 player
$(document).ready(function(){
$("a[href*='.mp3']").each(function(index){
url=$(this).attr('href');
otag='<object data="/webplayer/webplayer.swf" type="application/x-shockwave-flash" width="240" height="64">'+
'<param name="movie" value="/webplayer/webplayer.swf">'+
'<param name="menu" value="false">'+
'<param name="scale" value="scale">'+
'<param name="bgcolor" value="#000000">'+
'<param name="flashvars" value="src='+url+'&autostart=no&loop=no">'+
'</object>';
$(this).replaceWith(otag);
});
});
Thanks for a great product.