Jump to content
Wikimedia Meta-Wiki

User:Mike.lifeguard/massBlock.js

From Meta, a Wikimedia project coordination wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
 // Mass block tool by [[User:Krimpet]]
 // Navigate to [[Special:Massblock]] to use the tool.

 functiongetParameter(p){
 varre=newRegExp('&'+p+'=([^&]*)','i');
 varc=window.location.search;
 returnunescape((c=c.replace(/^\?/,'&').match(re))?c=c[1]:c="");
 }

 functionmassblock(){
 if(wgPageName=="Special:Massblock"){
 document.title="Krimpet's mass block tool";
 document.getElementById("content").innerHTML="<h1 class=\"firstHeading\">Krimpet's mass block tool</h1><span style=\"color:red\">"
 +"MESS SOMETHING UP WITH THIS, AND <em>YOU</em> TAKE THE BLAME, BUCKO.</span><br /><br />List of IPs to block, "
 +"one on each line please:<br><textarea id=\"iplist\" columns=\"24\" rows=\"10\"></textarea><br /><br />"
 +"Expiry: <input type=\"text\" value=\"1 year\" id=\"expiry\"><br />Reason: <input type=\"text\" value=\""
 +"[[w:open proxy|open proxy]] or [[w:zombie computer|zombie]] ([[m:WM:OP|more info]])\" id=\"reason\"><br />"
 +"<input type=\"checkbox\" id=\"ao\" /> Anon only<br /><input type=\"checkbox\" id=\"acb\" checked=\"checked\" /> "
 +"Prevent account creation<br /><br />Blocks/min: <input type=\"text\" value=\"10\" id=\"epm\"><br /><button "
 +"onclick=\"massblock2()\">Block IPs</button> <button onclick=\"massblock4()\">Abort</button><div style=\"z-index:"
 +"-1;position:relative;top:0px;left:0px\"><iframe name=\"blockframe0\" width=\"1px\" height=\"1px\"></iframe>"
 +"<iframe name=\"blockframe1\" width=\"1px\" height=\"1px\"></iframe><iframe name=\"blockframe2\" width=\"1px\" "
 +"height=\"1px\"></iframe><iframe name=\"blockframe3\" width=\"1px\" height=\"1px\"></iframe><iframe name=\"blockframe4\""
 +"width=\"1px\" height=\"1px\"></iframe><iframe name=\"blockframe5\" width=\"1px\" height=\"1px\"></iframe></div>";
 }
 elseif(document.location.search.match("__MASSBLOCK__")){
 document.getElementById("wpAnonOnly").checked=getParameter("ao")=="1";
 document.getElementById("wpCreateAccount").checked=getParameter("acb")=="1";
 document.getElementById("mw-bi-other").value=getParameter("expiry").replace("+"," ","g");
 document.getElementById("mw-bi-reason").value=getParameter("reason").replace("+"," ","g");
 setTimeout("document.getElementById(\"blockip\").submit()",500);
 }
 }

 varwgBlocksToDo;
 varwgBlocksToDoIndex;
 varwgBlocksToDoInterval=0;
 varwgBlockFrame;
 functionmassblock2(){
 if(!parseFloat(document.getElementById("epm").value))return;
 wgBlocksToDo=newArray();

 iplist=document.getElementById("iplist").value.split("\n");
 for(i=0;i<iplist.length;i++){
 wgBlocksToDo[i]=iplist[i].split(":")[0];
 }

 mbcode="massblock3(wgBlocksToDo[wgBlocksToDoIndex++]);if (wgBlocksToDoIndex >= wgBlocksToDo.length) massblock4();";

 wgBlocksToDoIndex=wgBlockFrame=0;
 eval(mbcode);
 wgBlocksToDoInterval=setInterval(mbcode,(60/parseFloat(document.getElementById("epm").value))*1000);
 }

 functionmassblock3(ipToBlock){
 if(ipToBlock+""=="undefined")return;

 iplistobj=document.getElementById("iplist");
 if(iplistobj.value.indexOf("\n")==-1)iplistobj.value="";
 iplistobj.value=iplistobj.value.substring(iplistobj.value.indexOf("\n")+1);

 if(ipToBlock=="")return;

 frames["blockframe"+wgBlockFrame++].location.href=mw.config.get('wgServer')+wgScript+"?title=Special:Block&wpBlockAddress="+
 ipToBlock+"&__MASSBLOCK__=1&wpBlockOther="+document.getElementById("expiry").value+
 "&wpBlockReason="+document.getElementById("reason").value+"&wpAnonOnly="+(document.getElementById("ao").checked?"1":"0")
 +"&wpCreateAccount="+(document.getElementById("acb").checked?"1":"0");
 if(wgBlockFrame==6)wgBlockFrame=0;
 }

 functionmassblock4(){
 clearInterval(wgBlocksToDoInterval);
 }

 $(massblock);

AltStyle によって変換されたページ (->オリジナル) /