User:Magnus Manske/add fist links.js

/********************************* importScript('User:Magnus Manske/add_fist_links.js');
 * This script will add links to the Free Image Search Tool (FIST) to articles, images, and categories.
 * Usage : Add
 * to your monobook.js file.

addOnloadHook ( add_fist_links ) ;

function add2toolbox ( url, title ) { var out = '' ; out += '' + title + '' ; var tools = document.getElementById("p-tb") ; tools = tools.getElementsByTagName("ul")[0] ; tools.innerHTML += out ; }

function add_fist_links { if ( mw.config.get('wgNamespaceNumber') == 0 ) { // Article add2toolbox ( 'http://tools.wikimedia.de/~magnus/fist.php?doit=1&language=' + mw.config.get('wgContentLanguage') +    '&project=wikipedia&datatype=articles&params[catdepth]=0&params[random]=50&params[ll_max]=5&params[commons_max]=5' +    '&params[flickr_max]=5&params[include_flickr_id]=1&params[gimp_max]=5&params[forarticles]=all&params[lessthan_images]=3' +    '&params[jpeg]=1&params[png]=1&params[gif]=1&params[svg]=1&params[min_width]=80&params[min_height]=80&sources[languagelinks]=1' +    '&sources[commons]=1&sources[flickr]=1&sources[gimp]=1&data=' + mw.config.get('wgPageName'), 'Find free images'); } else if ( mw.config.get('wgNamespaceNumber') == 6 ) { // Image add2toolbox ( 'http://tools.wikimedia.de/~magnus/fist.php?doit=1&language=' + mw.config.get('wgContentLanguage') +    '&project=wikipedia&datatype=replaceimages&params[catdepth]=0&params[random]=50&params[ll_max]=5' +     '&params[commons_max]=5&params[flickr_max]=5&params[include_flickr_id]=1&params[gimp_max]=5&params[forarticles]=all' +     '&params[lessthan_images]=3&params[jpeg]=1&params[png]=1&params[gif]=1&params[svg]=1&params[min_width]=80' +     '&params[min_height]=80&sources[languagelinks]=1&sources[commons]=1&sources[flickr]=1&sources[gimp]=1' +     '&data=' + mw.config.get('wgPageName'), 'Alternative images'); } else if ( mw.config.get('wgNamespaceNumber') == 14 ) { // Category add2toolbox ( 'http://tools.wikimedia.de/~magnus/fist.php?doit=1&language=' + mw.config.get('wgContentLanguage') +    '&project=wikipedia&datatype=categories&params[catdepth]=0&params[random]=50&params[ll_max]=5&params[commons_max]=5' +     '&params[flickr_max]=5&params[include_flickr_id]=1&params[gimp_max]=5&params[forarticles]=noimage&params[lessthan_images]=3' +     '&params[jpeg]=1&params[png]=1&params[gif]=1&params[svg]=1&params[min_width]=80&params[min_height]=80&sources[languagelinks]=1' +     '&sources[commons]=1&sources[flickr]=1&sources[gimp]=1&data=' + mw.config.get('wgPageName'), 'Find free images'); } }