Jump to content

User:JackSchmidt/chick.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by JackSchmidt (talk | contribs) at 03:17, 24 February 2008 (don't show cats twice). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
importScript('User:Lupin/popups.js');
importScript('User:Lupin/recent2.js');

importScript('User:JackSchmidt/blofeld.js');
importScript('User:JackSchmidt/JS Ajax.js');
importScript('User:JackSchmidt/JS_UserWatch.js');
importScript('User:JackSchmidt/JS FDG.js');



addOnloadHook( function () { 
  JS_UserWatch.MakeButton("KathrynLybarger","kat");
  JS_UserWatch.MakeButton("Michael_Slone","mps");
  JS_UserWatch.MakeButton("JackSchmidt","jack");

  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 = pagecats[catkey]["title"];
          cat = cat.substring(9);
          cats.push(cat);
        }
      }
      cats.push("dummycat");
      var catlinks = document.getElementById("catlinks");
      var viscats = catlinks.getElementsByTag("a");
      for ( var a in viscats ) {
        a = viscats[a].title;
        viscats[a] = a;
      }
      for ( var cat in cats ) { 
        cat = cats[cat];
        var title = 'Category:' + cat;
        if( viscats[title] == 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);
      }
    }
  );
});

/* [[User_talk:Alex_Smotrov/edittop.js]] */
if (wgAction == 'view' && wgNamespaceNumber >=0)
addOnloadHook(function(){
 var h2s = document.getElementsByTagName('H2');
 var h2 = h2s[0];
 if (!h2) return;
 if (h2.parentNode.id == 'toctitle') h2 = h2s[1];
 if (!h2) return;
 var span = h2.firstChild;
 if (!span || span.className != 'editsection') return;
 var zero = span.cloneNode(true);
 var parent = document.getElementById('bodyContent');
 parent.insertBefore(zero, parent.firstChild);
 var a = zero.getElementsByTagName('A')[0];
 a.title = a.title.replace(/:.*$/,': 0');
 a.setAttribute('href', a.href.replace(/&section=1/,'&section=0'));
})

importScript('User:Alex_Smotrov/histcomb.js');

// Make external editor work sanely
importScript('User:Alex_Smotrov/qpreview.js');window.qPreviewAtBottom=1;