User:Luk/block.js
Appearance
< User:Luk
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Luk/block. |
// ======== 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}}
}
}
);