Jump to content

User:Mr.Z-man/rollbackSummary.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr.Z-man (talk | contribs) at 21:59, 26 January 2008 (does the page have a rollback link?). 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.
function rollbackSummary() {
  if (wgAction == "history" || wgPageName == "Special:Contributions" || document.URL.indexOf('&diff=') != -1) {
    var hasRollback = getElementsByClassName(document, "span", "mw-rollback-link");
    if (hasRollback) {
      addPortletLink('p-cactions', 'javascript:setRollbackSummary()', "rollback summary", "ca-rollbacksummary", "Set rollback link edit summary");
    }
  }
}
addOnloadHook(rollbackSummary);
function setRollbackSummary() {
  summary = prompt("Change the default rollback summary for rollback links on this page to:", "");
  if (summary) {
  summary = "&summary=" + summary;
    for (var i in document.links) {
      if (document.links[i].href.indexOf('action=rollback') != -1) {
        document.links[i].href += summary;
      }
    }
  }
}