Jump to content

User:Misza13/Scripts/QuickBlock

From Wikipedia, the free encyclopedia

//


function QuickBlock (expiry,reason,ao) {
  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';
      }
      continue;
    }
  }
  blockForm.submit();
}

addOnloadHook(function(){
  if (document.title.indexOf("Block user") == -1) return;
  addTab('javascript:('+QuickBlock+')("indefinite","{{UsernameBlocked}}",0)','user...','p-block-user')
  addTab('javascript:('+QuickBlock+')("indefinite","vandalism",0)','vandalism','p-block-vandalism')
  addTab('javascript:('+QuickBlock+')("31 hours","vandalism",1)','vandalism (31h)','p-block-31h')
  addTab('javascript:('+QuickBlock+')("3 hours","vandalism",1)','school (3h)','p-block-school')
});

//