Welcome to the CycleChaos wiki.
You are currently viewing our wiki as a guest which prevents you from editing any pages you see, or participating in our forum, if you would like to do either please join our community today!
If you have any problems with the registration process or your account login, please contact contact us.

User:Budlight/admin/Bureaucrat.js

From CycleChaos

Jump to: navigation, search

Note - After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh); Konqueror: click Reload or press F5; Opera: clear the cache in Tools → Preferences; Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.

//<pre><nowiki>



//Analyze any user's contribs
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/History/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//END

//
RfAshowlinks = 'true';
//

//<pre><nowiki>

function jssubmitclose()
{
var form = document.getElementById('editform');
form.submit();
}
//END

function cratfinish()
{
if (location.href.indexOf('fakeaction=SRFAdelist&target=') != -1)
   {
   var name = unescape(location.href.split('&target=')[1].split('&target2=')[0]);
   var user = unescape(location.href.split('&target2=')[1]);
   var listing = "{{" + name + "}}";
   if (document.editform.wpTextbox1.value.indexOf(listing) == -1){alert('RfA already removed.'); return;}
   alert(name + ' delisted.');
   document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(listing,'');
   document.editform.wpSummary.value += "Closed, [[User:" + user + "|" + user + "]] promoted.";
   //jssubmitclose();
   }
else if (location.href.indexOf('&fakeaction=FRFAdelist&target=') != -1)
   {
   var name = unescape(location.href.split('&target=')[1].split('&target2=')[0]);
   var user = unescape(location.href.split('&target2=')[1]);
   var listing = "{{" + name + "}}";
   if (document.editform.wpTextbox1.value.indexOf(listing) == -1){alert('RfA already removed.'); return;}
   alert(name + ' delisted.');
   document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(listing,'');
   document.editform.wpSummary.value += "Closed, no consensus to promote [[User:" + user + "|" + user + "]].";
   //jssubmitclose();
   }
else if (location.href.indexOf('&fakeaction=RFAsucadd&target') != -1)
   {
   var target = unescape(location.href.split('&target=')[1].split('&')[0]);
   var name = '{{' + target + '}}' + '\n' + '----';
   var txt = document.editform.wpTextbox1.value;
   if (txt.indexOf('==Most recent successful nominations==') == -1){return;}
   document.editform.wpTextbox1.value = '==Most recent successful nominations==' + '\n' + name + txt.split('==Most recent successful nominations==')[1];
   document.editform.wpSummary.value += 'Adding "' + target + '".';
   //jssubmitclose();
   }
else if (location.href.indexOf('&fakeaction=RFAfailadd&target=') != -1)
   {
   addTab("javascript:Alpha_userwait2()", "(Add)", "ca-add", "Add", "");
   alert('Add "[NEW]" to the proper alphabetical location and press (add).');
   var to_add = unescape(location.href.split('&target=')[1].split('&')[0]);
   var name = to_add.split('[[')[1].split(']]')[0];
   document.editform.wpSummary.value += 'Adding "' + name + '".';
   }
}

//
var Alpha_user_done = 0;
function Alpha_userwait2()
{
   var to_add = unescape(location.href.split('&target=')[1].split('&')[0]);
   var name = to_add.split('[[')[1].split(']]')[0];
   if (Alpha_user_done == 1){alert('Already added.'); return;}
   if (document.editform.wpTextbox1.value.indexOf('[NEW]') != -1){Alpha_user_done=1;}
   document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace('[NEW]',to_add);
   //jssubmitclose();
}

function CHUlinks()
{
if(document.title.indexOf("Editing Wikipedia:Changing username (section)") == 0)
    {
        var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
        addlimenu(tabs, 'Rename results', 'chclosefunc');
        var chclosefunc = document.getElementById('chclosefunc').getElementsByTagName('ul')[0];
        //Rename results
        addlilink(chclosefunc, 'javascript:Cng_UName(1)', 'done', '');
        addlilink(chclosefunc, 'javascript:Cng_UName(2)', 'not done', '');
    }
}

