Uiser:Avicennasis/monobook.js

Frae Wikipedia, the free beuk o knawledge

Tak tent: Efter hainin, ye micht hae tae bypass yer brouser's cache for tae see the chynges. Mozilla / Firefox / Safari: haud doun Shift while dabbin on Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: haud doun Ctrl while dabbin on Refresh, or press Ctrl-F5; Konqueror: juist dab on the Reload button, or press F5; Opera users micht hae tae haillie dicht thair cache in Tools→Preferences.

showbydefault = true;
var showbydefault;
var plinksindex = 0;
function patrollinks () {
  if (wgPageName == "Special:NewPages" ) {
    mw.util.addPortletLink('p-cactions', 'javascript:patrollinksclick()', "patrol links", "ca-plinks-show1", "Add patrol links to this page");
    if (!document.getElementById('p-cactions') || showbydefault) {
      addOnloadHook(patrollinksclick);
    }
    if (showbydefault) {
      document.getElementById('ca-plinks-show1').style.display = 'none';
    }
  }
}
$(patrollinks);
function patrollinksclick () {
  if (document.getElementById('p-cactions')) {
    mw.util.addPortletLink('p-cactions', 'javascript:patrollinkshide()', "hide patrol links", "ca-plinks-hide", "Hide patrol links");
    document.getElementById('ca-plinks-show1').style.display = 'none';
  }
  unpatrolled = getElementsByClassName(document, "li", "not-patrolled");
  while(plinksindex < unpatrolled.length) { 
    code = unpatrolled[plinksindex].getElementsByTagName('a')[0].href.toString()
    rcid = code.substring(code.indexOf('rcid=')+5);
    title = code.substring(code.indexOf('title=')+6, code.indexOf('&rcid='));
    link = wgScript +'?title=' + title + '&action=markpatrolled&rcid=' + rcid;
    plink = document.createElement("a");
    stuff = document.createTextNode("Patrol");
    plink.appendChild(stuff);
    plink.href = link;
    openb = document.createTextNode(" [");
    closeb = document.createTextNode("]");
    bracket = document.createElement("span");
    bracket.id = "plink" + plinksindex ;
    bracket.appendChild(openb);
    bracket.appendChild(plink);
    bracket.appendChild(closeb);
    unpatrolled[plinksindex].appendChild(bracket);
    plinksindex++
  }
}
function patrollinkshide() {
  var j
  for (j = 0; j<plinksindex ; j++)
  {
    document.getElementById('plink'+j).style.display = 'none';
  }
  document.getElementById('ca-plinks-hide').style.display = 'none';
  mw.util.addPortletLink('p-cactions', 'javascript:patrollinksshowagain()', "patrol links", "ca-plinks-show", "Add patrol links to unpatrolled entries");
}
function patrollinksshowagain() {
  var j
  for (j = 0; j<plinksindex ; j++)
  {
    document.getElementById('plink'+j).style.display = '';
  }
  document.getElementById('ca-plinks-show').style.display = 'none';
  mw.util.addPortletLink('p-cactions', 'javascript:patrollinkshide()', "hide patrol links", "ca-plinks-hide", "Hide patrol links");
}

// [[File:Krinkle_RTRC.js]]
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Krinkle/RTRC.js&action=raw&ctype=text/javascript');