Jump to content

Wikipedia:WikiProject User scripts/Scripts/All diffs above here

From Wikipedia, the free encyclopedia
/*
{{/doc}}

<pre><nowiki>
*/

function openAdahLinks(kk)
{
  var as = document.getElementsByTagName('a');
  var k = 0;
  for (n=0; n<as.length; n++) {
    if (as[n].innerHTML == 'diff') {
      if (k <= kk) {
        window.open(as[n].href, '_blank');
      }
      k++;
    }
  }
}

function addAdahLinks() 
{
  if (mw.config.get('wgCanonicalNamespace') == 'Special' && mw.config.get('wgCanonicalSpecialPageName') == 'Watchlist') {
    var as = document.getElementsByTagName('a');
    var k = 0;
    for (n=0; n<as.length; n++) {
      if (as[n].innerHTML == 'diff') {
        var tn = document.createTextNode(') (');
        var link = document.createElement('a');
        link.href = 'javascript:openAdahLinks(' + (k++) + ')';
        link.appendChild(document.createTextNode('adah'), null);
        as[n].parentNode.insertBefore(tn , as[n].nextSibling.nextSibling);
        as[n].parentNode.insertBefore(link , as[n].nextSibling.nextSibling);
      }
    }
  }
}

addOnloadHook(addAdahLinks);

// </nowiki></pre>

// [[Category:Wikipedia scripts]]