Jump to content

User:Seb26/quickblock.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.
//Interiot's Tool
 
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript');
 
// ======== QuickBlocks =======
function QuickBlock (expiry,reason,ao,autob,accfreeze) {
  blockForm = document.getElementById('blockip');
  inputs = blockForm.getElementsByTagName('input');
  for (i=0; i<inputs.length; i++) {
    if (inputs[i].name == 'wpBlockOther') {
      inputs[i].value = expiry;
      continue;
    }
    if (inputs[i].name == 'wpBlockReason') {
      inputs[i].value = reason;
      continue;
    }
    if (inputs[i].name == 'wpAnonOnly') {
      if (ao==1) {
        inputs[i].checked = 'checked';
      }
      else if (ao==0) {
        inputs[i].checked = false;
      }
      continue;
    }
    if (inputs[i].name == 'wpEnableAutoblock') {
      if (autob==0) {
        inputs[i].checked=false;
      }
      continue;
    }
    if (inputs[i].name == 'wpCreateAccount') {
      if (accfreeze==0) {
        inputs[i].checked=false;
      }
      continue;
    }
  }
  blockForm.submit();
}
 
addOnloadHook(function(){
  if (document.title.indexOf("Block user") == -1) return;
  else {
    //TEMPLATE: addTab('javascript:('+QuickBlock+')("expiry","reason",ao,autob,accfreeze)','label','id');
 
    addTab('javascript:('+QuickBlock+')("1 hour","Blocked for one hour, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','hour','p-block-ab-1h');
    //Blocked for one hour, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.

    addTab('javascript:('+QuickBlock+')("3 hours","Blocked for three hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','3h','p-block-ab-3h');
    //Blocked for three hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.

    addTab('javascript:('+QuickBlock+')("12 hours","Blocked for 12 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','12h','p-block-ab-12h');
    //Blocked for 12 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.

    addTab('javascript:('+QuickBlock+')("24 hours","Blocked for 24 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','24h','p-block-ab-24h');
    //Blocked for 24 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.

addTab('javascript:('+QuickBlock+')("31 hours","Blocked for 31 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','31h','p-block-ab-31h');
    //Blocked for 31 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.
 
    addTab('javascript:('+QuickBlock+')("48 hours","Blocked for 48 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','48h','p-block-ab-48h');
    //Blocked for 48 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.

    addTab('javascript:('+QuickBlock+')("48 hours","Blocked for 72 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','72h','p-block-ab-72h');
    //Blocked for 72 hours, due to recent abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.
 
    addTab('javascript:('+QuickBlock+')("1 week","Blocked for one week, due to repeat abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','week','p-block-ab-1w');
    //Blocked for one week, due to repeat abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.

    addTab('javascript:('+QuickBlock+')("1 month","Blocked for one month, due to repeat abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','month','p-block-ab-1m');
    //Blocked for one month, due to repeat abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.

    addTab('javascript:('+QuickBlock+')("3 months","Blocked for three months, due to repeat abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','3m','p-block-ab-3m');
    //Blocked for three months, due to repeat abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.
 
    addTab('javascript:('+QuickBlock+')("indefinite","Blocked indefinitely, due to abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.",1,1,1)','indef','p-block-ab-ind');
    //Blocked indefinitely, due to abuse. To appeal or request help, please [[Special:Emailuser/Spebi|contact me]], [[#Emailing us|unblock-en-l]], or follow the instructions below.

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

  }
});