_ _    _ _____  ___   __                       
 __      _(_) | _(_)___ / ( _ ) / /_   ___ ___  _ __ ___  
 \ \ /\ / / | |/ / | |_ \ / _ \| '_ \ / __/ _ \| '_ ` _ \ 
  \ V  V /| |   <| |___) | (_) | (_) | (_| (_) | | | | | |
   \_/\_/ |_|_|\_\_|____/ \___/ \___(_)___\___/|_| |_| |_|

User:Pyrospirit/rollbacksummary.js

In today's article, we are going to delve into User:Pyrospirit/rollbacksummary.js, a relevant topic that has captured the attention of many people in recent times. Throughout this text, we will analyze different aspects of User:Pyrospirit/rollbacksummary.js, from its origins to its impact on today's society. We will immerse ourselves in its history, explore its implications in different areas and reflect on its importance in the current context. User:Pyrospirit/rollbacksummary.js is an exciting topic that deserves to be addressed from different perspectives, which is why in this article we aim to offer a broad and enriching vision of this matter. Join us on this fascinating exploration!
/*
This script is derived from the script at ], with some 
slight enhancements.
*/

var RollbackBits = {
    Type: '',   // Defined by an onload function, below
                // @private: Technically, one should always use RollbackBits.GetType()
    CheckType: function () {
        if(document.getElementById('pagehistory')) { return 'hist'; }
        if(document.getElementById('mw-diff-ntitle2')) { return 'diff'; }
        if(wgCanonicalSpecialPageName && wgCanonicalSpecialPageName == 'Contributions') { return 'trib'; }
        else { return false; }
    },
    GetType: function () {
        if(this.Type == '') { this.Type = this.CheckType(); return this.Type; }
        else return this.Type;
    },
    PromptForSummary: function () {  // Designed to be called by the onclick of a rollback link
        var summary = prompt('Enter a summary for your rollback. Replacement strings: $rv, $u', '');
        var user = this.href.match(/from=(*)/);
        var user = decodeURIComponent(user.replace("+", " "));
        if (summary) {
            while (summary.match(/\$u(ser)?|\$re?v(ert|v)? */i)) {
                summary = summary.replace(/\$u(ser)?/i, user);
                summary = summary.replace(/\$re?v(ert|v)? */i, 'Reverted edits by \\] (\\]). ');
            }
            this.href += '&summary=' + escape(summary).replace(/\+/,'%2B');
            return true;
        } else {
            return false;
        }
    }
};

function rollbackSummaryOnload() {
    var links = false;
    switch(RollbackBits.GetType()) {
        case 'hist': links = document.getElementById('pagehistory').getElementsByTagName('a'); break;
        case 'diff': links = document.getElementById('mw-diff-ntitle2').getElementsByTagName('a'); break;
        case 'trib': links = document.getElementById('bodyContent').getElementsByTagName('a'); break;
    }
    for(var linkid = links.length - 1; linkid >= 0; linkid--) { //append prompt links after rollback links
        if (links.href.match(/action=rollback/)) {
            var rbsumm = links.cloneNode(false);
            rbsumm.onclick = RollbackBits.PromptForSummary;
            rbsumm.innerHTML = 'revert';
            switch(RollbackBits.GetType()) {
                case 'hist':
                    links.parentNode.appendChild(document.createTextNode(' | '));
                    links.parentNode.appendChild(rbsumm); break;
                case 'diff': case 'trib':
                    links.parentNode.appendChild(document.createTextNode(' ['));
                    links.parentNode.appendChild(rbsumm);
                    links.parentNode.appendChild(document.createTextNode('] '));
            }
        }
    }
}

$(rollbackSummaryOnload);