//
Cng_UNamealready = 0;
//

function Cng_UName(type)
{
var z = 0;
if (type == 1 && Cng_UNamealready != 1)
  {
Cng_UNamealready=1;
document.editform.wpTextbox1.value += "\n" + ":{{done}} Done. ~~~~";
document.editform.wpSummary.value += "Complete.";
  }
else if (type == 2 && Cng_UNamealready != 1)
  {
Cng_UNamealready=1;
document.editform.wpTextbox1.value += "\n" + ":That username already exists. Please follow the instructions at the top of the page to select an unregistered username. ~~~~";
document.editform.wpSummary.value += ":{{not done}} Username already exists.";
  }
}

function crathide()
{
if (location.href.search(/&oldid=|&diff=/) !=-1){return;}
if (!RfAshowlinks){RfAshowlinks = 'false'}
if (document.title.split(' - ')[0] != 'Wikipedia:Requests for adminship' || RfAshowlinks != 'true'){return;}
//kill table of contents
if (document.getElementById('toc') && !window.ActiveXObject) 
  {document.getElementById('toc').innerHTML = '';}
//kill section edit links
var e=0;
var edivs = document.getElementsByTagName('div');
for (z=0; z<edivs.length; z++)
    {
    if (edivs[z].className == 'editsection')
      {edivs[z].innerHTML = '';}
    }
var rawhtml = document.getElementById('bodyContent').innerHTML;
if (rawhtml.indexOf('<h2>Current nominations for adminship</h2>') ==-1 || rawhtml.indexOf('<h2>About RfB</h2>') ==-1 || rawhtml.indexOf('<h2>Current nominations for bureaucratship</h2>') ==-1 || rawhtml.indexOf('<h2>About RfB</h2>') ==-1 || rawhtml.indexOf('<h2>Related requests</h2>') ==-1)
{return;}
//constants
var hidea = '<div class="NavFrame" style="border-style: none; text-align: left; border: darkblue solid 1px; background: #ffffff; padding: 5px;"><div class="NavHead"  style="border-style: none; background: lightgrey; text-align: center; padding: 2px; font-size: 130%;">' + '\n';
var hidea2 = '<div class="NavFrame" style="border-style: none; text-align: left; border: darkred solid 1px; background: #ffffff; padding: 5px;"><div class="NavHead"  style="border-style: none; background: lightgrey; text-align: center; padding: 2px; font-size: 130%;">' + '\n';
var hideb = '\n' + '</div><div class="NavContent" style="background: none; font-size: 100%; display: none;">';
var hidec = '<br>' + '</div></div>';
//Into
var docfirst = rawhtml.split('<h2>Current nominations for adminship</h2>')[0] + '<h2>Current nominations for adminship</h2>';
//RfAs
var doc = getSectionBodytext(rawhtml,'Current nominations for adminship','About RfB','h2');
//RfB text
var RfB_about = getSectionBodytext(rawhtml,'About RfB','Current nominations for bureaucratship','h2');
var doc_mid = '<p><a name="About_RfB" id="About_RfB"></a></p>' + '\n' + '<h2>About RfB</h2>' + RfB_about + '<p><a name="Current_nominations_for_bureaucratship" id="Current_nominations_for_bureaucratship"></a></p>' + '\n' + '<h2>Current nominations for bureaucratship</h2>';
//RfBs
var doc3 = getSectionBodytext(rawhtml,'Current nominations for bureaucratship','Related requests','h2');
//End
var doclast = '<p><a name="Related_requests" id="Related_requests"></a></p>' + rawhtml.split('<p><a name="Related_requests" id="Related_requests"></a></p>')[1];
//RfA parser
var array = doc.split('<h3><a href="/wiki/Wikipedia:Requests_for_adminship/');
var newdoc = '';
for (var i=0; i<array.length; i++)
  {
  if (i != 0) {var newsub = '<h3><a href="/wiki/Wikipedia:Requests_for_adminship/' + array[i];}
  else {var newsub = array[i];}
  var user_name = array[i].split('" title=')[0];
  if (newsub.search(/rel=["']nofollow["']>(voice your |vote|discuss).+<\/a>.+(\) |\)|<b>|<b> )end(ing|ed) .{0,3}\d\d:\d\d.+\(UTC\)<\/b>/i) != -1)
    {
   var tally = '';
   var status = '';
   if (newsub.search(/\(\d+\/\d+\/\d+\)/) != -1)
    {
    tally = newsub.match(/\(\d+\/\d+\/\d+\)/)[0];
    var S = tally.match(/\d+/g)[0];
    var O = tally.match(/\d+/g)[1];
    var T = 1*S + 1*O;
    tally = "-- <span style='color: darkblue'><i>" + tally + "</i></span>";
    var status = " [<span style='color: darkred'>" + Math.round((100)*S/T) + "%</span>]";
    }
   var subtitle = newsub.split('(UTC)</b>')[0] + '(UTC)</b> ' + status + '</b></p>';
   var subbody = '<br><br>' + newsub.split('(UTC)</b>')[1];
   addsub = '<br>' + hidea + subtitle + '<br>' + hideb + subbody + hidec + '</b></s></i><br>';
    }
//bad RfAs
  else if (i != 0 && newsub.indexOf('(UTC)</b>') != -1 && newsub.search(/(\) |\)|<b>|<b> )end(ing|ed) .{0,3}\d\d:\d\d/i) !=-1)
    {
   var subtitle = newsub.split('(UTC)</b>')[0] + '(UTC) (JS: <a href="http://en.wikipedia.org/wiki/Wikipedia:Requests' + user_name + '"> RfA</a> non-standard)</b></p>';
   var subbody = '<br><br>' + newsub.split(' (UTC)</b>')[1];
   addsub = '<br>' + hidea + subtitle + '<br>' + hideb + subbody + hidec + '</b></s></i><br>';
    }
//default, just add the html
   else if (i !=0)
      {newsub = '<h3><a href="/wiki/Wikipedia:Requests_for_adminship/' + array[i]; addsub = newsub;}
   else {newsub = array[i]; addsub = newsub;}
    newdoc += addsub;
  }
//RfB parser
var array = doc3.split('<h3><a href="/wiki/Wikipedia:Requests_for_bureaucratship/');
var newdoc2 = '';
for (var i=0; i<array.length; i++)
  {
  if (i != 0) {var newsub = '<h3><a href="/wiki/Wikipedia:Requests_for_bureaucratship/' + array[i];}
  else {var newsub = array[i];}
  var user_name = array[i].split('" title=')[0];
  if (newsub.search(/rel=["']nofollow["']>(voice your |vote|discuss).+<\/a>.+(\) |\)|<b>|<b> )end(ing|ed) .{0,3}\d\d:\d\d.+\(UTC\)<\/b>/i) != -1)
    {
   var tally = '';
   var status = '';
   if (newsub.search(/\(\d+\/\d+\/\d+\)/) != -1)
    {
    tally = newsub.match(/\(\d+\/\d+\/\d+\)/)[0];
    var S = tally.match(/\d+/g)[0];
    var O = tally.match(/\d+/g)[1];
    var T = 1*S + 1*O;
    tally = "-- <span style='color: darkblue'><i>" + tally + "</i></span>";
    var status = " [<span style='color: darkred'>" + Math.round((100)*S/T) + "%</span>]";
    }
   var subtitle = newsub.split('(UTC)</b>')[0] + '(UTC)</b> ' + status + '</b></p>';
   var subbody = '<br><br>' + newsub.split('(UTC)</b>')[1];
   addsub = '<br>' + hidea2 + subtitle + '<br>' + hideb + subbody + hidec + '</b></s></i><br>';
    }
//bad RfBs
  else if (i != 0 && newsub.indexOf('(UTC)</b>') != -1 && newsub.search(/(\) |\)|<b>|<b> )end(ing|ed) .{0,3}\d\d:\d\d/i) !=-1)
    {
   var subtitle = newsub.split('(UTC)</b>')[0] + '(UTC) (JS: <a href="/wiki/Wikipedia:Requests_for_bureaucratship/' + user_name + '"> RfA</a> non-standard)</b></p>';
   var subbody = '<br><br>' + newsub.split(' (UTC)</b>')[1];
   addsub = '<br>' + hidea2 + subtitle + '<br>' + hideb + subbody + hidec + '</b></s></i><br>';
    }
//default, just add the html
  else if (i !=0)
      {newsub = '<h3><a href="/wiki/Wikipedia:Requests_for_bureaucratship/' + array[i]; addsub = newsub;}
   else {newsub = array[i]; addsub = newsub;}
    newdoc2 += addsub;
  }
document.getElementById('bodyContent').innerHTML = docfirst + newdoc + doc_mid + newdoc2 + doclast;
}
//END

//Get text in between two <h2>heading</h2> tag (eventually, h1, h3, ect...)
//the first input is the raw parent xml
//this assumes unique titles!
function getSectionBodytext(html,firstheading,nextheading,level)
{
var htag = '<' + level + '>';
var ehtag = '</' + level + '>';
var first_id = '<p><a name="' + firstheading.replace(/ /g,'_') + '" id="' + firstheading.replace(/ /g,'_') + '"></a></p>';
var next_id = '<p><a name="' + nextheading.replace(/ /g,'_') + '" id="' + nextheading.replace(/ /g,'_') + '"></a></p>';
var first_header = htag + firstheading + ehtag;
var next_header =htag + nextheading + ehtag;
var body_html = html.split(first_header)[1].split(next_id)[0];
return body_html;
}

function crattools()
{
  if(document.getElementById('ca-talk') && document.title.indexOf('Wikipedia:') != -1)
   {document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';}
  if (document.title.indexOf('Editing Wikipedia:Requests for adminship/') != -1)
    {
     addTab("javascript:cratClose(1)", "(Success)", "ca-cratS", "Close as success", "");
     addTab("javascript:cratClose(-1)", "(Failure)", "ca-cratF", "Close as failure", "");
    } 
  else if (document.title.indexOf('Editing ') == -1 && document.title.indexOf('Wikipedia:Requests for adminship/') != -1 && location.href.indexOf('=history') == -1)
    {
     addTab("javascript:cratcomment()", "mess", "ca-cratI", "Leave user a new message", "");
    }
}
//END

function jssubmitclose()
{
var form = document.getElementById('editform');
form.submit();
setTimeout('window.close()',12000);
}
//END

function cratClose(type)
{
var txt = document.editform.wpTextbox1.value;
var RfAName = document.title.split(' (section)')[0].split(' - ')[0].split('Editing ')[1];
var user_name = RfAName;
if (txt.indexOf('{{User|') != -1)
{user_name = txt.split('{{User|')[1].split('}}')[0].split('}')[0]}
else if (txt.indexOf('{{user|') !=-1)
{user_name = txt.split('{{user|')[1].split('}}')[0].split('}')[0]}
var message = 'Closing ' + RfAName + '.'; 
var return_value = confirm(message); 
if (return_value != true){return;}
if (document.editform.wpTextbox1.value.indexOf('The following discussion is preserved as an archive of') != -1)
{alert('Already closed!'); return;}
var txt = document.editform.wpTextbox1.value;
  if (type == 1)
  {
  var deadlink = 'NOT_FOUND_LINK_YET';
  if (txt.indexOf('{{subst:rfab}') != -1){alert('Already closed!'); return;}
  var now = new Date();
  var timeValue = now.toUTCString().replace(/GMT/, "(UTC)");
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/ending \d\d:\d\d, .+ \(UTC\)/i,'Ended ' + timeValue);
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\|action=edit\}\} (voice|vote|discuss|comment) .{1,20}\]/ig,"|action=edit}} Final]");
  document.editform.wpTextbox1.value = "{{subst:rfap}}" + "\n" + document.editform.wpTextbox1.value + "{{subst:rfab}}";
  document.editform.wpSummary.value += "Closing successful nomination."; window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Requests_for_adminship&action=edit&fakeaction=SRFAdelist&target=' + escape(RfAName) + '&target2=' + escape(user_name),'targetnameBCratcloseRFA','location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Recently_created_admins&action=edit&section=1&fakeaction=RFAsucadd&target=' + escape(RfAName),'targetnameBCratcloserecentRFA','location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  cratpromote();
  }
  if (type == -1)
  {
  var deadlink = 'NOT_FOUND_LINK_YET';
  if (txt.indexOf('{{subst:rfab}') != -1){alert('Already closed!'); return;}
  var now = new Date();
  var timeValue = now.toUTCString().replace(/GMT/, "(UTC)");
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/ending \d\d:\d\d, .+ \(UTC\)/i,'Ended ' + timeValue);
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\|action=edit\}\} (voice|vote|discuss|comment) .{1,20}\]/ig,"|action=edit}} Final]");
  document.editform.wpTextbox1.value = "{{subst:rfaf}}" + "\n" + document.editform.wpTextbox1.value + "{{subst:rfab}}";
  document.editform.wpSummary.value += "Closing unsuccessful nomination.";
  var tally = '';
  if (txt.search(/\(\d+\/\d+\/\d+\)/) != -1)
    {tally = txt.match(/\(\d+\/\d+\/\d+\)/)[0];}
  var RfA_data = '*[[' + RfAName + '|' + user_name + ']], ' + timeValue + ' - consensus not reached at ' + tally;
  var sec=0;
  var secoffset=1;
  var sec = alpha_sec(user_name);
  sec+=secoffset;
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Requests_for_adminship&action=edit&fakeaction=FRFAdelist&target=' + escape(RfAName) + '&target2=' + escape(user_name),'targetnameBCratcloseRFA','location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Unsuccessful_adminship_candidacies&action=edit&section=' + sec + '&fakeaction=RFAfailadd&target=' + escape(RfA_data),'targetnameBCratcloserecentRFA','location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function alpha_sec(string)
{
var letter = string.substring(0,1).toLowerCase();
if (letter == 'a'){sec=1;}
else if (letter == 'b'){sec=2;}
else if (letter == 'c'){sec=3;}
else if (letter == 'd'){sec=4;}
else if (letter == 'e'){sec=5;}
else if (letter == 'f'){sec=6;}
else if (letter == 'g'){sec=7;}
else if (letter == 'h'){sec=8;}
else if (letter == 'i'){sec=9;}
else if (letter == 'j'){sec=10;}
else if (letter == 'k'){sec=11;}
else if (letter == 'l'){sec=12;}
else if (letter == 'm'){sec=13;}
else if (letter == 'n'){sec=14;}
else if (letter == 'o'){sec=15;}
else if (letter == 'p'){sec=16;}
else if (letter == 'q'){sec=17;}
else if (letter == 'r'){sec=18;}
else if (letter == 's'){sec=19;}
else if (letter == 't'){sec=20;}
else if (letter == 'u'){sec=21;}
else if (letter == 'v'){sec=22;}
else if (letter == 'w'){sec=23;}
else if (letter == 'x'){sec=24;}
else if (letter == 'y'){sec=25;}
else if (letter == 'z'){sec=26;}
else {sec=0;}
return sec;
}

