MediaWiki:Gadget-Searchnotincat.js

From wikishia

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/**
  * Builds a search-string like Gadget-Searchnotincat.js +-incategory:"Gadget-Searchnotincat.js"
  * to ease finding images not in a category.
  * The link is added as a new tab (monobook) or to the tab-cycler(dropdown, vector)
**/

/*global mw, jQuery*/
if (mw.config.get('wgNamespaceNumber') === 14) {
  jQuery(document).ready(function(){
    'use strict';
    mw.util.addPortletLink('p-cactions', 
      mw.config.get('wgScript') + "?title=Special:Search&search=" + 
      encodeURIComponent(mw.config.get('wgTitle')) + "+-incategory:%22" + 
      (mw.config.get('wgTitle').split(" ").join("_")) + "%22", 
    'Search not in category', 
    'ca-searchnotincat', 
    "Find images not in the category", null);
  });
}