User:TheDJ/lastfm.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
/* <pre> * This script is based on [[User:Csörföly_D/lastfm.js]], but changed to make compatible with Safari 3.0 */ var playerString = '<div style="z-index: 3; position:absolute; top:0px; left:20px; width: 155px; height: 155px; overflow: visible;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="110" height="140" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab%23version=7,0,0,0" style="float:left;"><param name="bgcolor" value="6598cd" /><param name="movie" value="http://panther1.last.fm/widgets/radio/11.swf" /><param name="quality" value="high" /><param name="allowScriptAccess" value="sameDomain" /><param name="FlashVars" value="lfmMode=radio&radioURL=globaltags%2Frock&title=Wikipedia+&theme=red&autostart=&lang=en" /><embed src="http://panther1.last.fm/widgets/radio/11.swf" type="application/x-shockwave-flash" name="widgetPlayer" bgcolor="6598cd" width="110" height="140" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="lfmMode=radio&radioURL=globaltags%2Frock&title=Wikipedia+&theme=red&autostart=&lang=en" allowScriptAccess="sameDomain"></embed></object></div>'; // call the setup routine if (typeof(addOnloadHook) == 'function') { if (typeof(doneOnloadHook) == 'boolean') { if (doneOnloadHook == true) { LastFMSetup(); } else { addOnloadHook(LastFMSetup); } } else { addOnloadHook(LastFMSetup); } } else { window.onload = LastFMSetup; } function LastFMSetup() { var wplogo = document.getElementById("p-logo"); var parentDiv = wplogo.parentNode; var range = document.createRange(); range.selectNode( wplogo ); var documentFragment = range.createContextualFragment( playerString ); parentDiv.replaceChild( documentFragment, wplogo ); return; } /* </pre> */