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.

//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.



// Newly simplified Add Tab, to replace the old broken one.

function ecAddTab(url, name, id, title, key){

    return mw.util.addPortletLink('p-cactions', 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('editcount="')[1].split('"')[0]);

}



$(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:'//en.wikipedia.org/w/api.php?action=query&list=users&ususers='

    +encodeURIComponent(trg)+'&usprop=editcount&format=xml', onSuccess:ecQuickCountComplete});

}



$(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(m1].indexOf('+')!=-1)

      {

        m1=m1].substr(0,m1].indexOf('+'))+" "+m1].substr(m1].indexOf('+')+1);

      }

      return decodeURIComponent(m1]);

    } catch (someError) {}

  }

  return null;

}



// TODO: Can we autogenerate this from somewhere?

var namespaces = {

	0: "Article",

	1: "Talk",

	2: "User",

	3: "User talk",

	4: "Wikipedia",

	5: "Wikipedia talk",

	6: "File",

	7: "File talk",

	8: "MediaWiki",

	9: "MediaWiki talk",

	10: "Template",

	11: "Template talk",

	12: "Help",

	13: "Help talk",

	14: "Category",

	15: "Category talk",

	100: "Portal",

	101: "Portal talk",

	108: "Book",

	109: "Book talk",

	118: "Draft",

	119: "Draft talk",

	446: "Education Program",

	447: "Education Program talk",

	710: "TimedText",

	711: "TimedText talk",

	828: "Module",

	829: "Module talk",

	2600: "Topic",

};



function nextnamespace(n)

{

	var flag = false;

	for (var nsnum in namespaces) {

		if (flag)

			return nsnum;

		if (nsnum == n)

			flag = true;

	}

	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="//en.wikipedia.org/?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)

{

  while(edsum.indexOf(" ")===0) edsum=edsum.substr(1);

  edsum="("+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("(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("(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

  if(edsum.indexOf('(welcoming')!=-1) return 'we'; //welcome (Huggle)



  //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 'w5'; //warning 5



  //Twinkle's edit summaries by level

  if(edsum.indexOf('(general note:')!=-1) return 'a1'; //warning 1

  if(edsum.indexOf('(caution:')!=-1) return 'a2'; //warning 2

  if(edsum.indexOf('(warning:')!=-1) return 'a3'; //warning 3

  if(edsum.indexOf('(final warning:')!=-1) return 'a4'; //warning 4

  if(edsum.indexOf('(only warning:')!=-1) return 'a4'; //warning 4

  if(edsum.indexOf('blocked from editing')!=-1) return 'a5'; //warning 5



  //Huggle's are a lot simpler

  if(edsum.indexOf('level 1 warning')!=-1) return 'a1'; //warning 1

  if(edsum.indexOf('level 2 warning')!=-1) return 'a2'; //warning 2

  if(edsum.indexOf('level 3 warning')!=-1) return 'a3'; //warning 3

  if(edsum.indexOf('level 4 warning')!=-1) return 'a4'; //warning 4

  if(edsum.indexOf('level 5 warning')!=-1) return 'a5'; //warning 5



  //Unknown warnings

  if(edsum.indexOf('(warning user using')!=-1) return 'au'; //automated warning

  if(edsum.indexOf('warning')!=-1) return 'wu'; //unknown warning



  //Notifications

  if(edsum.indexOf('notify')!=-1) return 'no'; //notification

  if(edsum.indexOf('(notice')!=-1) return 'no'; //notification

  if(edsum.indexOf('notification')!=-1) return 'no'; //notification



  //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.

$(function() {

  if(location.href.indexOf("ais523count")!=-1&&location.href.indexOf("ais523countres")==-1)

  {

	// Counting edits. New, simpler jQuery version.

    var contribs=$(".mw-contributions-title").length;

    var contribsWithSummary=0;

    var sortcount=[];

    $(".comment").each(function(idx, element){

        contribsWithSummary++;

        var edsum=element.innerHTML;

        edsum=ecAnalyseSummary(edsum);

        if(edsum=='se')

        {

          //find the part beyond the last "</span>"

          edsum=element.innerHTML;

          sumloc=edsum.lastIndexOf("</span>");

          edsum=edsum.substr(sumloc+8);

          edsum=ecAnalyseSummary(edsum);

        }

        if(sortcountedsum===undefined) sortcountedsum=0;

        sortcountedsum++;

    });



    var namespace=ecGetParamValue("namespace");

    var scres="";

    var scit;

    for (scit in sortcount)

    {

      scres+="&cns"+namespace+scit+"="+sortcountscit];

    }

    if(nextnamespace(namespace) !== null)

      location.href=location.href.substr(0,location.href.lastIndexOf("namespace="))+

        "countns"+namespace+"="+contribs+scres+"&countnosum"+namespace+"="+(contribs-contribsWithSummary)+"&namespace="+nextnamespace(namespace);

    else

    { 

      var lh=location.href;

      location.href="//en.wikipedia.org/wiki/User:ais523/results?ais523countres="+lh+"&countns"+namespace+"="+contribs+scres+"&countnosum"+namespace+"="+(contribs-contribsWithSummary)

      //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";

    $(".ais523ecbody").each(function(idx,element) {

    var h=element.innerHTML;

    // First replacement: loop over namespaces.

    var hComponents = h.split("((pernamespace))");

    for (var hci = 1; hci < hComponents.length; hci++) {

    	var hcc = hComponentshci].split("((/pernamespace))");

    	var hcp = "";

    	for (var nsnum in namespaces) {

    		if (ecGetParamValue('countns'+nsnum) > 0)

    			hcp += hcc0].split("((NSNUM))").join(nsnum).split("((NSNAME))").join(namespacesnsnum])

    	}

    	hComponentshci = hcp + hcc1

    }

    h = hComponents.join("")

    

    // Second replacement: substitute in individual results.

    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 = 0;

      	for (var nsnum in namespaces)

      		g += new Number(ecGetParamValue('countns'+nsnum));

      }

      else if(g.indexOf("(")==-1)

        g=ecGetParamValue(g);

      if(g==null) g='0';

      f+=g+h.substr(h.indexOf("))")+2);

      h=f;

    }

    element.innerHTML=h;

    });

  }



});



