User:Magnus Manske/add fist links.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.
/********************************* * This script will add links to the Free Image Search Tool (FIST) to articles, images, and categories. * Usage : Add importScript('User:Magnus Manske/add_fist_links.js'); * to your monobook.js file. **********************************/ addOnloadHook ( add_fist_links ) ; function add2toolbox ( url , title ) { var out = '<li>' ; out += '<a href="' + url + '">' + title + '</a></li>' ; var tools = document.getElementById("p-tb") ; tools = tools.getElementsByTagName("ul")[0] ; tools.innerHTML += out ; } function add_fist_links () { if ( wgNamespaceNumber == 0 ) { // Article add2toolbox ( 'http://tools.wikimedia.de/~magnus/fist.php?doit=1&language=' + wgContentLanguage + '&project=wikipedia&datatype=articles¶ms[catdepth]=0¶ms[random]=50¶ms[ll_max]=5¶ms[commons_max]=5' + '¶ms[flickr_max]=5¶ms[include_flickr_id]=1¶ms[gimp_max]=5¶ms[forarticles]=all¶ms[lessthan_images]=3' + '¶ms[jpeg]=1¶ms[png]=1¶ms[gif]=1¶ms[svg]=1¶ms[min_width]=80¶ms[min_height]=80&sources[languagelinks]=1' + '&sources[commons]=1&sources[flickr]=1&sources[gimp]=1&data=' + wgPageName , 'Find free images'); } else if ( wgNamespaceNumber == 6 ) { // Image add2toolbox ( 'http://tools.wikimedia.de/~magnus/fist.php?doit=1&language=' + wgContentLanguage + '&project=wikipedia&datatype=replaceimages¶ms[catdepth]=0¶ms[random]=50¶ms[ll_max]=5' + '¶ms[commons_max]=5¶ms[flickr_max]=5¶ms[include_flickr_id]=1¶ms[gimp_max]=5¶ms[forarticles]=all' + '¶ms[lessthan_images]=3¶ms[jpeg]=1¶ms[png]=1¶ms[gif]=1¶ms[svg]=1¶ms[min_width]=80' + '¶ms[min_height]=80&sources[languagelinks]=1&sources[commons]=1&sources[flickr]=1&sources[gimp]=1' + '&data=' + wgPageName , 'Alternative images'); } else if ( wgNamespaceNumber == 14 ) { // Category add2toolbox ( 'http://tools.wikimedia.de/~magnus/fist.php?doit=1&language=' + wgContentLanguage + '&project=wikipedia&datatype=categories¶ms[catdepth]=0¶ms[random]=50¶ms[ll_max]=5¶ms[commons_max]=5' + '¶ms[flickr_max]=5¶ms[include_flickr_id]=1¶ms[gimp_max]=5¶ms[forarticles]=noimage¶ms[lessthan_images]=3' + '¶ms[jpeg]=1¶ms[png]=1¶ms[gif]=1¶ms[svg]=1¶ms[min_width]=80¶ms[min_height]=80&sources[languagelinks]=1' + '&sources[commons]=1&sources[flickr]=1&sources[gimp]=1&data=' + wgPageName , 'Find free images'); } }