User:Jean-Frédéric/findLabels.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.
// JS to add a link to a CatScan search looking for VI, FP or QI in the current category
// To use, add
// importScript("User:Jean-Frédéric/findLabels.js");
// to you common.js

function findLabelsTab()
{
  if(mw.config.get('wgNamespaceNumber') === 14){
     var title = encodeURIComponent (mw.config.get('wgTitle').split (" ").join ("_"));
     mw.util.addPortletLink('p-cactions','https://tools.wmflabs.org/catscan2/catscan2.php?language=commons&project=wikimedia&depth=10&categories='+title+'&ns[6]=1&templates_any=Quality+image%0D%0AVI%0D%0AAssessments&sortby=title&ext_image_data=1&doit=1', 'Labels', 'ca-labels');
  }
}

$(findLabelsTab);