//JavaScript diff finder. By [[User:ais523]]

$(function() {

  if(location.href.indexOf("Special")!=-1&&location.href.indexOf("Contributions")!=-1)

  {

    ecAddTab("javascript:ais523l1000()","last 1000","ca-ais523sort","Random diffs from recent edits","");

    ecAddTab("javascript:ais523l2000()","2000","ca-ais523sort","Random diffs from recent edits","");

  }

  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="//en.wikipedia.org/?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="//en.wikipedia.org/?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(m3!='') m2=" subpages";

    m4=decodeURIComponent(m2])+m2;

    m5=m2;

    if(cm4]]==undefined) cm4]]=0;

    if(cm4]]<10) q=cm4]];

    else if(Math.random()<10/(cm4]]+1)) q=Math.floor(Math.random()*10);

    else q=-1;

    cm4]]++;

    if(dm4]]==undefined) dm4]]=new Array();

    if(q>-1) dm4]][q=m;

    s=s.substr(s.search(re)+2);

  }

  var i;

  var j;

  for(i in c)

  {

    if(ci<5)

    {

      for(j in di])

      {

        var ns="(main)";

        var q;

        if(di][j][4].indexOf(":")!=-1) ns=di][j][4].substr(0,di][j][4].indexOf(":"));

        m=di][j];

        m2="Others in namespace "+ns;

        m3="";

        m4=m2];

        m5="";

        if(ncm4]]==undefined) ncm4]]=0;

        if(ncm4]]<10) q=ncm4]];

        else if(Math.random()<10/(ncm4]]+1)) q=Math.floor(Math.random()*10);

        else q=-1;

        ncm4]]++;

        if(dm4]]==undefined) dm4]]=new Array();

        if(q>-1) dm4]][q=m;

      }

    }

  }

  for(i in d)

  {

    if(nci!=undefined||ci>=5)

    for(j in di])

    {

      var m=di][j];

      m2=decodeURIComponent(m2]);

      if(am4]]==undefined) am4]]="*[[:"+m2].split("_").join(" ")+"]]"+m5+":";

      if(bm4]]==undefined) bm4]]="<li><a href='//en.wikipedia.org/wiki/"+

        m2+"'>"+m2].split("_").join(" ")+"</a>"+m5+":";

      am4]]+=" [http://en.wikipedia.org"+m1+"]";

      bm4]]+=" <a href='http://en.wikipedia.org"+m1+"'>["+(new Number(j)+1)+"]</a>";

    }

  }

  var e=0;

  for(i in c)

  {

    if(ci>=5)

    {

      ai+=(ci>10?"...":"")+" ("+ci+" edit(s))\n";

      bi+=(ci>10?"...":"")+" ("+ci+" edit(s))\n";

      if(ci>e) e=ci+1;

    }

  }

  for(i in nc)

  {

    if(nci>=5)

    {

      ai+=(nci>10?"...":"")+" ("+nci+" edit(s))\n";

      bi+=(nci>10?"...":"")+" ("+nci+" edit(s))\n";

    }

  }

  var trg=ecGetParamValue('target');

  var h="<h1>Contribution breakdown for <a href='//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(ci==j) h+=bi];

    }

  }

  for(i in nc) if(nci>=5) h+=bi];

  j=e;

  h+="</ul>\n<h2>Wikimarkup output</h2><pr"+"e>";

  while(--j>=5)

  {

    for(i in c)

    {

      if(ci==j) h+=ai];

    }

  }

  for(i in nc) if(nci>=5) h+=ai];

  h+="</p"+"re>";

  document.body.innerHTML=h;

}



