Jump to content

User:Luk/block.js

From Wikipedia, the free encyclopedia
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.
// ======== QuickBlocks =======
function QuickBlock(expiry, reason, ao, autob, accfreeze, emailblock, watch, addUnblockMessage, submit) {
    var blockForm = document.getElementsByClassName('mw-htmlform')[0];
    var inputs = blockForm.getElementsByTagName('input');
    var unblockMessage = 'To appeal or request help, please [[User:Luk#How_to_contact_me|contact me]] or follow the instructions below';
    var unblockMessageIp = 'To appeal or request help, please follow the instructions below';
    var isUser = document.getElementById('t-emailuser');

    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i].name == 'wpExpiry-other') {
            inputs[i].value = expiry;
            continue;
        }
        if (inputs[i].name == 'wpReason-other') {
            if (addUnblockMessage) {
                reason += unblockMessage;
            }
            inputs[i].value = reason;
            continue;
        }
        if (inputs[i].name == 'wpHardBlock') {
            if (ao == 0) {
                inputs[i].checked = 'checked';
            }
            else {
                inputs[i].checked = false;
            }
            continue;
        }
        if (inputs[i].name == 'wpAutoBlock') {
            if (autob == 1) {
                inputs[i].checked = 'checked';
            }
            else {
                inputs[i].checked = false;
            }
            continue;
        }
        if (inputs[i].name == 'wpCreateAccount') {
            if (accfreeze == 1) {
                inputs[i].checked = 'checked';
            }
            else {
                inputs[i].checked = false;
            }
            continue;
        }
        if (inputs[i].name == 'wpDisableEmail') {
            if (emailblock == 1) {
                inputs[i].checked = 'checked';
            }
            else {
                inputs[i].checked = false;
            }
            continue;
        }
        if (inputs[i].name == 'wpWatch') {
            if (watch == 1) {
                inputs[i].checked = 'checked';
            }
            else {
                inputs[i].checked = false;
            }
            continue;
        }
        if (inputs[i].name == 'wpDisableUTEdit') {
            if (emailblock == 1) {
                inputs[i].checked = 'checked';
            }
            else {
                inputs[i].checked = false;
            }
            continue;
        }
    }
    if (submit == 1) {
        if (document.getElementById('mw-input-wpConfirm').value == '' || confirm('already blocked')) {
            // alert('submit');
            blockForm.submit();
        }
    }
}