function cratcomment()
{
var user_name = document.title.split('Wikipedia:Requests for adminship/')[1].split(' - ')[0];
if (document.getElementsByTagName('h3')[1])
{
  if (document.getElementsByTagName('h3')[1].getElementsByTagName('strong')[0])
  {user_name = document.getElementsByTagName('h3')[1].getElementsByTagName('strong')[0].innerHTML;}
  else
  {user_name = document.getElementsByTagName('h3')[1].innerHTML;}
}
window.open('http://en.wikipedia.org/w/index.php?title=User_talk:' + user_name + '&action=edit&section=new',
              'targetnameBCratclose',
'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
}

function cratpromote()
{
var user_name = document.title.split('Wikipedia:Requests for adminship/')[1].split(' - ')[0];
if (document.editform.wpTextbox1.value.match(/\{\{user\|.+\}\}/ig))
  {user_name = document.editform.wpTextbox1.value.split(/\{\{user\|/i)[1].split(/\}\}/)[0];}
window.open('http://en.wikipedia.org/w/index.php?title=Special%3AMakesysop&wpMakesysopUser=' + escape(user_name),
              'targetnameBCratclose',
'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
}

function cratstats_add()
{
if (location.href.indexOf('&action=history') ==-1 || document.title.search(/Wikipedia:Requests for (adminship|bureaucratship)\//) !=0){return;}
var name = document.title.split(' - ')[0];
var url = 'http://en.wikipedia.org/w/index.php?title=' + name + '&action=history&limit=5000&jsaction=validate';
addTab(url, "data", "ca-vstats", "Voter statistics", "");
}

function crat_stats()
{
if (location.href.indexOf('&limit=5000&jsaction=validate') ==-1){return;}
//monobook
if (document.getElementById('bodyContent'))
  {var body = document.getElementById('bodyContent');}
//cologneblue
else
  {var body = document.getElementById('content');}
var l = body.getElementsByTagName('li');
var html = '<p><strong>List of participants on this page:</strong></p>';
var thenamelist = '|';
  for (var i=l.length-1; i >= 0; i--)
  {
  if (l[i].innerHTML.indexOf('>) (last)') !=-1)
    {var name = l[i].getElementsByTagName('a')[2].innerHTML; var date = l[i].getElementsByTagName('a')[1].innerHTML;}
  else if (l[i].innerHTML.indexOf('(cur) (<') !=-1)
    {var name = l[i].getElementsByTagName('a')[2].innerHTML; var date = l[i].getElementsByTagName('a')[1].innerHTML;}
  else
    {var name = l[i].getElementsByTagName('a')[3].innerHTML; var date = l[i].getElementsByTagName('a')[2].innerHTML;}
  if (thenamelist.indexOf('|' + name + '|') ==-1)
    {
    thenamelist += name + '|';
    var name_link = '<a href="/wiki/User:' + name + '">' + name + '</a>';
    html += '\n' + '<li>' + name_link + ' -- ' + date + '</li>';
    }
  }
body.innerHTML = body.innerHTML.split('<!-- start content -->')[0] + '<!-- start content -->' + '<ul id="voterstats">' + html + '</ul>';
//number our voters
  var l = body.getElementsByTagName('li');
  for (var i=0; i<l.length; i++)
  {
  var num = i+1;
  l[i].innerHTML = '<strong>#' + num + '</strong> ' + l[i].innerHTML;
  }
consec_votercheck(0);
}

//
var voter_index = 0;
var name_user_vote = '';
function consec_votercheck(voter_index)
{
if (document.getElementById('voterstats').getElementsByTagName('li')[voter_index])
  {
current_user_name = document.getElementById('voterstats').getElementsByTagName('li')[voter_index].getElementsByTagName('a')[0].innerHTML;
var URL = '/w/index.php?title=Special%3ALog&type=newusers&page=User:' + current_user_name + '&useskin=monobook';
  xml_http = HTTPClient();
  xml_http.open("GET", URL, true);
  xml_http.onreadystatechange = consec_votercheck_last;
  xml_http.send(null);
  }
else 
  {return;}
}

function consec_votercheck_last()
{
  if (xml_http.readyState != 4)
  {return;}
  var doc = xml_http.responseText.split('<div id="bodyContent">')[1];
  var date = '(<i>older account</i>)';
  if (doc.indexOf('<ul>') !=-1)
  {
    doc = doc.split('<ul>')[1].split('</ul>')[0];
    if (doc.indexOf('<li>') !=-1)
      {date = '<span style="color:darkred;">' + doc.split('<li>')[1].split('</li>')[0].split('<a href=')[0].split('(')[0] + '</span>';}
  }
  date = ' <strong> Created:</strong> ' + date;
  document.getElementById('voterstats').getElementsByTagName('li')[voter_index].innerHTML += date;
//
var URL = '/w/index.php?title=Special:Contributions&go=first&limit=1&target=' + current_user_name + '&useskin=monobook';
  xml_http = HTTPClient();
  xml_http.open("GET", URL, true);
  xml_http.onreadystatechange = consec_votercheck_edits;
  xml_http.send(null);
}

function consec_votercheck_edits()
{
  if (xml_http.readyState != 4)
  {return;}
  var doc = xml_http.responseText.split('<div id="bodyContent">')[1];
  var first = '(<i>error</i>)';
  if (doc.indexOf('<ul>') !=-1)
  {
    doc = doc.split('<ul>')[1].split('</ul>')[0];
    if (doc.indexOf('<li>') !=-1)
      {first = doc.split('<li>')[1].split('</li>')[0].split('<a href=')[0].split('(')[0];}
  }
  first = ' <strong> First edit:</strong> ' + first;
  document.getElementById('voterstats').getElementsByTagName('li')[voter_index].innerHTML += first;
//
var URL = '/w/index.php?title=Special:Contributions&limit=500&target=' + current_user_name + '&useskin=none';
  xml_http = HTTPClient();
  xml_http.open("GET", URL, true);
  xml_http.onreadystatechange = consec_votercheck_blocks;
  xml_http.send(null);
}

function consec_votercheck_blocks()
{
  if (xml_http.readyState != 4)
  {return;}
  var doc = xml_http.responseText.split("<div id='article'>")[1];
  var edits = 0;
  if (doc.indexOf('<ul>') !=-1)
  {
    doc = doc.split('<ul>')[1].split('</ul>')[0];
    if (doc.match(/<li>.+<\/li>/g)){edits = doc.match(/<li>.+<\/li>/g).length;}
  }
  if (edits >= 500){edits = '<span style="color:blue;">500+</span>';}
  else if (edits <= 100){edits = '<span style="color:red;">' + edits + '</span>';}
  else {edits = '<span style="color:darkred;">' + edits + '</span>';}
  edits = ' <strong> Edits:</strong> ' + edits;
  document.getElementById('voterstats').getElementsByTagName('li')[voter_index].innerHTML += edits;
//
var URL = '/w/index.php?title=Special:Log&type=block&limit=5000&page=User:' + current_user_name + '&useskin=monobook';
  xml_http = HTTPClient();
  xml_http.open("GET", URL, true);
  xml_http.onreadystatechange = consec_votercheck_next;
  xml_http.send(null);
}

function consec_votercheck_next()
{
  if (xml_http.readyState != 4)
  {return;}
  var doc = xml_http.responseText.split('<div id="bodyContent">')[1];
  var blocks = 0;
  if (doc.indexOf('<ul>') !=-1)
  {
    doc = doc.split('<ul>')[1].split('</ul>')[0];
    if (doc.match(/<li>.+<\/a>\) blocked "<a href=.+<\/li>/g))
      {blocks = doc.match(/<li>.+<\/a>\) blocked "<a href=.+<\/li>/g).length;}
  }
  if (blocks > 0){blocks = '<a href="/w/index.php?title=Special:Log&type=block&limit=5000&page=User:' + current_user_name + '"><span style="color:red;">' + blocks + '</span></a>';}
  blocks = ' <strong> Blocks:</strong> ' + blocks;
  document.getElementById('voterstats').getElementsByTagName('li')[voter_index].innerHTML += blocks;
//re-iterate
  voter_index += 1;
  consec_votercheck(voter_index);
}

addOnloadHook(crat_main)
function crat_main()
{
crattools();
cratfinish();
CHUlinks();
crathide();
cratstats_add();
crat_stats();
}

//</nowiki></pre>
Personal tools
Advertisement