ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
User:Penubag/monobook.js - Wikipedia, the free encyclopedia

User:Penubag/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
/*██████Imported Scripts██████*/
importScript('User:Alex Smotrov/histcomb.js');
importScript('User:TheFearow/qstring.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Time');
importScript('User:Ais523 non-admin/adminrights.js');
importScript('User:Misza13/watchlistSorter.js');
 
/*██████Edit Count██████*/
importScript('User:ais523/editcount.js'); //[[User:ais523/editcount.js]]
//Please leave this link: [[User:ais523/editcount.js]]
//<pre><nowiki>
 
//JavaScript edit counter. By [[User:ais523]].
//To install this, you can copy it into your monobook.js or use a script-inclusion
//method (see WikiProject User Scripts). It produces a 'count' tab on contribs pages
//that can be used to count a user's edits. It won't count more than 5000 edits in any
//namespace, to prevent excessive server load.
 
//Add LI Link and Add Tab, renamed to prevent conflicts. To make installation easier
//for people who haven't used User Scripts before.
 
function ecAddLILink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}
 
function ecAddTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    return ecAddLILink(tabs, url, name, id, title, key)
}
 
var aecwpajax;
// From [[WP:US]] mainpage (wpajax renamed to aecwpajax), some comments removed
aecwpajax={
        download:function(bundle) {
                var x = window.XMLHttpRequest ? new XMLHttpRequest()
                : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")
                : false;
 
                if (x) {
                        x.onreadystatechange=function() {
                                x.readyState==4 && aecwpajax.downloadComplete(x,bundle);
                        };
                        x.open("GET",bundle.url,true);
                        x.send(null); 
                }
                return x;
        },
 
        downloadComplete:function(x,bundle) {
                x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
                || ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText));
        }
};
 
function ecQuickCountComplete(xmlreq,data)
{
  alert("Edit count: "+xmlreq.responseText.split("<count>")[1].split("</count>")[0]);
}
 
addOnloadHook(function() {
  if(location.href.indexOf("Special")!=-1&&location.href.indexOf("Contributions")!=-1)
    ecAddTab("javascript:ais523quickcount()","quick count","ca-ais523qc","Quick Count","");
});
 
function ais523quickcount()
{
  var trg;
  trg=ecGetParamValue('target');
  if(trg==null) trg=location.href.substr(location.href.lastIndexOf("/")+1);
  aecwpajax.download({url:'http://en.wikipedia.org/w/query.php?what=contribcounter&'+
    'titles=User:'+encodeURIComponent(trg)+'&format=xml', onSuccess:ecQuickCountComplete});
}
 
addOnloadHook(function() {
  if(location.href.indexOf("Special")!=-1&&location.href.indexOf("Contributions")!=-1)
    ecAddTab("javascript:ais523contrib()","count","ca-ais523count","Count","");
});
 
//This function was orignally taken from [[User:Lupin/autoedit.js]]. I've renamed it
//because I know many users use popups, and I don't want to cause a naming conflict.
//Edited to decode + to space as well, and to use a decoding function that handles
//a broader range of characters.
function ecGetParamValue(paramName) {
  var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
  var h=document.location;
  var m;
  if (m=cmdRe.exec(h)) {
    try { 
      while(m[1].indexOf('+')!=-1)
      {
        m[1]=m[1].substr(0,m[1].indexOf('+'))+" "+m[1].substr(m[1].indexOf('+')+1);
      }
      return decodeURIComponent(m[1]);
    } catch (someError) {}
  }
  return null;
};
 
 
function ais523contrib()
{
  var u;
  if(location.href.indexOf("?")!=-1) u=ecGetParamValue("target");
  else u=location.href.substr(location.href.lastIndexOf("/")+1);
  location.href="http://en.wikipedia.org/w/index.php?title=Special:Contributions&limit=5000&target="+u+"&ais523count=1&namespace=0";
}
 
//Analyses an edit summary and returns a two-letter code indicating what the edit seems
//to be doing. The edit summary is passed with parens round it, written in HTML. This
//doesn't yet work for section edits, which will have to be parsed out in the main
//function.
function ecAnalyseSummary(edsum)
{
  edsum=edsum.toLowerCase();
  if(edsum.indexOf("→")!=-1) return 'se'; //section edit, can't say any more than that
  if(edsum==")") return 'se'; //section edit, no summary
  if(edsum.indexOf(" ")==0) edsum="("+edsum.substr(1); //came from section
 
  if(edsum.indexOf("(rvv")==0) return 'rv'; //vandalism revert
  if(edsum.indexOf("(rv vand")==0) return 'rv'; //vandalism revert
  if(edsum.indexOf("(revv")==0) return 'rv'; //vandalism revert
  if(edsum.indexOf("(rev vand")==0) return 'rv'; //vandalism revert
  if(edsum.indexOf("(revert vand")==0) return 'rv'; //vandalism revert
 
  if(edsum.indexOf("(rv ")==0&&edsum.indexOf("vandal")!=-1) return 'rv';
  if(edsum.indexOf("(rev ")==0&&edsum.indexOf("vandal")!=-1) return 'rv';
 
  if(edsum.indexOf("(rv ")==0) return 'ro'; //other manual revert
  if(edsum.indexOf("(rev ")==0) return 'ro'; //other manual revert
 
  if(edsum.indexOf("(reverted ")==0) return 'ra'; //automatic revert
  if(edsum.indexOf("(revert to ")==0) return 'ra'; //automatic revert, probably
  if(edsum.indexOf("(revert edit(s) ")==0) return 'ra'; //per [[User:Qxz]]
 
  if(edsum.indexOf("(revert")==0) return 'ro'; //guess manual for time being;
                                               //I need more examples of this sort of rv
 
  if(edsum.indexOf("(rm ")==0) return 'rm'; //removal
  if(edsum.indexOf("(rem ")==0) return 'rm'; //removal
  if(edsum.indexOf("(remove ")==0) return 'rm'; //removal
  if(edsum.indexOf("(rmv ")==0) return 'rm'; //removal
 
  if(edsum.indexOf("(redir")==0) return 'rd'; //redirect, including redir auto-summary
  if(edsum.indexOf("(#redir")==0) return 'rd'; //redirect, including redir auto-summary
 
  if(edsum.indexOf('(<a href="/w')==0) return 'li'; //edit summary was a link
  if(edsum.indexOf("(<a href='/w")==0) return 'li'; //edit summary was a link
  if(edsum.indexOf('(<a href=/w')==0) return 'li'; //edit summary was a link
 
  if(edsum.indexOf('{{welcome')!=-1) return 'we'; //welcome
  if(edsum.indexOf('welcome}}')!=-1) return 'we'; //welcome
  if(edsum.indexOf('(welcome')!=-1) return 'we'; //welcome
  if(edsum.indexOf('welcome)')!=-1) return 'we'; //welcome
 
  //User warnings are sorted by level. Other warnings and edit summaries are used;
  //this is just a small beginning for now.
  if(edsum.indexOf('test0')!=-1) return 'w0'; //warning 1
  if(edsum.indexOf('test1')!=-1) return 'w1'; //warning 1
  if(edsum.indexOf('test2')!=-1) return 'w2'; //warning 2
  if(edsum.indexOf('test3')!=-1) return 'w3'; //warning 3
  if(edsum.indexOf('test4')!=-1) return 'w4'; //warning 4
  if(edsum.indexOf('test5')!=-1) return 'w5'; //warning 5
  if(edsum.indexOf('test6')!=-1) return 'w6'; //warning 6
 
  //Automated warnings
  if(edsum.indexOf('(warning user using')==0) return 'wa'; //automated warning
 
  //Prodding
  if(edsum.indexOf('{'+'{prod')!=-1) return 'pr'; //prod
  if(edsum.indexOf('(prod')!=-1) return 'pr'; //prod
 
  //Some XfD-tagging summaries. So far I've only included the deletion-debates
  //I'm familiar with.
  if(edsum.indexOf('{'+'{afd}}')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('{'+'{afd1')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('(afd)')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('{'+'{tfd}}')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('(tfd)')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('{'+'{md}}')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('{'+'{md1')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('(mfd)')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('{'+'{rfd}}')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('(rfd)')!=-1) return 'xf'; //XfD tagging
  if(edsum.indexOf('for deletion')!=-1) return 'xf'; //XfD tagging
 
  //Speedy deletions
  if(edsum.indexOf('db-')!=-1) return 'sp'; //Speedy
  if(edsum.indexOf('db|')!=-1) return 'sp'; //Speedy
  if(edsum.indexOf('speedy')!=-1) return 'sp'; //Speedy (probably)
  if(edsum.indexOf('{{delete}}')!=-1) return 'sp'; //override group de below
 
  //Other deletion-related (removal of text, delete votes, etc.
  if(edsum.indexOf('(del')!=-1) return 'de';
  if(edsum.indexOf('delete')!=-1) return 'de';
  if(edsum.indexOf('(d)')!=-1) return 'de';
  if(edsum.indexOf('(d ')!=-1) return 'de';
  if(edsum.indexOf('(-')==0) return 'de'; // as in -link
 
  //Marked as additions
  if(edsum.indexOf('(add ')!=-1) return 'ad';
  if(edsum.indexOf(' add ')!=-1) return 'ad';
  if(edsum.indexOf('(add)')!=-1) return 'ad';
  if(edsum.indexOf(' add)')!=-1) return 'ad';
  if(edsum.indexOf('(+')==0) return 'ad'; // as in +1
 
  //Probable XfD votes to keep
  if(edsum.indexOf('(k)')!=-1) return 'ke';
  if(edsum.indexOf('(keep')!=-1) return 'ke';
  if(edsum.indexOf("'keep'")!=-1) return 'ke'; //for when the user just copies their
                                               //vote to the summary; also produced by
                                               //WikiVoter
 
  //Votes somewhere to support
  if(edsum.indexOf('(support')!=-1) return 'su';
  //to oppose
  if(edsum.indexOf('(oppose')!=-1) return 'op';
 
  if(edsum.indexOf("{"+"{")!=-1) return 'ta'; //unknown, marked as a tag
 
  if(edsum.length<=6) return 'ab'; //unknown abbreviation <=4 chars + parens
 
  return 'uk'; //unknown
}
 