addOnloadHook(function () {
    if (document.title.indexOf("Block user") == -1) {
        return;
    } else {
        //TEMPLATE: addTab('javascript:('+QuickBlock+')("expiry","reason",ao,autob,accfreeze,emailblock)','label','id',autosubmit);

        addTab('javascript:QuickBlock("indefinite","",1,1,1,0,1,0,0)', 'indef', 'p-block-tweak');

        addTab('javascript:QuickBlock("3 hours","Blocked due to recent [[WP:DIS|abuse of editing privileges]]. Consider improving rather than damaging the work of others.",1,1,1,0,0,1,1)', '3h', 'p-block-ab-3h');
        //Blocked due to recent [[WP:DIS|abuse of editing privileges]]. Consider improving rather than damaging the work of others. To appeal or request help, please follow the instructions below.

        addTab('javascript:QuickBlock("3 hours","Blocked due to recent [[WP:VAN|vandalism]] attempts (triggering the abuse filter). Consider improving rather than damaging the work of others.",1,1,1,0,0,1,1)', '3af', 'p-block-ab-3ab');


        addTab('javascript:QuickBlock("31 hours","You have been blocked for one day, due to recent [[WP:DIS|abuse of editing privileges]].",1,1,1,0,1,1,1)', '31', 'p-block-ab-31h');
        //Blocked for one day, due to recent [[WP:DIS|abuse of editing privileges]]. To appeal or request help, please [[Special:Emailuser/Lucasbfr|contact me]] or follow the instructions below.

        addTab('javascript:QuickBlock("55 hours","You have been blocked for a few days, due to recent [[WP:DIS|abuse of editing privileges]].",1,1,1,0,1,1,1)', '55', 'p-block-ab-48h');
        //Blocked for a few days, due to recent [[WP:DIS|abuse of editing privileges]]. To appeal or request help, please [[Special:Emailuser/Lucasbfr|contact me]] or follow the instructions below.

        addTab('javascript:QuickBlock("55 hours","This IP address has recently been used abusively.",0,1,1,0,1,1,1)', '55-h', 'p-block-ab-55-hard');
        //This IP address has recently been used abusively. To appeal or request help, please [[Special:Emailuser/Lucasbfr|contact me]] or follow the instructions below.

        addTab('javascript:QuickBlock("8 days","Blocked for a few days, due to recent [[WP:DIS|abuse of editing privileges]].",1,1,1,0,1,1,1)', '1w', 'p-block-ab-1w');
        //Blocked for a few days, due to recent [[WP:DIS|abuse of editing privileges]]. To appeal or request help, please [[Special:Emailuser/Lucasbfr|contact me]] or follow the instructions below.

        addTab('javascript:QuickBlock("indefinite","You have been blocked indefinitely, due to abuse of editing privileges.",1,1,1,0,1,1,1)', 'indef', 'p-block-ab-ind');
        //This user has been blocked indefinitely, due to abuse of editing privileges. To appeal or request help, please [[Special:Emailuser/Lucasbfr|contact me]] or follow the instructions below.

        addTab('javascript:QuickBlock("1 month 55 hours","Blocked due to persistent [[WP:DIS|abuse of editing privileges]].",1,1,1,0,1,1,1)', '1m', 'p-block-ab-1m');
        //Blocked due to persistent [[WP:DIS|abuse of editing privileges]]. To appeal or request help, please [[Special:Emailuser/Lucasbfr|contact me]] or follow the instructions below.

        addTab('javascript:QuickBlock("1 month 55 hours","This IP address has been used abusively. If you are a legitimate user, please tell us: please [[User:Luk#How_to_contact_me|contact me]] or follow the instructions below so we can tweak the block.",0,1,1,0,1,0,1)', 'm-h', 'p-block-ab-1month-hard');
        //This IP address has recently been used abusively. To appeal or request help, please [[Special:Emailuser/"+wgUserName+"|contact me]] or follow the instructions below.

        addTab('javascript:QuickBlock("1 month 55 hours","{{anonblock}}",1,0,1,0,0,0,1)', 'm-ano', 'p-block-anon-1m');
        //{{anonblock}}

        addTab('javascript:QuickBlock("1 year 10 days 3 hours","{{anonblock}}",1,0,1,0,0,0,1)', 'y-ano', 'p-block-anon-1y');
        //{{anonblock}}

        addTab('javascript:QuickBlock("1 year 35 days 3 hours","{{schoolblock}}",1,0,1,0,0,0,1)', 'y-edu', 'p-block-school-1y');
        //{{schoolblock}}


        addTab('javascript:QuickBlock("15 days","[[WP:Spam|Spamming]] links to external sites. Persistent spammers may have their websites [[mw:Extension:SpamBlacklist|blacklisted]] and penalized by search engines.",1,0,1,0,0,0,0)', 'spam', 'p-block-anon-spam');
        //[[WP:Spam|Spamming]] links to external sites. Persistent spammers may have their websites [[mw:Extension:SpamBlacklist|blacklisted]] and penalized by search engines.

        addTab('javascript:QuickBlock("indefinite","[[WP:Spam|Spamming]] links to external sites. Persistent spammers may have their websites [[mw:Extension:SpamBlacklist|blacklisted]] and penalized by search engines.",1,1,1,0,1,1,1)', 'spamusr', 'p-block-user-spam');
        //[[WP:Spam|Spamming]] links to external sites. Persistent spammers may have their websites [[mw:Extension:SpamBlacklist|blacklisted]] and penalized by search engines.


        addTab('javascript:QuickBlock("indefinite","[[WP:SOCK|Abusing multiple accounts]].",1,1,1,0,1,1,0)', 'sock', 'p-block-sock-ind');
        //[[WP:SOCK|Abusing multiple accounts]]. To appeal or request help, please [[Special:Emailuser/Lucasbfr|contact me]] or follow the instructions below.


        addTab('javascript:QuickBlock("indefinite","abuse",1,1,1,1,1,0,1)', 'troll', 'p-block-grawp');

        addTab('javascript:QuickBlock("indefinite","{{usernameblocked|}}",1,0,0,0,1,0,0)', 'usr', 'p-block-username');
        //{{Usernameblocked}}

    }
}
);