// ==UserScript== // @name Last.fm Searches // @namespace http://www.norcimo.com/fun/greasemonkey // @description Shows links to search various sites when viewing last.fm // @include http://*.last.fm/* // @include http://last.fm/* // ==/UserScript== //See the end of the script for adding more engines /* Originally a hack by Peppe Bergqvist, based I believe on an even older script. I then developed the script to add a couple of more engines before rewriting again to get this version. I'm indebted to the userscripts.org community for help, suggestions and the occasional code snippet */ // 2006-12-13 v1.4 Add support for favicons instead of abbreviations. Cleaned up search engines // 2006-11-27 v1.3 Added a single CSS line so that it now works with the Chart Changes userscript--probably slightly more robust in general // 2006-10-19 v1.2 General clean up. No longer duplicated links on the Title of Artist pages. Better display of links. Search links only appear on hover // 2006-10-02 v1.1 Added more torrent engines, courtesy of redux // Fiddled around with the design and placement of the search engine selection box // 2006-03-22 v1.0 by norcimo http://www.norcimo.com/fun/greasemonkey/ /* Initial release Includes options dialogue to choose which engines to display and set localised TLD */ (function() { function isMusicUrl(theUrl) { if (theUrl == null) return(false); var searchStr = "/music/"; var pos = theUrl.indexOf(searchStr); // Is the prefix correct? if (pos == 0) {//link starts /music/ //chop the rest of the url var temp = theUrl.substring(pos + searchStr.length); //Ignore flashplayer links searchStr="?autostart"; if (temp.indexOf(searchStr)>-1 && temp.lastIndexOf(searchStr)==temp.length-searchStr.length) return false; // Are there any more slashes? One more is ok. var pos = temp.indexOf("/"); // If there are no more slashes, then success. if (pos == -1) return(true); //there was an additional slash--was it at the end? if (pos==temp.length-1) return true; //then it's ok else return false; } } function makeSearchLinksLFM(ourLink) { var searchstr="/music/"; ourLink=ourLink.substr(ourLink.indexOf(searchstr)+searchstr.length); var container = document.createElement("span"); addClass(container,"lfmsCont"); for (var itor=0; itor