User:Kiteretsu/rollbackSum.js

From Test Wiki
Revision as of 12:54, 18 May 2024 by Kiteretsu (talk | contribs) (+)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Credits to [[User:Aviram7]] for original code
 */
$(function(){
 
   var promptSummary = function () {
        var summary = prompt("Enter summary for rollback (or leave as current to use default summary):", "[[Help:Reverting|Reverted]] edits by [[Special:Contributions/$2|$2]] ([[User talk:$2|talk]]) to last version by $1");
        if (summary == null || summary == "") return false;
        if (summary == "[[Help:Reverting|Reverted]] edits by [[Special:Contributions/$2|$2]] ([[User talk:$2|talk]]) to last version by $1") return true;
        this.href = this.href.replace("?", "?summary=" + encodeURIComponent(summary) + "&"); 
    };
 
   $('.mw-rollback-link a').click( promptSummary );
 
})