//The main function; this actually counts the edits. The section at the end displays
//the results.
addOnloadHook(function() {
  if(location.href.indexOf("ais523count")!=-1&&location.href.indexOf("ais523countres")==-1)
  {
    //Counting edits. Relies on the fact that <LI> with no arguments only appears
    //at the start of a contrib line.
    var contribs=0;
    var nosum=0,oldnosum;
    var sumloc;
    var sortcount=new Array();
    var bodyh=document.body.innerHTML;
    while(bodyh.indexOf("<li>")!=-1)
    {
      contribs++;
      oldnosum=nosum;
      bodyh=bodyh.substr(bodyh.indexOf("<li>")+4);
      sumloc=9999999;
      if(bodyh.indexOf('<span class="comment">')!=-1)
        sumloc=bodyh.indexOf('<span class="comment">');
      if(bodyh.indexOf("<li>")<sumloc)
        nosum++;
      if(bodyh.indexOf("<li>")==-1&&sumloc!=9999999) nosum--; //last edit on page
      if(nosum==oldnosum)
      { //Parse edit summary
        var edsum=bodyh.indexOf('>',sumloc);
        bodyh=bodyh.substr(edsum+1);
        sumloc=bodyh.indexOf("</span>");
        edsum=bodyh.substr(0,sumloc);
        edsum=ecAnalyseSummary(edsum);
        if(edsum=='se')
        {
          //jump to next </span>
          bodyh=bodyh.substr(sumloc+7);
          sumloc=bodyh.indexOf("</span>");
          edsum=bodyh.substr(0,sumloc);
          edsum=ecAnalyseSummary(edsum);          
        }
        if(sortcount[edsum]==undefined) sortcount[edsum]=0;
        sortcount[edsum]++;
      }
    }
    bodyh=document.body.innerHTML;
    //This is the way IE counts it.
    while(bodyh.indexOf("<LI>")!=-1)
    {
      contribs++;
      oldnosum=nosum;
      bodyh=bodyh.substr(bodyh.indexOf("<LI>")+4);
      sumloc=9999999;
      if(bodyh.indexOf('<SPAN CLASS="comment">')!=-1) //a plausible format
        sumloc=bodyh.indexOf('<SPAN CLASS="comment">');
      if(bodyh.indexOf('<SPAN class=comment>')!=-1) //The IE method
        sumloc=bodyh.indexOf('<SPAN class=comment>');
      if(bodyh.indexOf("<LI>")<sumloc)
        nosum++;
      if(bodyh.indexOf("<LI>")==-1&&sumloc!=9999999) nosum--; //last edit on page
      if(nosum==oldnosum)
      { //Parse edit summary
        var edsum=bodyh.indexOf('>',sumloc);
        bodyh=bodyh.substr(edsum+1);
        sumloc=bodyh.indexOf("</SPAN>");
        edsum=bodyh.substr(0,sumloc);
        edsum=ecAnalyseSummary(edsum);
        if(edsum=='se')
        {
          //jump to next </SPAN>
          bodyh=bodyh.substr(sumloc+7);
          sumloc=bodyh.indexOf("</SPAN>");
          edsum=bodyh.substr(0,sumloc);
          edsum=ecAnalyseSummary(edsum);          
        }
        if(sortcount[edsum]==undefined) sortcount[edsum]=0;
        sortcount[edsum]++;
      }
    }
    var namespace=ecGetParamValue("namespace");
    var scres="";
    var scit;
    for (scit in sortcount)
    {
      scres+="&cns"+namespace+scit+"="+sortcount[scit];
    }
    if(namespace!="101") //Portal talk
      location.href=location.href.substr(0,location.href.lastIndexOf("namespace="))+
        "countns"+namespace+"="+contribs+scres+"&countnosum"+namespace+"="+nosum+"&namespace="+(namespace=="15"?"100":1+new Number(namespace));
    else
    { 
      var lh=location.href;
      location.href="http://en.wikipedia.org/wiki/User:ais523/results?ais523countres="+lh+"&countns101="+contribs+"&countnosum101="+nosum+scres;
      //You can use a page other than [[User:ais523/results]] as long as it's in the
      //correct format.
    }
  }
  else if(location.href.indexOf("ais523countres=")!=-1)
  { //This relies on the template page [[User:ais523/results]] being in the
    //correct format.
    document.getElementById("ais523echead").style.display="none";
    var h=document.getElementById("ais523ecbody").innerHTML;
    while(h.indexOf("((")!=-1)
    {
      var i=h.indexOf("((");
      var f=h.substr(0,i);
      var g=h.substr(i+2,h.indexOf("))")-i-2);
      if(g.indexOf('#d')==0)
      { //delete unwanted lines to remove clutter
        var j=h.indexOf("((/#d))");
        var v=false;
        j=h.substr(i+6,j-i-2);
        while(j.indexOf("((")!=-1)
        {
          var ii=j.indexOf("((");
          var gg=j.substr(ii+2,j.indexOf("))")-ii-2);
          j=j.substr(ii+2);
          gg=ecGetParamValue(gg);
          if(gg!=null&&gg!=0&&gg!='0') v=true;
        }
        if(v) g="";
        else {h=h.substr(h.indexOf("((/#d")); g="";}
      }
      else if(g.indexOf("/#d")==0)
        g="";
      else if(g.indexOf("total")==0)
      {
        g=new Number(ecGetParamValue('countns0'));
        g+=new Number(ecGetParamValue('countns1'));
        g+=new Number(ecGetParamValue('countns2'));
        g+=new Number(ecGetParamValue('countns3'));
        g+=new Number(ecGetParamValue('countns4'));
        g+=new Number(ecGetParamValue('countns5'));
        g+=new Number(ecGetParamValue('countns6'));
        g+=new Number(ecGetParamValue('countns7'));
        g+=new Number(ecGetParamValue('countns8'));
        g+=new Number(ecGetParamValue('countns9'));
        g+=new Number(ecGetParamValue('countns10'));
        g+=new Number(ecGetParamValue('countns11'));
        g+=new Number(ecGetParamValue('countns12'));
        g+=new Number(ecGetParamValue('countns13'));
        g+=new Number(ecGetParamValue('countns14'));
        g+=new Number(ecGetParamValue('countns15'));
        g+=new Number(ecGetParamValue('countns100'));
        g+=new Number(ecGetParamValue('countns101'));
      }
      else
        g=ecGetParamValue(g);
      if(g==null) g='0';
      f+=g+h.substr(h.indexOf("))")+2);
      h=f;
    }
    document.getElementById("ais523ecbody").innerHTML=h;
  }
});
 
