Jump to content

User:Hersfold/autopatrol.js

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.
// Stolen from [[User:Mr.Z-man]] - adds a [Patrol] link to [[Special:Newpages]] for quicker patrolling.

if (document.URL.indexOf('%3A') != -1) {
  window.location.href = document.URL.replace(/\%3A/g, ":");
}

function autopatrolclick() {
  for (var i=0; i<document.links.length; i++) {
    if (document.links[i].href.indexOf('action=markpatrolled') != -1)  {
      f=document.createElement("IFRAME");
      f.src=document.links[i].href + "&printable=yes";
      f.style.display = 'none';
      document.body.appendChild(f);
    }
  }
}

function autopatrollink() {
  if (wgPageName == "Special:NewPages") {
    mw.util.addPortletLink('p-cactions', 'javascript:autopatrolclick()', "autopatrol", "ca-autopatrol", "Patrol all these pages");
  }
}
$(autopatrollink);

function checkorphansclick() {
  for (var i in document.links) {
    if (document.links[i].href.toString().indexOf('Image:') != -1)  {
      document.links[i].href = document.links[i].href + "?checkimage=true";
      window.open(document.links[i].href);
    }
  }
}
// End autopatrolling