Jump to content

User:Editor D.S/global.js

From Meta, a Wikimedia project coordination wiki

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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Rollback summaries
// by [[:w:en:User:Writ Keeper]] <https://en.wikipedia.org/wiki/User:Writ_Keeper/rollbackSummary.js>
// and [[:w:en:User:Mr.Z-man]] <https://en.wikipedia.org/wiki/User:Mr.Z-man/rollbackSummary>
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Writ_Keeper/rollbackSummary.js&action=raw&ctype=text/javascript');

// Rollback summaries
// author unknown, if it was you, please let me know.
$(document).ready(function(){
    var rollbackPrompt=function(ev){
        var summary = prompt("Enter rollback summary:", "<use default>");
        if(summary === null || summary === "") {
            ev=ev || window.event;
            if(ev.preventDefault) ev.preventDefault();
            if(ev.stopPropagation) ev.stopPropagation();
            ev.returnValue = false;
            ev.cancelBubble = true;
            return false;
        }
        if(summary != "<use default>")
            this.href = this.href.replace("?", "?summary=" + encodeURIComponent(summary) + "&");
        return true;
    };

    var links=document.getElementById('content').getElementsByTagName('a');
    for(var i=links.length-1; i>=0; i--){
        if(/[?&]action=rollback([&#]|$)/.test(links[i].href))
            links[i].onclick=rollbackPrompt;
    }

});

// Provides several useful functions for rollback (custom edit summary, mark as bot edits and mass revert)
// by [[m:user:Hoo man]] <http://meta.wikimedia.org/wiki/User:Hoo_man/Scripts/Smart_rollback>
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Hoo_man/smart_rollback.js&action=raw&ctype=text/javascript');

mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Xiplus/TwinkleGlobal.js&action=raw&ctype=text/javascript');