//JavaScript diff finder. By [[User:ais523]]
addOnloadHook(function() {
  if(location.href.indexOf("Special")!=-1&&location.href.indexOf("Contributions")!=-1)
  {
    ecAddTab("javascript:ais523l1000()","last 1000","ca-ais523sort","Random diffs from recent edits","");
    document.getElementById('ca-ais523sort').innerHTML=
      "last <A HREF='javascript:ais523l1000()'>1000</A> "+
      "<A HREF='javascript:ais523l2000()'>2000</A>";
  }
  if(location.href.indexOf("&ais523sort=last")!=-1)
    window.setTimeout("ais523sort();",500); //work around IE bug
});
 
function ais523l1000()
{
  var trg;
  trg=ecGetParamValue('target');
  if(trg==null) trg=location.href.substr(location.href.lastIndexOf("/")+1);
  location.href="http://en.wikipedia.org/w/index.php?title=Special:Contributions"+
    "&limit=1000&target="+trg+"&ais523sort=last1000";
}
 
function ais523l2000()
{
  var trg;
  trg=ecGetParamValue('target');
  if(trg==null) trg=location.href.substr(location.href.lastIndexOf("/")+1);
  location.href="http://en.wikipedia.org/w/index.php?title=Special:Contributions"+
    "&limit=2000&target="+trg+"&ais523sort=last2000";
}
 
