User:Mr.Z-man/moverevert.js

Source: 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.
if (navigator.appName != "Microsoft Internet Explorer") {
function moverevertclick() {
  for (var i=0; i<document.links.length; i++) {
    if (document.links[i].href.indexOf('&wpOldTitle') != -1)  {
      f=document.createElement("IFRAME");
      f.src=document.links[i].href + "&printable=yes&click=true";
      f.style.display = 'none';
      document.body.appendChild(f);
    }
  }
}

function moverevertlink() {
  if (document.getElementsByTagName('h1')[0].innerHTML == "Move log") {
    mw.util.addPortletLink('p-cactions', 'javascript:moverevertclick()', "revert all", "ca-moverevert", "Revert");
  }
  if (document.URL.indexOf('click=true') != -1) {
    document.getElementById('movepage').submit();
  }
}
$(moverevertlink);
}