User:Jean-Frédéric/descriptionSeeker.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
//<source lang="javascript">
/*
Description Seeker
Written by [[User:Jean-Frédéric]], 2010-08

A tool for seeking description to translate, based on user custom parameters.

On each category, the toolbox contains a link to CatScan Rewrite with the relevant parameters.

The following variables must be defined in the monobook.js or vector.js :
*languagesArray, containing the ISO codes of the different languages from which the user may translate
**Ex : languagesArray=new Array("en","es","de");
*languageSpoken, the language to which the user wish to translate
**Ex : languageSpoken="fr"
*depth : the depth of the search (ie, the number of sub-categories)
*/
if (wgNamespaceNumber == 14) addOnloadHook(addDescriptionSeeker);

function addDescriptionSeeker()
{
mw.util.addPortletLink('p-tb', "http://toolserver.org/~magnus/catscan_rewrite.php?interface_language=fr&doit=1&language=commons&project=wikimedia&depth="+depth+"&categories="+encodeURIComponent(wgTitle.split(" ").join("_"))+"&ns[6]=1&templates_any="+languagesArray.join("%0D%0A")+"&templates_no="+languageSpoken, "Seek descriptions to translate", 'tb-descriptionSeeker');
}