// Log counter.

function ais523log()

{

  location.href="//en.wikipedia.org/?title=Special:Log&type=&user="+

    document.getElementById('user').value+"&page=&limit=5000&offset=0&ais523log=count";

}



$(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(hi].indexOf("block</a>)")!=-1)

        hi=hi].split("block</a>)")[1];

      else

        hi=hi].split("contribs</a>)")[1];

      hi=hi].split("<")[0].split('"').join("").split(" ").join("");

      if(hi==""&&i+1==h.length) hi="newuseraccount";

      else if(hi=="") hi="renamed"; //renames and original account creation are both ""

      if(jhi]]==null||jhi]]==undefined) jhi]]=0;

      jhi]]++;

    }

    h="";

    for(i in j)

      h+="<tr><td>"+i+"</td><td>"+ji+"</td></tr>";

    location.href="//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(mw.config.get('wgPageName')=="Special:Log")

    ecAddTab("javascript:ais523log()","count","ca-ais523log","Count","");    

});



// Contribution day/time counter

$(function(){

  if(mw.config.get('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='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_nybblesMath.floor(r/16)]+ais523dtc_nybblesr%16+

         ais523dtc_nybblesMath.floor(g/16)]+ais523dtc_nybblesg%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=ai].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_countswday*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_countswday*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:'//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('editcount="')[1].split('"')[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_countsi=0;

  aecwpajax.download({url:'//en.wikipedia.org/w/api.php?action=query&list=usercontribs&'+

    'ucuser='+encodeURIComponent(trg)+'&ucprop=timestamp&format=xml&uclimit=100',

    onSuccess:ais523dtcStep});

  aecwpajax.download({url:'//en.wikipedia.org/w/api.php?action=query&list=users&ususers='

    +encodeURIComponent(trg)+'&usprop=editcount&format=xml', onSuccess:ais523dtcook});

}



//</nowiki></pre>
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.

