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

User:Timotheus Canens/massunblock.js

In today's world, User:Timotheus Canens/massunblock.js has become increasingly important in different areas of society. Both in the work and personal world, User:Timotheus Canens/massunblock.js has generated a significant impact, generating changes and transformations in the way we interact with our environment. Since its emergence, User:Timotheus Canens/massunblock.js has marked a before and after in the way we address different problems and challenges, becoming an essential element in the daily lives of millions of people around the world. In this article, we will explore the fundamental role that User:Timotheus Canens/massunblock.js plays in our lives, analyzing its influence on everyday aspects and society in general.
///Adapted from ]
function doMassUnblock() {
    document.getElementById("wpMassUnblockSubmit").disabled = true;
    var users = document.getElementById("wpMassUnblockUsers").value.split("\n");
    if(users.length == 0) return;
    var wpMassUnblockReason = document.getElementById("wpMassUnblockReason").value, unblocked = 0, failed = new Array(), error = new Array();
    for(i=0;i<users.length;i++) {
        var user = users;
        if(user.length > 0) {
            var req = new XMLHttpRequest();
            req.open("GET", mw.config.get('wgScriptPath') + "/api.php?format=json&action=query&prop=info&meta=tokens&type=csrf&titles=User:" + encodeURIComponent(user), false);
            req.send(null);
            var query = eval("(" + req.responseText + ")").query;
            var token = query.tokens.csrftoken;
            var response = query.pages;
            for(var index in response) {
                var info = response;
                var postdata = "format=json"
                             + "&action=unblock"
                             + "&user=" + encodeURIComponent(user)
                             + "&reason=" + encodeURIComponent(wpMassUnblockReason)
                             + "&token=" + encodeURIComponent(token);
                var req = new XMLHttpRequest();
                req.open("POST", mw.config.get('wgScriptPath') + "/api.php", false);
                req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                req.setRequestHeader("Content-length", postdata.length);
                req.send(postdata);
                if(eval("(" + req.responseText + ")").unblock) { //If unblocked, update the unblocked count and the button.
                    unblocked++;
                    document.getElementById("wpMassUnblockSubmit").value = "(" + unblocked + ")";
                } else { //If not deleted, add the title to the "failed" array and a description of the error to the "error" array.
                    failed.push(user);
                    error.push(eval("(" + req.responseText + ")").error.info);
                }
            }
        }
        if(!users) {
            document.getElementById("wpMassUnblockSubmit").value = "Done (" + unblocked + ")";
            if(failed.length > 0) {
                var linkedList = "";
                for(x=0; x<failed.length; x++) {
                    linkedList += "<li><a href=\"" + mw.config.get('wgScript') + "?title=" + encodeURIComponent(failed) + "\">" + failed + "</a>: " + error + "</li>"; //Links the titles in the "failed" array
                }
                document.getElementById("wpMassUnblockFailedContainer").innerHTML += '<br /><b>Failed unblocks:</b><ul>' + linkedList + '</ul>';
            }
            
        }
    }
}
 
function massUnblockform() {
    var bodyContent;
	switch (mw.config.get('skin')) {
		case 'modern':
			bodyContent = 'mw_contentholder';
			break;
		case 'cologneblue':
			bodyContent = 'article';
			break;
		case 'monobook':
		case 'vector':
		default:
			bodyContent = 'bodyContent';
			break;
	}
    document.getElementsByTagName("h1").textContent = "Tim's mass-unblocking tool";
    document.title = "Tim's mass-unblocking tool - Wikipedia, the free encyclopedia";
    document.getElementById(bodyContent).innerHTML = '<h3 id="siteSub">From Wikipedia, the free encyclopedia</h3><br /><br />'
        + '<form id="wpMassUnblock" name="wpMassUnblock">'
        + '<b>If you abuse this tool, it\'s <i>your</i> fault, not mine.</b>'
        + '<div id="wpMassUnblockFailedContainer"></div>'
        + '<br /><br />'
            + 'Users to unblock (one on each line, please):<br />'
                + '<textarea tabindex="1" accesskey="," name="wpMassUnblockUsers" id="wpMassUnblockUsers" rows="10" cols="80"></textarea>'
            + '<br /><br /><table style="background-color:transparent">'
            + '<tr><td>Reason:</td>'
                + '<td><input type="text" id="wpMassUnblockReason" name="wpMassUnblockReason" maxlength="255" /></td></tr>'
                + '<tr><td><input type="button" id="wpMassUnblockSubmit" name="wpMassUnblockSubmit" value="Unblock" onclick="doMassUnblock()" /></td>'
        + '</form>';
}
 
if(mw.config.get("wgNamespaceNumber") == -1 && mw.config.get("wgTitle").toLowerCase() == "massunblock" && /sysop/.test(mw.config.get("wgUserGroups"))) $(massUnblockform);