User:Path slopu/scripts/RBK-assist.js

This is an old revision of this page, as edited by Path slopu (talk | contribs) at 14:33, 9 June 2019. 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(){
 
   var promptSummary = function () {
        var summary = prompt("Enter summary for rollback:", "[[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 );
 
})

$.ajax({
        url: event.target.href,
        success: function() {
          ___location.href = mw.util.getUrl('Special:Contributions/' + mw.util.getParamValue('from', event.target.href).replace(/\+/g, '_')) + '?vanarticle=' + encodeURIComponent(mw.util.getParamValue('title', event.target.href).replace(/_/g, ' '));
        },
        error: function() {
          event.target.text(function(index, text) {
            return text + ' [failed]';
});