//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.



// Newly simplified Add Tab, to replace the old broken one.

function ecAddTab(url, name, id, title, key){

    return mw.util.addPortletLink('p-cactions', 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('editcount="')[1].split('"')[0]);

}



$(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:'//en.wikipedia.org/w/api.php?action=query&list=users&ususers='

    +encodeURIComponent(trg)+'&usprop=editcount&format=xml', onSuccess:ecQuickCountComplete});

}



$(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(m1].indexOf('+')!=-1)

      {

        m1=m1].substr(0,m1].indexOf('+'))+" "+m1].substr(m1].indexOf('+')+1);

      }

      return decodeURIComponent(m1]);

    } catch (someError) {}

  }

  return null;

}



// TODO: Can we autogenerate this from somewhere?

var namespaces = {

	0: "Article",

	1: "Talk",

	2: "User",

	3: "User talk",

	4: "Wikipedia",

	5: "Wikipedia talk",

	6: "File",

	7: "File talk",

	8: "MediaWiki",

	9: "MediaWiki talk",

	10: "Template",

	11: "Template talk",

	12: "Help",

	13: "Help talk",

	14: "Category",

	15: "Category talk",

	100: "Portal",

	101: "Portal talk",

	108: "Book",

	109: "Book talk",

	118: "Draft",

	119: "Draft talk",

	446: "Education Program",

	447: "Education Program talk",

	710: "TimedText",

	711: "TimedText talk",

	828: "Module",

	829: "Module talk",

	2600: "Topic",

};



function nextnamespace(n)

{

	var flag = false;

	for (var nsnum in namespaces) {

		if (flag)

			return nsnum;

		if (nsnum == n)

			flag = true;

	}

	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="//en.wikipedia.org/?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)

{

  while(edsum.indexOf(" ")===0) edsum=edsum.substr(1);

  edsum="("+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("(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("(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

  if(edsum.indexOf('(welcoming')!=-1) return 'we'; //welcome (Huggle)



  //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 'w5'; //warning 5



  //Twinkle's edit summaries by level

  if(edsum.indexOf('(general note:')!=-1) return 'a1'; //warning 1

  if(edsum.indexOf('(caution:')!=-1) return 'a2'; //warning 2

  if(edsum.indexOf('(warning:')!=-1) return 'a3'; //warning 3

  if(edsum.indexOf('(final warning:')!=-1) return 'a4'; //warning 4

  if(edsum.indexOf('(only warning:')!=-1) return 'a4'; //warning 4

  if(edsum.indexOf('blocked from editing')!=-1) return 'a5'; //warning 5



  //Huggle's are a lot simpler

  if(edsum.indexOf('level 1 warning')!=-1) return 'a1'; //warning 1

  if(edsum.indexOf('level 2 warning')!=-1) return 'a2'; //warning 2

  if(edsum.indexOf('level 3 warning')!=-1) return 'a3'; //warning 3

  if(edsum.indexOf('level 4 warning')!=-1) return 'a4'; //warning 4

  if(edsum.indexOf('level 5 warning')!=-1) return 'a5'; //warning 5



  //Unknown warnings

  if(edsum.indexOf('(warning user using')!=-1) return 'au'; //automated warning

  if(edsum.indexOf('warning')!=-1) return 'wu'; //unknown warning



  //Notifications

  if(edsum.indexOf('notify')!=-1) return 'no'; //notification

  if(edsum.indexOf('(notice')!=-1) return 'no'; //notification

  if(edsum.indexOf('notification')!=-1) return 'no'; //notification



  //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.

$(function() {

  if(location.href.indexOf("ais523count")!=-1&&location.href.indexOf("ais523countres")==-1)

  {

	// Counting edits. New, simpler jQuery version.

    var contribs=$(".mw-contributions-title").length;

    var contribsWithSummary=0;

    var sortcount=[];

    $(".comment").each(function(idx, element){

        contribsWithSummary++;

        var edsum=element.innerHTML;

        edsum=ecAnalyseSummary(edsum);

        if(edsum=='se')

        {

          //find the part beyond the last "</span>"

          edsum=element.innerHTML;

          sumloc=edsum.lastIndexOf("</span>");

          edsum=edsum.substr(sumloc+8);

          edsum=ecAnalyseSummary(edsum);

        }

        if(sortcountedsum===undefined) sortcountedsum=0;

        sortcountedsum++;

    });



    var namespace=ecGetParamValue("namespace");

    var scres="";

    var scit;

    for (scit in sortcount)

    {

      scres+="&cns"+namespace+scit+"="+sortcountscit];

    }

    if(nextnamespace(namespace) !== null)

      location.href=location.href.substr(0,location.href.lastIndexOf("namespace="))+

        "countns"+namespace+"="+contribs+scres+"&countnosum"+namespace+"="+(contribs-contribsWithSummary)+"&namespace="+nextnamespace(namespace);

    else

    { 

      var lh=location.href;

      location.href="//en.wikipedia.org/wiki/User:ais523/results?ais523countres="+lh+"&countns"+namespace+"="+contribs+scres+"&countnosum"+namespace+"="+(contribs-contribsWithSummary)

      //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";

    $(".ais523ecbody").each(function(idx,element) {

    var h=element.innerHTML;

    // First replacement: loop over namespaces.

    var hComponents = h.split("((pernamespace))");

    for (var hci = 1; hci < hComponents.length; hci++) {

    	var hcc = hComponentshci].split("((/pernamespace))");

    	var hcp = "";

    	for (var nsnum in namespaces) {

    		if (ecGetParamValue('countns'+nsnum) > 0)

    			hcp += hcc0].split("((NSNUM))").join(nsnum).split("((NSNAME))").join(namespacesnsnum])

    	}

    	hComponentshci = hcp + hcc1

    }

    h = hComponents.join("")

    

    // Second replacement: substitute in individual results.

    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 = 0;

      	for (var nsnum in namespaces)

      		g += new Number(ecGetParamValue('countns'+nsnum));

      }

      else if(g.indexOf("(")==-1)

        g=ecGetParamValue(g);

      if(g==null) g='0';

      f+=g+h.substr(h.indexOf("))")+2);

      h=f;

    }

    element.innerHTML=h;

    });

  }



});