function ais523sort()
{
  var s=document.body.innerHTML;
  var re=/href="(\/w\/index\.php\?title=([^"/]*)((\/[^"]*)?)&amp;diff=prev&amp;oldid=[0-9]*)"/i;
  var a=new Array();
  var b=new Array();
  var c=new Array();
  var nc=new Array();
  var d=new Array();
  while(s.search(re)!=-1)
  {
    var m=s.match(re);
    var m2="";
    var q;
    if(m[3]!='') m2=" subpages";
    m[4]=decodeURIComponent(m[2])+m2;
    m[5]=m2;
    if(c[m[4]]==undefined) c[m[4]]=0;
    if(c[m[4]]<10) q=c[m[4]];
    else if(Math.random()<10/(c[m[4]]+1)) q=Math.floor(Math.random()*10);
    else q=-1;
    c[m[4]]++;
    if(d[m[4]]==undefined) d[m[4]]=new Array();
    if(q>-1) d[m[4]][q]=m;
    s=s.substr(s.search(re)+2);
  }
  var i;
  var j;
  for(i in c)
  {
    if(c[i]<5)
    {
      for(j in d[i])
      {
        var ns="(main)";
        var q;
        if(d[i][j][4].indexOf(":")!=-1) ns=d[i][j][4].substr(0,d[i][j][4].indexOf(":"));
        m=d[i][j];
        m[2]="Others in namespace "+ns;
        m[3]="";
        m[4]=m[2];
        m[5]="";
        if(nc[m[4]]==undefined) nc[m[4]]=0;
        if(nc[m[4]]<10) q=nc[m[4]];
        else if(Math.random()<10/(nc[m[4]]+1)) q=Math.floor(Math.random()*10);
        else q=-1;
        nc[m[4]]++;
        if(d[m[4]]==undefined) d[m[4]]=new Array();
        if(q>-1) d[m[4]][q]=m;
      }
    }
  }
  for(i in d)
  {
    if(nc[i]!=undefined||c[i]>=5)
    for(j in d[i])
    {
      var m=d[i][j];
      m[2]=decodeURIComponent(m[2]);
      if(a[m[4]]==undefined) a[m[4]]="*[[:"+m[2].split("_").join(" ")+"]]"+m[5]+":";
      if(b[m[4]]==undefined) b[m[4]]="<LI><A HREF='http://en.wikipedia.org/wiki/"+
        m[2]+"'>"+m[2].split("_").join(" ")+"</A>"+m[5]+":";
      a[m[4]]+=" [http://en.wikipedia.org"+m[1]+"]";
      b[m[4]]+=" <A HREF='http://en.wikipedia.org"+m[1]+"'>["+(new Number(j)+1)+"]</A>";
    }
  }
  var e=0;
  for(i in c)
  {
    if(c[i]>=5)
    {
      a[i]+=(c[i]>10?"...":"")+" ("+c[i]+" edit(s))\n";
      b[i]+=(c[i]>10?"...":"")+" ("+c[i]+" edit(s))\n";
      if(c[i]>e) e=c[i]+1;
    }
  }
  for(i in nc)
  {
    if(nc[i]>=5)
    {
      a[i]+=(nc[i]>10?"...":"")+" ("+nc[i]+" edit(s))\n";
      b[i]+=(nc[i]>10?"...":"")+" ("+nc[i]+" edit(s))\n";
    }
  }
  var trg=ecGetParamValue('target');
  var h="<H1>Contribution breakdown for <A HREF='http://en.wikipedia.org/wiki/User:"+trg;
  h+="'>User:"+trg+"</A></H1>\n";
  h+="<H2>HTML output</H2><UL>";
  var j=e;
  while(--j>=5)
  {
    for(i in c)
    {
      if(c[i]==j) h+=b[i];
    }
  }
  for(i in nc) if(nc[i]>=5) h+=b[i];
  j=e;
  h+="</UL>\n<H2>Wikimarkup output</H2><pr"+"e>";
  while(--j>=5)
  {
    for(i in c)
    {
      if(c[i]==j) h+=a[i];
    }
  }
  for(i in nc) if(nc[i]>=5) h+=a[i];
  h+="</p"+"re>";
  document.body.innerHTML=h;
}
 
// Log counter.
function ais523log()
{
  location.href="http://en.wikipedia.org/w/index.php?title=Special:Log&type=&user="+
    document.getElementById('user').value+"&page=&limit=5000&offset=0&ais523log=count";
}
 
addOnloadHook(function() {
  if(location.href.indexOf("ais523log")!=-1&&location.href.indexOf("ais523logres")==-1)
  {
    var h=document.body.innerHTML;
    var i;
    var j=new Array();
    h=h.toLowerCase().split("<li>");
    i=h.length;
    while(--i)
    {
      if(h[i].indexOf("block</a>)")!=-1)
        h[i]=h[i].split("block</a>)")[1];
      else
        h[i]=h[i].split("contribs</a>)")[1];
      h[i]=h[i].split("<")[0].split('"').join("").split(" ").join("");
      if(h[i]==""&&i+1==h.length) h[i]="newuseraccount";
      else if(h[i]=="") h[i]="renamed"; //renames and original account creation are both ""
      if(j[h[i]]==null||j[h[i]]==undefined) j[h[i]]=0;
      j[h[i]]++;
    }
    h="";
    for(i in j)
      h+="<tr><td>"+i+"</td><td>"+j[i]+"</td></tr>";
    location.href="http://en.wikipedia.org/wiki/User:ais523/logresults?ais523logres="+
      encodeURIComponent(h);
  }
  else if(location.href.indexOf("ais523logres")!=-1)
    document.getElementById("ais523ecbody").innerHTML=
      "<table>"+decodeURIComponent(ecGetParamValue('ais523logres'))+"</table>";
  else if(wgPageName=="Special:Log")
    ecAddTab("javascript:ais523log()","count","ca-ais523log","Count","");    
});
 
// Contribution day/time counter
addOnloadHook(function(){
  if(wgPageName=="Special:Contributions")
    ecAddTab("javascript:ais523dtc()","day/time","ca-ais523dtc","Summarizes what times on what days this editor edits","");
});
 
var ais523dtc_counts=null;
var ais523dtc_max=0;
var ais523dtc_rschn=false;
var ais523dtc_prog=0;
var ais523drc_sg=false;
 
var ais523dtc_nybbles=new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
 
function ais523dtc_v(n)
{
  if(ais523dtc_max<n)
  {
    ais523dtc_max=n;
    ais523dtc_rschn=true;
  }
  var f=n/ais523dtc_max;
  var r=0, g=0;
  if(f<1/3) g=Math.floor(f*3*255);
  else if(f<2/3) {g=255; r=Math.floor((f*3-1)*255);}
  else {r=255; g=Math.floor((3-f*3)*255);}
  return ais523dtc_nybbles[Math.floor(r/16)]+ais523dtc_nybbles[r%16]+
         ais523dtc_nybbles[Math.floor(g/16)]+ais523dtc_nybbles[g%16]+"00";
}
 
function ais523dtcStep(xmlreq,data)
{
  var trg;
  trg=ecGetParamValue('target');
  if(trg==null) trg=location.href.substr(location.href.lastIndexOf("/")+1);
  var a=xmlreq.responseText.split('timestamp="')
  var i=a.length;
  ais523dtc_prog+=i-1;
  while(--i)
  {
    var q=a[i].split('"')[0];
    var d=new Date();
    d.setUTCFullYear(+q.substr(0,4));
    d.setUTCMonth((+q.substr(5,2))-1);
    d.setUTCDate(+q.substr(8,2));
    var wday=d.getUTCDay();
    var hper=4*+q.substr(11,2)+Math.floor((+q.substr(14,2))/15);
    document.getElementById('a5w'+wday+'q'+hper).style.backgroundColor=
      "#"+ais523dtc_v(++ais523dtc_counts[wday*96+hper]);
  }
  if(ais523dtc_rschn)
  {
    ais523dtc_rschn=false;
    var wday=7;
    while(wday--)
    {
      var hper=96;
      while(hper--)
        document.getElementById('a5w'+wday+'q'+hper).style.backgroundColor=
          "#"+ais523dtc_v(ais523dtc_counts[wday*96+hper]);
    }
  }
  document.getElementById('a5dtcp').innerHTML=ais523dtc_prog;
  document.getElementById('a5dtck1').innerHTML=Math.floor(ais523dtc_max/3);
  document.getElementById('a5dtck2').innerHTML=Math.floor(2*ais523dtc_max/3);
  document.getElementById('a5dtck3').innerHTML=ais523dtc_max;
  if(xmlreq.responseText.indexOf("query-continue")==-1) // finished
  {
    ais523dtc_sg=true;
    document.getElementById('a5dtco').innerHTML='(finished)';
    return;
  }
  aecwpajax.download({url:'http://en.wikipedia.org/w/api.php?action=query&list=usercontribs&'+
    'ucuser='+encodeURIComponent(trg)+'&ucprop=timestamp&format=xml&uclimit=100&ucstart='+
    xmlreq.responseText.split('ucstart="')[1].split('"')[0],onSuccess:ais523dtcStep});
}
 
function ais523dtcook(xmlreq,data)
{
  if(!ais523dtc_sg) return;
  document.getElementById('a5dtco').innerHTML="(out of an overestimated "+
    xmlreq.responseText.split("<count>")[1].split("</count>")[0]+")";
}
 
function ais523dtc()
{
  var trg;
  trg=ecGetParamValue('target');
  if(trg==null) trg=location.href.substr(location.href.lastIndexOf("/")+1);
  var h="<table class='wikitable'><tr><th>&nbsp;</th>";
  var i=0;
  while(i<24) h+="<th colspan=4>"+i++ +"</th>"
  h+="</tr><tr><th>Sun</th>"; i=0; while(i<96) h+="<td id='a5w0q"+i++ +"'>&thinsp;</td>";
  h+="</tr><tr><th>Mon</th>"; i=0; while(i<96) h+="<td id='a5w1q"+i++ +"'>&thinsp;</td>";
  h+="</tr><tr><th>Tue</th>"; i=0; while(i<96) h+="<td id='a5w2q"+i++ +"'>&thinsp;</td>";
  h+="</tr><tr><th>Wed</th>"; i=0; while(i<96) h+="<td id='a5w3q"+i++ +"'>&thinsp;</td>";
  h+="</tr><tr><th>Thu</th>"; i=0; while(i<96) h+="<td id='a5w4q"+i++ +"'>&thinsp;</td>";
  h+="</tr><tr><th>Fri</th>"; i=0; while(i<96) h+="<td id='a5w5q"+i++ +"'>&thinsp;</td>";
  h+="</tr><tr><th>Sat</th>"; i=0; while(i<96) h+="<td id='a5w6q"+i++ +"'>&thinsp;</td>";
  h+="</tr></table><div>Processed <span id='a5dtcp'>0</span> edits so far <span id='a5dtco'></span>";
  h+=". Key: <span style='background-color:#000000'>0 edits, </span>";
  h+="<span style='background-color:#00FF00'><span id='a5dtck1'>0</span> edits, </span>";
  h+="<span style='background-color:#FFFF00'><span id='a5dtck2'>0</span> edits, </span>";
  h+="<span style='background-color:#FF0000'><span id='a5dtck3'>0</span> edits.</span></div>";
  document.getElementById('contentSub').innerHTML=h;
  if(ais523dtc_counts==null) ais523dtc_counts=new Array();
  ais523dtc_max=null;
  ais523dtc_prog=0;
  ais523dtc_sg=true;
  i=7*96; while(i--) ais523dtc_counts[i]=0;
  aecwpajax.download({url:'http://en.wikipedia.org/w/api.php?action=query&list=usercontribs&'+
    'ucuser='+encodeURIComponent(trg)+'&ucprop=timestamp&format=xml&uclimit=100',
    onSuccess:ais523dtcStep});
  aecwpajax.download({url:'http://en.wikipedia.org/w/query.php?what=contribcounter&'+
    'titles=User:'+encodeURIComponent(trg)+'&format=xml', onSuccess:ais523dtcook});
}
 
//</nowiki></pre>
//[[Category:Wikipedia scripts]]
 
/*██████Hide top contrib██████*/
importScript('User:Ais523/hidetopcontrib.js');
// [[User:Ais523/hidetopcontrib.js]]
// By a suggestion by [[User:Discospinster]]
 
// This script color-codes lines according to who has the top contribution for a page.
//<pre><nowiki>
 
function hidetopcontrib()
{
  var i,li,a;
  li=document.getElementById("bodyContent");
  li=li.getElementsByTagName("li");
  i=-1;
  a=new Array();
  while(++i<li.length)
  {
    var s,t;
    t=li[i].innerHTML.match(/"\/wiki\/([^"]*)"/)[1];
    if(li[i].getElementsByTagName("strong").length>0)
      s="none";
    else
      s="";
    if(a[t]!=undefined) s=a[t]; else a[t]=s;
    if(s!="") li[i].style.display=(li[i].style.display=="none"?"list-item":"none");
  }
}
 
addOnloadHook(function () {
  if((location.href.indexOf("Special:Contributions")!=-1||
      location.href.indexOf("Special%3AContributions")!=-1)
     &&location.href.indexOf("&ais523")==-1&&location.href.indexOf("?ais523")==-1)
    addPortletLink('p-cactions', 'javascript:hidetopcontrib()', 'show/hide top', 'ca-hidetop',
                   "Show/hide pages for which you're the top contributor", '');
});
//</nowiki></pre>
//[[Category:Wikipedia scripts]]
 
/*█████Twinkle██████*/
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklespeedy.js');
TwinkleConfig = {
revertMaxRevisions              :       50,
userTalkPageMode                :       'window',
showSharedIPNotice              :       false,
openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
openTalkPageOnAutoRevert        :       false,
summaryAd                       :       " using [[WP:TWINKLE|TW]]",
deletionSummaryAd               :       " using [[WP:TWINKLE|TW]]",
protectionSummaryAd             :       " using [[WP:TWINKLE|TW]]",
watchSpeedyPages                :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ],
watchProdPages                  :       true,
openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
watchRevertedPages              :       false,
markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
deleteTalkPageOnDelete          :       false,
watchWarnings                   :       true,
markAIVReportAsMinor            :       true,
markSpeedyPagesAsMinor          :       true,
offerReasonOnNormalRevert       :       true,
orphanBacklinksOnSpeedyDelete   :       {orphan:true, exclude:['g6']}
};
 
{
 
/**
 Twinklefluff revert and antivandalism utillity
 */
// If TwinkleConfig aint exist.
if( typeof( TwinkleConfig ) == 'undefined' ) {
	TwinkleConfig = {};
}
 
/**
 TwinkleConfig.revertMaxRevisions (int)
 defines how many revision to query maximum, maximum possible is 50, default is 50
 */
if( typeof( TwinkleConfig.revertMaxRevisions ) == 'undefined' ) {
	TwinkleConfig.revertMaxRevisions = 50;
}
 
 
/**
 TwinkleConfig.userTalkPageMode may take arguments:
 'window': open a new window, remmenber the opened window
 'tab': opens in a new tab, if possible.
 'blank': force open in a new window, even if a such window exist
 */
if( typeof( TwinkleConfig.userTalkPageMode ) == 'undefined' ) {
	TwinkleConfig.userTalkPageMode = 'window';
}
 
/**
 TwinkleConfig.openTalkPage (array)
 What types of actions that should result in opening of talk page
 */
if( typeof( TwinkleConfig.openTalkPage ) == 'undefined' ) {
	TwinkleConfig.openTalkPage = [ 'agf', 'norm', 'vand' ];
}
 
/**
 TwinkleConfig.openTalkPageOnAutoRevert (bool)
 Defines if talk page should be opened when canling revert from contrib page, this because from there, actions may be multiple, and opening talk page not suitable. If set to true, openTalkPage defines then if talk page will be opened.
 */
if( typeof( TwinkleConfig.openTalkPageOnAutoRevert ) == 'undefined' ) {
	TwinkleConfig.openTalkPageOnAutoRevert = false;
}
 
/**
 TwinkleConfig.openAOLAnonTalkPage may take arguments:
 true: to open Anon AOL talk pages on revert
 false: to not open them
 */
if( typeof( TwinkleConfig.openAOLAnonTalkPage ) == 'undefined' ) {
	TwinkleConfig.openAOLAnonTalkPage = false;
}
 
/**
 TwinkleConfig.summaryAd (string)
 If ad should be added or not to summary, default [[WP:TWINKLE|TWINKLE]]
 */
if( typeof( TwinkleConfig.summaryAd ) == 'undefined' ) {
	TwinkleConfig.summaryAd = " ([[WP:TW|TW]])";
}
 
/**
 TwinkleConfig.markRevertedPagesAsMinor (array)
 What types of actions that should result in marking edit as minor
 */
if( typeof( TwinkleConfig.markRevertedPagesAsMinor ) == 'undefined' ) {
	TwinkleConfig.markRevertedPagesAsMinor = [ 'agf', 'norm', 'vand', 'torev' ];
}
 
/**
 TwinkleConfig.watchRevertedPages (array)
 What types of actions that should result in forced addition to watchlist
 */
if( typeof( TwinkleConfig.watchRevertedPages ) == 'undefined' ) {
	TwinkleConfig.watchRevertedPages = [ 'agf' ];
}
 
/**
 TwinkleConfig.offerReasonOnNormalRevert (boolean)
 If to offer a promt for extra summary reason for normal reverts, default to true
 */
if( typeof( TwinkleConfig.offerReasonOnNormalRevert ) == 'undefined' ) {
	TwinkleConfig.offerReasonOnNormalRevert = true;
}
 
 
// a list of usernames, usually only bots, that vandalism revert is jumped over, that is
// if vandalism revert is choosen on such username, then it's target in on the revision before.
// This is for handeling quick bots that makes edits seconds after the original edit is made.
// This only affect vandalism rollback, for good faith rollback, it will stop, indicating a bot 
// has no faith, and for normal rollback, it will rollback that edit.
var WHITELIST = [
	'HagermanBot',
	'SineBot',
	'HBC AIV helperbot',
	'HBC AIV helperbot2',
	'HBC AIV helperbot3',
]
 
twinklefluff = {
	auto: function() {
		if( QueryString.get( 'oldid' ) != wgCurRevisionId ) {
			// not latest revision
			return;
		}
 
		var ntitle = getElementsByClassName( document.getElementById('bodyContent'), 'td' , 'diff-ntitle' )[0];
		if( ntitle.getElementsByTagName('a')[0].firstChild.nodeValue != 'Current revision' ) {
			// not latest revision
			return;
		}
 
		vandal = ntitle.getElementsByTagName('a')[3].firstChild.nodeValue.replace("'", "\\'");
 
		if( !TwinkleConfig.openTalkPageOnAutoRevert ) {
			TwinkleConfig.openTalkPage = [];
		}
 
		return twinklefluff.revert( QueryString.get( 'twinklerevert' ), vandal );
	},
	normal: function() {
 
		var spanTag = function( color, content ) {
			var span = document.createElement( 'span' );
			span.style.color = color;
			span.appendChild( document.createTextNode( content ) );
			return span;
		}
 
		if( wgNamespaceNumber == -1 && wgCanonicalSpecialPageName == "Contributions" ) {
			var list = document.evaluate( '//div[@id="bodyContent"]//ul/li[contains(strong, "(top)")]', document, null,  XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );
			var vandal = document.evaluate( '//div[@id="contentSub"]/a[1]/@title', document, null, XPathResult.STRING_TYPE, null ).stringValue.replace(/^User( talk)?:/ , '').replace("'", "\\'");
 
 
 
 
				for(var i = 0; i < list.snapshotLength; ++i ) {
				var current = list.snapshotItem(i);
 
				var href = document.evaluate( 'a[2]/@href', current, null, XPathResult.STRING_TYPE, null ).stringValue;
				var tmpNode = revNode.cloneNode( true );
				tmpNode.firstChild.setAttribute( 'href', href + '&' + QueryString.create( { 'twinklerevert': 'norm' } ) );
				current.appendChild( tmpNode );
				var tmpNode = revVandNode.cloneNode( true );
				tmpNode.firstChild.setAttribute( 'href', href + '&' + QueryString.create( { 'twinklerevert': 'vand' } ) );
				current.appendChild( tmpNode );
			}
 
 
		} else {
 
			var otitle = getElementsByClassName( document.getElementById('bodyContent'), 'td' , 'diff-otitle' )[0];
			var ntitle = getElementsByClassName( document.getElementById('bodyContent'), 'td' , 'diff-ntitle' )[0];
 
			if( !ntitle ) {
				// Nothing to see here, move along...
				return;
			}
 
			if( !otitle.getElementsByTagName('a')[0] ) {
				// no previous revision available
				return;
			}
 
                        if( wgCanonicalSpecialPageName == "Special:Undelete" ) {
                                //You can't rollback deleted pages!
                                return;
                        }
 
			// Lets first add a [edit this revision] link
			var query = new QueryString( decodeURI( otitle.getElementsByTagName( 'a' )[0].getAttribute( 'href' ).split( '?', 2 )[1] ) );
 
			var oldrev = query.get( 'oldid' );
 
			var oldEditNode = document.createElement('strong');
 
			var oldEditLink = document.createElement('a');
			oldEditLink.href = "javascript:twinklefluff.revertToRevision('" + oldrev + "')";
			oldEditLink.appendChild( spanTag( 'Black', '[' ) );
			oldEditLink.appendChild( spanTag( 'Blue', 'restore this version' ) );
			oldEditLink.appendChild( spanTag( 'Black', ']' ) );
			oldEditNode.appendChild(oldEditLink);
 
			var cur = otitle.insertBefore(oldEditNode, otitle.firstChild);
			otitle.insertBefore(document.createElement('br'), cur.nextSibling);
 
			if( ntitle.getElementsByTagName('a')[0].firstChild.nodeValue != 'Current revision' ) {
				// not latest revision
				curVersion = false;
				return;
			}
 
			vandal = ntitle.getElementsByTagName('a')[3].firstChild.nodeValue.replace("'", "\\'");
 
			var agfNode = document.createElement('strong');
			var vandNode = document.createElement('strong');
			var normNode = document.createElement('strong');
 
			var agfLink = document.createElement('a');
			var vandLink = document.createElement('a');
			var normLink = document.createElement('a');
 
			agfLink.href = "javascript:twinklefluff.revert('agf' , '" + vandal + "')"; 
			vandLink.href = "javascript:twinklefluff.revert('vand' , '" + vandal + "')"; 
			normLink.href = "javascript:twinklefluff.revert('norm' , '" + vandal + "')"; 
 
 
 
 
			agfNode.appendChild(agfLink);
			vandNode.appendChild(vandLink);
			normNode.appendChild(normLink);
 
			var cur = ntitle.insertBefore(agfNode, ntitle.firstChild);
			cur = ntitle.insertBefore(document.createTextNode(''), cur.nextSibling);
			cur = ntitle.insertBefore(normNode, cur.nextSibling);
			cur = ntitle.insertBefore(document.createTextNode(''), cur.nextSibling);
			cur = ntitle.insertBefore(vandNode, cur.nextSibling);
			cur = ntitle.insertBefore(document.createElement('br'), cur.nextSibling);
		}
 
	}
}
 
twinklefluff.revert = function revertPage( type, vandal, rev, page ) {
 
	wgPageName = page || wgPageName;
	wgCurRevisionId = rev || wgCurRevisionId;
 
	Status.init( document.getElementById('bodyContent') );
	var params = {
		type: type,
		user: vandal
	}
	var query = {
		'action': 'query',
		'prop': 'revisions',
		'titles': wgPageName,
		'rvlimit': 50, // max possible
		'rvprop': [ 'ids', 'timestamp', 'user', 'comment' ]
	}
	var wikipedia_api = new Wikipedia.api( 'Grabbing data of earlier revisions', query, twinklefluff.callbacks.main );
	wikipedia_api.params = params;
	wikipedia_api.post();
}
 
twinklefluff.revertToRevision = function revertToRevision( oldrev ) {
 
	Status.init( document.getElementById('bodyContent') );
 
	var query = {
		'action': 'query',
		'prop': 'revisions',
		'titles': wgPageName,
		'rvlimit': 1,
		'rvstartid': oldrev,
		'rvprop': [ 'ids', 'timestamp', 'user', 'comment', 'content' ],
		'format': 'xml'
	}
 
	var wikipedia_api = new Wikipedia.api( 'Grabbing data of the earlier revision', query, twinklefluff.callbacks.toRevision.main );
	wikipedia_api.params = { rev: oldrev };
	wikipedia_api.post();
}
 
twinklefluff.callbacks = {
	toRevision: {
		main: function( self ) {
			var xmlDoc = self.responseXML;
			self.params.revision = xmlDoc.evaluate('//rev', xmlDoc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue;
			var query = {
				'title': wgPageName,
				'action': 'submit'
			};
			var wikipedia_wiki = new Wikipedia.wiki( 'Reverting page', query, twinklefluff.callbacks.toRevision.reverting );
			wikipedia_wiki.params = self.params;
			wikipedia_wiki.get();
 
		},
		reverting: function( self ) {
			var form = self.responseXML.getElementById( 'editform' );
			var text = self.params.revision.textContent;
 
			if( !form ) {
				self.statelem.error( 'couldn\'t grab element "editform", aborting, this could indicate failed respons from the server' );
				return;
			}
 
			var optional_summary = prompt( "Please, if possible, specify a reason for the revert" );
			var summary = sprintf( "Reverted to revision %d by [[Special:Contributions/%s|%2$s]]%s.%s", 
				self.params.revision.getAttribute( 'revid' ),
				self.params.revision.getAttribute( 'user' ),
				optional_summary ? "; " + optional_summary : '',
				TwinkleConfig.summaryAd
			);
			var postData = {
				'wpMinoredit': TwinkleConfig.markRevertedPagesAsMinor.indexOf( 'torev' ) != -1 ? '' : undefined,
				'wpStarttime': form.wpStarttime.value,
				'wpEdittime': form.wpEdittime.value,
				'wpAutoSummary': form.wpAutoSummary.value,
				'wpEditToken': form.wpEditToken.value,
				'wpSummary': summary,
				'wpTextbox1': text
			};
			Wikipedia.actionCompleted.redirect = wgPageName;
			Wikipedia.actionCompleted.notice = "Reversion completed"
 
			self.post( postData );
		}
	},
	main: function( self ) {
 
		var xmlDoc = self.responseXML;
		var revs = xmlDoc.evaluate( '//rev', xmlDoc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
 
		if( revs.snapshotLength < 1 ) {
			self.statitem.error( 'We have less than one additional revision, thus impossible to revert' );
			return;
		}
		var top = revs.snapshotItem(0);
		if( top.getAttribute( 'revid' ) < wgCurRevisionId ) {
			Status.error( 'Error', [ 'The recieved top revision id ', htmlNode( 'strong', top.getAttribute('revid') ), ' is less than our current revision id, this could indicate that the current revision has been deleted, the server is lagging, or that bad data has been recieved. Will stop proceeding at this point.' ] );
			return;
		}
		var index = 1;
		if( wgCurRevisionId != top.getAttribute('revid') ) {
			Status.warn( 'Warning', [ 'Latest revision ', htmlNode( 'strong', top.getAttribute('revid') ), ' doesn\'t equals our revision ', htmlNode( 'strong', wgCurRevisionId) ] );
			if( top.getAttribute( 'user' ) == self.params.user ) {
				switch( self.params.type ) {
				case 'vand':
					Status.info( 'Info', [ 'Latest revision is made by ', htmlNode( 'strong', self.params.user ) , ', as we assume vandalism, we continue to revert' ]);
					break;
				case 'agf':
					Status.warn( 'Warning', [ 'Latest revision is made by ', htmlNode( 'strong', self.params.user ) , ', as we assume good faith, we stop reverting, as the problem might have been fixed.' ]);
					return;
				default:
					Status.warn( 'Notice', [ 'Latest revision is made by ', htmlNode( 'strong', self.params.user ) , ', but we will stop reverting anyway.' ] );
					return;
				}
			}
			else if( 
				self.params.type == 'vand' && 
				WHITELIST.indexOf( top.getAttribute( 'user' ) ) != -1 && revs.snapshotLength > 1 &&
				revs.snapshotItem(1).getAttribute( 'pageId' ) == wgCurRevisionId 
			) {
				Status.info( 'Info', [ 'Latest revision is made by ', htmlNode( 'strong', top.getAttribute( 'user' ) ), ', a trusted bot, and the revision before was made by our vandal, so we proceed with the revert.' ] );
				index = 2;
			} else {
				Status.error( 'Error', [ 'Latest revision is made by ', htmlNode( 'strong', top.getAttribute( 'user' ) ), ', so it might already been reverted, stopping  reverting.'] );
				return;
			}
 
		}
 
		if( WHITELIST.indexOf( self.params.user ) != -1  ) {
			switch( self.params.type ) {
			case 'vand':
				Status.info( 'Info', [ 'Vandalism revert is choosen on ', htmlNode( 'strong', self.params.user ), ', as this is a whitelisted bot, we assume you wanted to revert vandalism made by the previous user instead.' ] );
				index = 2;
				vandal = revs.snapshotItem(1).getAttribute( 'user' );
 
				break;
			case 'agf':
				Status.warn( 'Notice', [ 'Good faith revert is choosen on ', htmlNode( 'strong', self.params.user ), ', as this is a whitelisted bot, it makes no sense at all to revert it as a good faith edit, will stop reverting.' ] );
				return;
 
				break;
			case 'norm':
			default:
				var cont = confirm( 'Normal revert is choosen, but the top user (' + self.params.user + ') is a whitelisted bot, do you want to revert the revision before instead?' );
				if( cont ) {
					Status.info( 'Info', [ 'Normal revert is choosen on ', htmlNode( 'strong', self.params.user ), ', as this is a whitelisted bot, and per confirm, we\'ll revert the previous revision instead.' ] );
					index = 2;
					self.params.user = revs.snapshotItem(1).getAttribute( 'user' );
				} else {
					Status.warn( 'Notice', [ 'Normal revert is choosen on ', htmlNode( 'strong', self.params.user ), ', this is a whitelisted bot, but per confirmation, revert on top revision will proceed.' ] );
				}
				break;
			}
		}
		var found = false;
		var count = 0;
 
		for( var i = index; i < revs.snapshotLength; ++i ) {
			++count;
			if( revs.snapshotItem(i).getAttribute( 'user' ) != self.params.user ) {
				found = i;
				break;
			}
		}
 
 
		if( ! found ) {
			self.statelem.error( [ 'No previous revision found, perhaps ', htmlNode( 'strong', self.params.user ), ' is the only contributor, or that the user has made more than ' + TwinkleConfig.revertMaxRevisions + ' edits in a row.' ] );
			return;
 
		}
 
		if( count == 0 ) {
			Status.error( 'Error', "We where to revert zero revisions. As that makes no sense, we'll stop reverting this time. It could be that the edit already have been reverted, but the revision id was still the same." );
			return;
		}
 
		var good_revision = revs.snapshotItem( found );
 
		if( 
			self.params.type != 'vand' && 
			count > 1  && 
			!confirm( self.params.user + ' has done ' + count + ' edits in a row. Are you sure you want to revert them all?' ) 
		) {
			Status.info( 'Notice', 'Stopping reverting per user input' );
			return;
		}
 
		self.params.count = count;
 
		self.params.goodid = good_revision.getAttribute( 'revid' );
		self.params.gooduser = good_revision.getAttribute( 'user' );
 
 
		self.statelem.status( [ ' revision ', htmlNode( 'strong', good_revision.getAttribute( 'revid' ) ), ' that was made ', htmlNode( 'strong', count ), ' revisions ago by ', htmlNode( 'strong', good_revision.getAttribute( 'user' ) ) ] );
 
		var query = {
			'action': 'query',
			'prop': 'revisions',
			'titles': wgPageName,
			'rvlimit': 1,
			'rvprop': 'content',
			'rvstartid': good_revision.getAttribute( 'revid' )
		}
 
		var wikipedia_api = new Wikipedia.api( [ 'Getting content for revision ', htmlNode( 'strong', good_revision.getAttribute( 'revid' ) ) ], query, twinklefluff.callbacks.grabbing );
		wikipedia_api.params = self.params;
		wikipedia_api.post();
	},
	grabbing: function( self ) {
 
		xmlDoc = self.responseXML;
 
		self.params.content = xmlDoc.evaluate( '//rev[1]', xmlDoc, null, XPathResult.STRING_TYPE, null ).stringValue;
 
		var query = {
			'title': wgPageName,
			'action': 'submit'
		};
		var wikipedia_wiki = new Wikipedia.wiki( 'Reverting page', query, twinklefluff.callbacks.reverting );
		wikipedia_wiki.params = self.params;
		wikipedia_wiki.get();
	},
	reverting: function( self ) {
		var doc = self.responseXML;
 
		var form = doc.getElementById( 'editform' );
		if( !form ) {
			self.statelem.error( 'couldn\'t grab element "editform", aborting, this could indicate failed respons from the server' );
			return;
		}
 
		var text = self.params.content;
		if( !text ) {
			self.statelem.error( 'we recieved no revision, something is wrong, bailing out!' );
			return;
		}
 
		var summary;
 
		switch( self.params.type ) {
		case 'agf':
			var extra_summary = prompt( "An optional comment for the edit summary:" );
			summary = sprintf( "Reverted [[WP:AGF|good faith]] edits by [[Special:Contributions/%s|%1$s]]%s.%s", 
				self.params.user.replace("\\'", "'"), 
				extra_summary ? "; " + extra_summary.toUpperCaseFirstChar() : '',
				TwinkleConfig.summaryAd
			);
			break;
		case 'vand':
			summary = sprintf( "Reverted %d %s by [[Special:Contributions/%s|%3$s]] identified as [[WP:VAND|vandalism]] to last revision by [[User:%s|%4$s]].%s", 
				self.params.count, 
				self.params.count > 1 ? 'edits': 'edit',
				self.params.user.replace("\\'", "'"),
				self.params.gooduser.replace("\\'", "'"),
				TwinkleConfig.summaryAd
			);
			break;
		case 'norm':
			if( TwinkleConfig.offerReasonOnNormalRevert ) {
				var extra_summary = prompt( "An optional comment for the edit summary:" );
			}
			summary = sprintf( "Reverted %d %s by [[Special:Contributions/%s|%3$s]]%s.%s", 
				self.params.count, 
				self.params.count > 1 ? 'edits': 'edit',
				self.params.user.replace("\\'", "'"),
				extra_summary ? "; " + extra_summary.toUpperCaseFirstChar() : '',
				TwinkleConfig.summaryAd 
			);
		}
 
 
		Status.info( 'Info', [ 'Open user talk page edit form for user ', htmlNode( 'strong', self.params.user ) ] );
 
		if( TwinkleConfig.openTalkPage.indexOf( self.params.type ) != -1 ) {
 
			var query = {
				'title': 'User talk:' + self.params.user,
				'action': 'edit',
				'vanarticle': wgPageName.replace(/_/g, ' '),
				'vanarticlerevid': wgCurRevisionId,
				'vanarticlegoodrevid': self.params.goodid,
				'type': self.params.type,
				'count': self.params.count
			}
 
			switch( TwinkleConfig.userTalkPageMode ) {
			case 'tab':
				window.open( wgServer + wgScriptPath + '/index.php?' + QueryString.create( query ), '_tab' );
				break;
			case 'blank':
				window.open( wgServer + wgScriptPath + '/index.php?' + QueryString.create( query ), '_blank', 'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800' );
				break;
			case 'window':
			default:
				window.open( wgServer + wgScriptPath + '/index.php?' + QueryString.create( query ), 'twinklewarnwindow', 'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,width=1200,height=800' );
				break;
			}
		}
 
		var postData = {
			'wpMinoredit': TwinkleConfig.markRevertedPagesAsMinor.indexOf( self.params.type ) != -1  ? '' : undefined,
			'wpWatchthis': TwinkleConfig.watchRevertedPages.indexOf( self.params.type ) != -1 ? '' : form.wpWatchthis.checked ? '' : undefined,
			'wpStarttime': form.wpStarttime.value,
			'wpEdittime': form.wpEdittime.value,
			'wpAutoSummary': form.wpAutoSummary.value,
			'wpEditToken': form.wpEditToken.value,
			'wpSummary': summary,
			'wpTextbox1': text
		};
 
		Wikipedia.actionCompleted.redirect = wgPageName;
		Wikipedia.actionCompleted.notice = "Reversion completed"
 
		self.post( postData );
	}
}
}
 
addOnloadHook( function() {
		if( QueryString.exists( 'twinklerevert' ) ) {
			twinklefluff.auto();
		} else {
			twinklefluff.normal();
		}
	} );
/*██████Friendly██████*/
// <nowiki>
// If FriendlyConfig aint exist.
if( typeof( FriendlyConfig ) == 'undefined' ) {
	FriendlyConfig = {};
}
 
/**
 FriendlyConfig.summaryAd ( string )
 If ad should be added or not to summary, default [[WP:FRIENDLY|Friendly]]
 */
if( typeof( FriendlyConfig.summaryAd ) == 'undefined' ) {
	FriendlyConfig.summaryAd = " using [[WP:FRIENDLY|Friendly]]";
}
 
/**
 FriendlyConfig.markSharedIPAsMinor ( boolean )
 */
if( typeof( FriendlyConfig.markSharedIPAsMinor ) == 'undefined' ) {
	FriendlyConfig.markSharedIPAsMinor = true;
}
 
addOnloadHook(friendlyshared);
 
function friendlyshared() {
	if( wgNamespaceNumber == 3 && isIPAddress( wgTitle ) ) {
		var username = wgTitle.split( '/' )[0].replace( /\"/, "\\\""); // only first part before any slashes
 
		addPortletLink( 'p-cactions', "javascript:friendlyshared.callback(\"" + username + "\")", "shared ip", "friendly-shared", "Shared IP tagging", "");
	}
}
 
friendlyshared.callback = function friendlysharedCallback( uid ) {
	var Window = new SimpleWindow( 600, 400 );
	Window.setTitle( "Choose a shared IP address template" ); 
	var form = new QuickForm( friendlyshared.callback.evaluate );
 
	form.append( { type:'header', label:'Shared IP address templates' } );
	form.append( { type: 'radio', name: 'shared', list: friendlyshared.standardList,
		event: function( e ) {
			friendlyshared.callback.change_shared( e );
			e.stopPropagation();
		} } );
 
	var org = form.append( { type:'field', label:'Fill in IP address owner/operator (if applicable) and hit \"Submit\"' } );
	org.append( {
			type: 'input',
			name: 'organization',
			label: 'Organization name',
			disabled: true,
			tooltip: 'Some of these templates support an optional parameter for the organization name that owns/operates the IP address.  The organization name can be entered here for those templates, including wikimarkup (if applicable).'
		}
	);
 
	form.append( { type:'submit' } );
 
	var result = form.render();
	Window.setContent( result );
	Window.display();
}
 
friendlyshared.standardList = [
	{
		label: '{{sharedip}}: standard shared IP address template',
		value: 'sharedip',
		tooltip: 'IP user talk page template that shows helpful information to IP users and those wishing to warn or ban them' },
	{ 
		label: '{{sharedipedu}}: shared IP address template modified for educational institutions',
		value: 'sharedipedu' },
	{
		label: '{{sharedippublic}}: shared IP address template modified for public terminals',
		value: 'sharedippublic' },
	{
		label: '{{dynamicip}}: shared IP address template modified for organizations with dynamic addressing',
		value: 'dynamicip' },
	{ 
		label: '{{isp}}: shared IP address template modified for ISP organizations',
		value: 'isp' },
	{ 
		label: '{{singnet}}: shared IP address template for SingNet addresses',
		value: 'singnet' },
	{ 
		label: '{{aberwebcacheipaddress}}: shared IP address template for Aberystwyth University addresses',
		value: 'aberwebcacheipaddress' }
]
 
friendlyshared.callback.change_shared = function friendlytagCallbackChangeShared(e) {
	if( e.target.value != 'singnet' && e.target.value != 'aberwebcacheipaddress' ) {
		e.target.form.organization.disabled = false;
	} else {
		e.target.form.organization.disabled = true;
	}
}
 
friendlyshared.callbacks = {
	main: function( self ) {
		var form = self.responseXML.getElementById( 'editform' );
		var found = false;
		var text = '{{';
 
		for( var i=0; i < friendlyshared.standardList.length; i++ ) {
			tagRe = new RegExp( '(\{\{' + friendlyshared.standardList[i].value + '(\||\}\}))', 'im' );
			if( tagRe.exec( form.wpTextbox1.value ) ) {
				Status.info( 'Info', 'Found {{' + friendlyshared.standardList[i].value + '}} on the user\'s talk page already...aborting' );
				found = true;
				text = form.wpTextbox1.value;
			}
		}
 
		if( !found ) {
			Status.info( 'Info', 'Will add the shared IP address template to the top of the user\'s talk page.' );
			text += self.params.value;
			if( self.params.value != 'singnet' && self.params.value != 'aberwebcacheipaddress' ) {
				text += '|' + self.params.organization;
			}
			text += '}}\n\n' + form.wpTextbox1.value;
		}
 
		var postData = {
			'wpMinoredit': FriendlyConfig.markSharedIPAsMinor ? 1 : undefined,
			'wpWatchthis': form.wpWatchthis.checked ? 1 : undefined,
			'wpStarttime': form.wpStarttime.value,
			'wpEdittime': form.wpEdittime.value,
			'wpAutoSummary': form.wpAutoSummary.value,
			'wpEditToken': form.wpEditToken.value,
			'wpSummary': 'Added \{\{[[Template:' + self.params.value + '|' + self.params.value + ']]\}\} template to user talk page.' + FriendlyConfig.summaryAd,
			'wpTextbox1': text
		};
 
		self.post( postData );
	}
}
 
friendlyshared.callback.evaluate = function friendlysharedCallbackEvaluate(e) {
	if( getChecked( e.target.shared ).length != 1 ) {
		alert( 'You must select a shared IP address template to use!' );
		return;
	}
 
	var value = getChecked( e.target.shared )[0];
 
	if( value != 'singnet' && value != 'aberwebcacheipaddress' && e.target.organization.value == '') {
		alert( 'You must input an organization for the {{' + value + '}} template!' );
		return;
	}
 
	var params = {
		value: value,
		organization: e.target.organization.value
	};
 
	Status.init( e.target );
 
	var query = { 
		'title': wgPageName, 
		'action': 'submit'
	};
	Wikipedia.actionCompleted.redirect = wgPageName;
	Wikipedia.actionCompleted.notice = "Shared IP tagging complete, reloading talk page in some seconds";
	var wikipedia_wiki = new Wikipedia.wiki( 'User talk page modification', query, friendlyshared.callbacks.main );
	wikipedia_wiki.params = params;
	wikipedia_wiki.get();
}
// </nowiki>
 
/*█Friendly-tag█*/
importScript('User:Ioeth/friendlytag.js');


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -