From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

function JS_ShowHiddenCats() {

  JS_API(

    {action:"query",prop:"categories",titles:wgPageName,format:"json"},

    "cat",

    function(id,txt) {

      var p = eval("(" + txt + ")");

      var cats = [];

      for ( var pageid in p"query"]["pages" ) {

        pagecats = p"query"]["pages"][pageid]["categories"];

        for ( var catkey in pagecats ) {

          var cat = pagecatscatkey]["title"];

          cat = cat.substring(9);

          cats.push(cat);

        }

      }

      var catlinks = document.getElementById("catlinks");

      if(catlinks == null) {

        catlinks = document.createElement("div");

        document.getElementById("bodyContent").appendChild(catlinks);

      }

      catlinks.appendChild( document.createTextNode('Hidden categories: ') );

      var viscats = catlinks.getElementsByTagName("a");

      for ( var a in viscats ) {

        a = viscatsa].title;

        viscatsa = a;

      }

      for ( var cat in cats ) { 

        cat = catscat];

        var title = 'Category:' + cat;

        if( viscatstitle == title ) continue;

        var a = document.createElement("a");

        a.href = '/wiki/' + title;

        a.title = title;

        a.appendChild( document.createTextNode(cat) );

        catlinks.appendChild( document.createTextNode(' | ') );

        catlinks.appendChild( a );

        if(addTooltip) addTooltip(a);

      }

    }

  );

};



$( JS_ShowHiddenCats );