//JavaScript diff finder. By [[User:ais523]]

$(function() {

  if(location.href.indexOf("Special")!=-1&&location.href.indexOf("Contributions")!=-1)

  {

    ecAddTab("javascript:ais523l1000()","last 1000","ca-ais523sort","Random diffs from recent edits","");

    ecAddTab("javascript:ais523l2000()","2000","ca-ais523sort","Random diffs from recent edits","");

  }

  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="//en.wikipedia.org/?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="//en.wikipedia.org/?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(m3!='') m2=" subpages";

    m4=decodeURIComponent(m2])+m2;

    m5=m2;

    if(cm4]]==undefined) cm4]]=0;

    if(cm4]]<10) q=cm4]];

    else if(Math.random()<10/(cm4]]+1)) q=Math.floor(Math.random()*10);

    else q=-1;

    cm4]]++;

    if(dm4]]==undefined) dm4]]=new Array();

    if(q>-1) dm4]][q=m;

    s=s.substr(s.search(re)+2);

  }

  var i;

  var j;

  for(i in c)

  {

    if(ci<5)

    {

      for(j in di])

      {

        var ns="(main)";

        var q;

        if(di][j][4].indexOf(":")!=-1) ns=di][j][4].substr(0,di][j][4].indexOf(":"));

        m=di][j];

        m2="Others in namespace "+ns;

        m3="";

        m4=m2];

        m5="";

        if(ncm4]]==undefined) ncm4]]=0;

        if(ncm4]]<10) q=ncm4]];

        else if(Math.random()<10/(ncm4]]+1)) q=Math.floor(Math.random()*10);

        else q=-1;

        ncm4]]++;

        if(dm4]]==undefined) dm4]]=new Array();

        if(q>-1) dm4]][q=m;

      }

    }

  }

  for(i in d)

  {

    if(nci!=undefined||ci>=5)

    for(j in di])

    {

      var m=di][j];

      m2=decodeURIComponent(m2]);

      if(am4]]==undefined) am4]]="*[[:"+m2].split("_").join(" ")+"]]"+m5+":";

      if(bm4]]==undefined) bm4]]="<li><a href='//en.wikipedia.org/wiki/"+

        m2+"'>"+m2].split("_").join(" ")+"</a>"+m5+":";

      am4]]+=" [http://en.wikipedia.org"+m1+"]";

      bm4]]+=" <a href='http://en.wikipedia.org"+m1+"'>["+(new Number(j)+1)+"]</a>";

    }

  }

  var e=0;

  for(i in c)

  {

    if(ci>=5)

    {

      ai+=(ci>10?"...":"")+" ("+ci+" edit(s))\n";

      bi+=(ci>10?"...":"")+" ("+ci+" edit(s))\n";

      if(ci>e) e=ci+1;

    }

  }

  for(i in nc)

  {

    if(nci>=5)

    {

      ai+=(nci>10?"...":"")+" ("+nci+" edit(s))\n";

      bi+=(nci>10?"...":"")+" ("+nci+" edit(s))\n";

    }

  }

  var trg=ecGetParamValue('target');

  var h="<h1>Contribution breakdown for <a href='//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(ci==j) h+=bi];

    }

  }

  for(i in nc) if(nci>=5) h+=bi];

  j=e;

  h+="</ul>\n<h2>Wikimarkup output</h2><pr"+"e>";

  while(--j>=5)

  {

    for(i in c)

    {

      if(ci==j) h+=ai];

    }

  }

  for(i in nc) if(nci>=5) h+=ai];

  h+="</p"+"re>";

  document.body.innerHTML=h;

}



// Log counter.

function ais523log()

{

  location.href="//en.wikipedia.org/?title=Special:Log&type=&user="+

    document.getElementById('user').value+"&page=&limit=5000&offset=0&ais523log=count";

}



$(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(hi].indexOf("block</a>)")!=-1)

        hi=hi].split("block</a>)")[1];

      else

        hi=hi].split("contribs</a>)")[1];

      hi=hi].split("<")[0].split('"').join("").split(" ").join("");

      if(hi==""&&i+1==h.length) hi="newuseraccount";

      else if(hi=="") hi="renamed"; //renames and original account creation are both ""

      if(jhi]]==null||jhi]]==undefined) jhi]]=0;

      jhi]]++;

    }

    h="";

    for(i in j)

      h+="<tr><td>"+i+"</td><td>"+ji+"</td></tr>";

    location.href="//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(mw.config.get('wgPageName')=="Special:Log")

    ecAddTab("javascript:ais523log()","count","ca-ais523log","Count","");    

});



// Contribution day/time counter

$(function(){

  if(mw.config.get('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='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_nybblesMath.floor(r/16)]+ais523dtc_nybblesr%16+

         ais523dtc_nybblesMath.floor(g/16)]+ais523dtc_nybblesg%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=ai].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_countswday*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_countswday*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:'//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('editcount="')[1].split('"')[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_countsi=0;

  aecwpajax.download({url:'//en.wikipedia.org/w/api.php?action=query&list=usercontribs&'+

    'ucuser='+encodeURIComponent(trg)+'&ucprop=timestamp&format=xml&uclimit=100',

    onSuccess:ais523dtcStep});

  aecwpajax.download({url:'//en.wikipedia.org/w/api.php?action=query&list=users&ususers='

    +encodeURIComponent(trg)+'&usprop=editcount&format=xml', onSuccess:ais523dtcook});

}



//</nowiki></pre>

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook