All pastes #506452 Raw Edit

Miscellany

public javascript v1 · immutable
·published 2007-05-24 00:06 UTC
rendered paste body
// -----------------------------------------------------------------------------// God-like Monobook skin// (c) 2005 Sam Hocevar <sam@zoy.org>// $Id: godmode-light.js 1106 2006-04-03 20:25:37Z sam $// -----------------------------------------------------------------------------// -----------------------------------------------------------------------------// Language support, taken from phase3/languages/*// -----------------------------------------------------------------------------var rollbacklink = 'rollback';var cantrollback = 'Cannot revert edit; last contributor is only author of this page.';var alreadyrolled = 'Cannot rollback last edit of [[$1]] by [[User:$2|$2]] ([[User talk:$2|talk]]); someone else has edited or rolled back the page already. Last edit was by [[User:$3|$3]] ([[User talk:$3|Talk]]). ';var revertpage = 'Reverted edits by [[Special:Contributions/$2|$2]] ([[User talk:$2|talk]]) to last version by $1';switch (document.getElementsByTagName('html')[0].lang) {  case 'fr':    rollbacklink = 'r&#65411;&#65385;voquer';    cantrollback = 'Impossible de r&#65411;&#65385;voquer: dernier auteur est le seul &#65411;  avoir modifi&#65411;&#65385; cet article';    alreadyrolled = 'Impossible de r&#65411;&#65385;voquer la derni&#65411;&#65384;re modification de [[$1]] par  [[User:$2|$2]] ([[User talk:$2|talk]]); quelqu\'un d\'autre &#65411;  d&#65411;&#65385;j&#65411;  modifer ou r&#65411;&#65385;voquer l\'article. La derni&#65411;&#65384;re modificaion &#65411;&#65385;tait de [[User:$3|$3]] ([[User talk:$3|Talk]]). '; // lol @ pathetic grammar    revertpage = "R&#65411;&#65385;vocation des modifications de [[Special:Contributions/$2|$2]] et restauration d'une pr&#65411;&#65385;c&#65411;&#65385;dente version de $1";    break;  case 'de':    rollbacklink = 'Zur&#65411;&#65404;cksetzen';    cantrollback = 'Die &#65411;&#12539;derung kann nicht zur&#65411;&#65404;ckgenommen werden; der letzte Autor ist der einzige.';    alreadyrolled = 'Die Zur&#65411;&#65404;cknahme des Artikels [[$1]] von [[Benutzer:$2|$2]] ([[Benutzer Diskussion:$2|Diskussion]]) ist nicht m&#65411;&#65398;glich, da eine andere &#65411;&#12539;derung oder R&#65411;&#65404;cknahme erfolgt ist.  Die letzte &#65411;&#12539;derung ist von [[Benutzer:$3|$3]] ([[Benutzer Diskussion:$3|Diskussion]])';    revertpage = '&#65411;&#12539;derungen von [[Benutzer:$2]] r&#65411;&#65404;ckg&#65411;&#65380;ngig gemacht und letzte Version von [[Benutzer:$1]] wiederhergestellt';    break;  case 'es':    rollbacklink = 'Revertir';    cantrollback = 'No se pueden revertir las ediciones; el &#65411;&#65402;ltimo colaborador es el &#65411;&#65402;nico autor de este art&#65411;&#65389;culo.';    alreadyrolled = 'No se puede revertir la &#65411;&#65402;ltima edici&#65411;&#65395;n de [[$1]] por [[Colaborador:$2|$2]] ([[Colaborador Discusi&#65411;&#65395;n:$2|Discusi&#65411;&#65395;n]]); alguien m&#65411;&#65377;s ya ha editado o revertido esa p&#65411;&#65377;gina.  La &#65411;&#65402;ltima edici&#65411;&#65395;n fue hecha por [[Colaborador:$3|$3]] ([[Colaborador Discusi&#65411;&#65395;n:$3|Discusi&#65411;&#65395;n]]). ';    revertpage = 'Revertida a la &#65411;&#65402;ltima edici&#65411;&#65395;n de $1';    break;  case 'it':    rollbacklink = 'rollback';    cantrollback = 'Impossibile tornare ad una versione precedente: l\'ultima modifica &#65411;&#65384; stata apportata dall\'unico utente che abbia lavorato a questo articolo.';    //alreadyrolled = '';    revertpage = 'Riportata alla revisione precedente da $1';    break;  case 'pt':    rollbacklink = 'voltar';    cantrollback = 'N&#65411;&#65379;o foi poss&#65411;&#65389;vel reverter a edi&#65411;&#65383;&#65411;&#65379;o; o &#65411;&#65402;ltimo contribuidor &#65411;&#65385; o &#65411;&#65402;nico autor deste artigo.';    alreadyrolled = 'N&#65411;&#65379;o foi poss&#65411;&#65389;vel reverter as edi&#65411;&#65383;&#65411;&#65397;es de  [[$1]] por [[User:$2|$2]] ([[User talk:$2|Talk]]); algu&#65411;&#65385;m o editou ou j&#65411;&#65377; o reverteu.  A &#65411;&#65402;ltima edi&#65411;&#65383;&#65411;&#65379;o foi de  [[User:$3|$3]] ([[User talk:$3|Conversar com ele]]). ';    revertpage = 'Revertidas edi&#65411;&#65383;&#65411;&#65397;es por [[Special:Contributions/$2|$2]], para a &#65411;&#65402;ltima vers&#65411;&#65379;o por $1';    break;}// -----------------------------------------------------------------------------// XMLHttpRequest support// -----------------------------------------------------------------------------if (document.implementation.createDocument) {  var gml_xmlparser = new DOMParser();}function gml_XMLParse(string) {  if (document.implementation.createDocument) {    return gml_xmlparser.parseFromString(string, "text/xml");  } else if (window.ActiveXObject) {    var gml_xmldoc = new ActiveXObject("Microsoft.XMLDOM");    gml_xmldoc.async = "false";    ret = gml_xmldoc.loadXML(string);          if (!ret)      return null;    return gml_xmldoc.documentElement;  }  return null;}var gml_xmlhttp;function HTTPClient() {  var gml_http;  if(window.XMLHttpRequest) {    gml_http = new XMLHttpRequest();  } else if (window.ActiveXObject) {    try {      gml_http = new ActiveXObject("Msxml2.XMLHTTP");    } catch (e) {      try {        gml_http = new ActiveXObject("Microsoft.XMLHTTP");      } catch (E) {        gml_http = false;      }    }  }  return gml_http;}// -----------------------------------------------------------------------------// MD5 hash calculator// -----------------------------------------------------------------------------// Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.// Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet// Distributed under the BSD License// See http://pajhome.org.uk/crypt/md5 for more info.// -----------------------------------------------------------------------------var hexcase = 0;var b64pad  = "";var chrsz   = 8;function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}function core_md5(x, len){  x[len >> 5] |= 0x80 << ((len) % 32);  x[(((len + 64) >>> 9) << 4) + 14] = len;  var a =  1732584193;  var b = -271733879;  var c = -1732584194;  var d =  271733878;  for(var i = 0; i < x.length; i += 16)  {    var olda = a;    var oldb = b;    var oldc = c;    var oldd = d;    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819); b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426); c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416); d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i+10], 17, -42063); b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682); d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); c = md5_gg(c, d, a, b, x[i+11], 14,  643717713); b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083); c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438); d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501); a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473); b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562); b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353); c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174); d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189); a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); c = md5_hh(c, d, a, b, x[i+15], 16,  530742520); b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415); c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571); d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359); d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649); a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259); b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);    a = safe_add(a, olda);    b = safe_add(b, oldb);    c = safe_add(c, oldc);    d = safe_add(d, oldd);  }  return Array(a, b, c, d);}function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); }function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); }function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); }function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); }function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); }function safe_add(x, y){  var lsw = (x & 0xFFFF) + (y & 0xFFFF);  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);  return (msw << 16) | (lsw & 0xFFFF);}function bit_rol(num, cnt){  return (num << cnt) | (num >>> (32 - cnt));}function str2binl(str){  var bin = Array();  var mask = (1 << chrsz) - 1;  for(var i = 0; i < str.length * chrsz; i += chrsz)    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);  return bin;}function binl2hex(binarray){  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";  var str = "";  for(var i = 0; i < binarray.length * 4; i++)  {    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);  }  return str;}// -----------------------------------------------------------------------------// Our nice Revert functions// -----------------------------------------------------------------------------var gml_vandal, gml_editor, gml_url;function PerformRevert() {  var l, token = '', revert = false;  // Look for '&fakeaction=rollback' in URL  gml_url = location.pathname;  l = location.search.substring(1).split('&');  for (i = 0; i < l.length; i++) {    var n = l[i].indexOf('=');    var name = l[i].substring(0, n);    if (name == 'fakeaction') {      if (l[i].substring(n + 1) == 'rollback')        revert = true;    } else if (name == 'vandal') {      gml_vandal = unescape(l[i].substring(n + 1));    } else if (name == 'token') {      token = unescape(l[i].substring(n + 1));    } else if (name == 'title') {      gml_url += '?' + l[i];    }  }  if (!revert)    return;  document.getElementById('bodyContent').innerHTML = 'Please wait, reverting edits by ' + gml_vandal + '...';  // Avoid XSS kiddies by using a special token  if (token == '' || token != hex_md5(gml_url + gml_vandal + document.cookie)) {    document.getElementById('bodyContent').innerHTML += '<br />Bad authentication token!';    return;  }  gml_xmlhttp = HTTPClient();  if (!gml_xmlhttp)    return;  history_url = gml_url + '&action=history&limit=50';  document.getElementById('bodyContent').innerHTML += '<br />Getting article history (' + history_url + ')...';  gml_xmlhttp.open("GET", history_url, true);  gml_xmlhttp.onreadystatechange = RevertStepTwo;  gml_xmlhttp.send(null);}function RevertStepTwo() {  if (gml_xmlhttp.readyState != 4)    return;  var l;  var oldid;  // Get the vandal and new editor names  gml_vandal = gml_vandal.replace(/_/g, ' ');  gml_editor = '';  // Hack for a MediaWiki bug  xml = gml_xmlhttp.responseText.replace(/<body.*"ns-4">/, '<body class="ns-4">');  doc = gml_XMLParse(xml);  if (!doc || !doc.getElementById('pagehistory')) {    document.getElementById('bodyContent').innerHTML += '<br />Failed to parse XML data returned by the server.';    document.getElementById('bodyContent').innerHTML += '<br /><b>Hint: try to disable both "Enable section editing by right-clicking on section titles (JavaScript)" and "Edit pages on double click (JavaScript)" in your editing preferences until a proper fix is found</b>.';    document.getElementById('bodyContent').innerHTML += '<br />Dump of the unparseable page : <br />' + xml.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');    return;  }  l = doc.getElementById('pagehistory').getElementsByTagName('li');  //l = doc.selectSingleNode('//*[@id="pagehistory"]').getElementsByTagName('li');  for (i = 0; i < l.length; i++) {    var name = l[i].getElementsByTagName('span')[0].getElementsByTagName('a')[0].innerHTML.replace(/_/g, ' ');    if (i == 0 && name != gml_vandal) {      document.getElementById('bodyContent').innerHTML += '<br />Error: Last editor is ' + name + ', not ' + gml_vandal + '!';      return;    } else if (i > 0 && name != gml_vandal) {      oldid = l[i].getElementsByTagName('input')[0].value;      gml_editor = name;      break;    }  }  if (gml_editor == '') {    document.getElementById('bodyContent').innerHTML += '<br />Error: ' + gml_vandal + ' is the only editor!';    return;  }  gml_xmlhttp = HTTPClient();  if (!gml_xmlhttp)    return;  document.getElementById('bodyContent').innerHTML += '<br />Getting article edit form (GET' + gml_url + '&action=edit&oldid=' + oldid + ')...';  gml_xmlhttp.open('GET', gml_url + '&action=edit&oldid=' + oldid, true);  gml_xmlhttp.onreadystatechange = RevertStepThree;  gml_xmlhttp.send(null);}function RevertStepThree() {  if (gml_xmlhttp.readyState != 4)    return  var form, newform, l;  // Insert the downloaded form in our current page, using  // only hidden form inputs.  doc = gml_XMLParse(gml_xmlhttp.responseText);  form = doc.getElementById('editform');  newform = document.createElement('form');  l = form.getElementsByTagName('textarea');  for (i = l.length; i--; ) {    var t = document.createElement('input');    t.type = 'hidden';    t.name = l[i].name;    t.value = l[i].value;    newform.appendChild(t);  }  l = form.getElementsByTagName('input');  for (i = l.length; i--; ) {    if (l[i].name == 'wpSummary') {      l[i].value = revertpage.replace(/\$1/g, gml_editor).replace(/\$2/g, gml_vandal);    } else if (l[i].name == 'wpMinoredit') {      l[i].value = '1';    } else if (l[i].name == 'wpWatchthis') {      if (!l[i].checked)        continue; // Don&#31414;&#20914; touch the "watch" status      l[i].value = "on";    } else if (l[i].name == 'wpPreview') {      continue;    } else if (l[i].name == 'wpDiff') {      continue;    }    l[i].type = 'hidden';    newform.appendChild(l[i]);  }  newform.name = form.name;  newform.method = form.method;  newform.id = form.id;  newform.action = form.action;  document.getElementById('bodyContent').innerHTML += '<br />Submitting form...';  document.getElementById('bodyContent').appendChild(newform);  // Submit the form  newform.submit();}// -----------------------------------------------------------------------------// Add revert buttons to the page// -----------------------------------------------------------------------------function AddRevertButtons() {  var l, article = '', vandal;  // Add 'revert' links to a diff page  l = document.getElementById('bodyContent').getElementsByTagName('td');  for (i = 0; i < l.length; i++) {    if (l[i].className == 'diff-otitle') {      article = l[i].getElementsByTagName('a')[0].href.split('&')[0].replace(/[^\/]*\/\/[^\/]*/, '');    } else if (l[i].className == 'diff-ntitle') {      var toplink = l[i].getElementsByTagName('a')[0].href;      vandal = l[i].getElementsByTagName('a')[4].title.split(':')[1];      var t = l[i].innerHTML      n = t.indexOf('</a>) <br') + t.indexOf('</A>) <BR') + 1; // XXX: WOW HACK!!!!      if (n >= 0 && article != '' && toplink.indexOf('oldid=') == -1) {        l[i].innerHTML = t.substring(0, n + 5) + ' &nbsp;&nbsp;&nbsp;<strong>[<a href="' + article + '&fakeaction=rollback&vandal=' + vandal + '&token=' + hex_md5(article + vandal + document.cookie) + '">' + rollbacklink + '</a>]</strong> ' + t.substring(n + 5, t.length);      }    }  }  // Add 'revert' links to a contributions page  if (location.href.indexOf(':Contributions') != -1) {    var c = document.getElementById('contentSub');    var a = c.getElementsByTagName('a');    if (a.length >= 2) {      vandal = a[0].innerHTML;    } else {      vandal = c.innerHTML.replace(/ \(.*/, '').replace(/.* /, '');    }    l = document.getElementById('bodyContent').getElementsByTagName('li');    for (i = 0; i < l.length; i++) {      var t = l[i].innerHTML      // If we are already a sysop on this wiki, abort      if (t.indexOf('>' + rollbacklink + '</a>]') != -1)          break;      //if (t.indexOf('&amp;diff=0') != -1) {      if (t.indexOf('<strong> (') != -1) {        article = l[i].getElementsByTagName('a')[0].href.split('&')[0].replace(/[^\/]*\/\/[^\/]*/, '');        l[i].innerHTML += ' [<a href="' + article + '&fakeaction=rollback&vandal=' + vandal + '&token=' + hex_md5(article + vandal + document.cookie) + '">' + rollbacklink + '</a>]';      }    }  }}// -----------------------------------------------------------------------------// Modify the page once it is loaded// -----------------------------------------------------------------------------if (window.addEventListener) {  window.addEventListener("load", PerformRevert, false);  window.addEventListener("load", AddRevertButtons, false);} else if (window.attachEvent) {  window.attachEvent("onload", PerformRevert);  window.attachEvent("onload", AddRevertButtons);}// function addLink(where, url, name, id, title, key, after){    //* where is the id of the toolbar where the button should be added;    //   i.e. one of "p-cactions", "p-personal", or "p-navigation".    //* url is the URL which will be called when the button is clicked.    //   javascript: urls can be used to do more complex things.    //* name is what will appear as the name of the button.    //* id is the id of the button; it's best to define one.      //   Use a prefix to make sure its unique. Optional.    //* title is the tooltip title that gives a longer description     //   of the button; if you define a accesskey, mention it here. Optional.    //* key is the char you want for the accesskey. Optional.    //* after is the id of the button you want to follow this one. Optional.    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);    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];    if(after) {        tabs.insertBefore(li,document.getElementById(after));    } else {        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;}    // //this helps automate AfD closing by adding a 'close' tab to AfD debates//written by [[User:Johnleemk]] based on [[Wikipedia:WikiProject User scripts/Scripts/test-n.js]] by [[User:Celestianpower]]function autoafd_result(){  var close = prompt("Result of debate?")  var f = document.editform, t = f.wpTextbox1;  t.value = "{{subst:" + "at" + "}} '''" + close + "'''. " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "ab" + "}}";  f.wpSummary.value = "Closing debate; result was " + close;}function autoafd_relist(){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "relist" + "|~" + "~" + "~" + "~}}";  f.wpSummary.value = "Relisting debate";}function autoafd_keep(){  var date = prompt("Nomination was made when?")  var votepage = prompt("Vote page is? (Enter 'd' for default.)")  var f = document.editform, t = f.wpTextbox1;    // If default votepage...    if (votepage=="d")      {        var temp = document.editform.action.split("/w/index.php?title=");        var temp = temp[1].split("&action=submit");        var temp = temp[0].substring(5);        var votepage = temp;      }  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;  f.wpSummary.value = "Article survived AfD";}function autoafd_no_consensus(){  var date = prompt("Nomination was made when?")  var votepage = prompt("Vote page is? (Enter 'd' for default.)")  var f = document.editform, t = f.wpTextbox1;    // If default votepage...    if (votepage=="d")      {        var temp = document.editform.action.split("/w/index.php?title=");        var temp = temp[1].split("&action=submit");        var temp = temp[0].substring(5);        var votepage = temp;      }  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''no consensus'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;  f.wpSummary.value = "Article survived AfD with no consensus";}function autoafd_redirect(){  var date = prompt("Nomination was made when?")  var redirect = prompt("Redirect to?")  var votepage = prompt("Vote page is? (Enter 'd' for default.)")  var f = document.editform, t = f.wpTextbox1;    // If default votepage...    if (votepage=="d")      {        var temp = document.editform.action.split("/w/index.php?title=");        var temp = temp[1].split("&action=submit");        var temp = temp[0].substring(5);        var votepage = temp;      }  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;  f.wpSummary.value = "Article redirected to [[" + redirect + "]] as per AfD";}function autoafd_merge(){  var date = prompt("Nomination was made when?")  var redirect = prompt("Merge and redirect to?")  var votepage = prompt("Vote page is? (Enter 'd' for default.)")  var f = document.editform, t = f.wpTextbox1;    // If default votepage...    if (votepage=="d")      {        var temp = document.editform.action.split("/w/index.php?title=");        var temp = temp[1].split("&action=submit");        var temp = temp[0].substring(5);        var votepage = temp;      }  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''merge and redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;  f.wpSummary.value = "Article merged and redirected to [[" + redirect + "]] as per AfD";}function autoafd_other(){  var date = prompt("Nomination was made when?")  var result = prompt("Result was?")  var votepage = prompt("Vote page is? (Enter 'd' for default.)")  var f = document.editform, t = f.wpTextbox1;    // If default votepage...    if (votepage=="d")      {        var temp = document.editform.action.split("/w/index.php?title=");        var temp = temp[1].split("&action=submit");        var temp = temp[0].substring(5);        var votepage = temp;      }  t.value = "{{subst:" + "oldafdfull" + "|date=" + date + "|result='''" + result + "'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;  f.wpSummary.value = "AfDed; result was " + result;}function autoafd_add_afd_tabs(){  // Only add for pages with the right string somewhere in the title  if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1)    {      addLink('p-cactions', 'javascript:autoafd_result()', "close");      addLink('p-cactions', 'javascript:autoafd_relist()', "relist");    }  if (document.title.indexOf("Editing Talk:") != -1)    {      addLink('p-cactions', 'javascript:autoafd_keep()', "keep");      addLink('p-cactions', 'javascript:autoafd_no_consensus()', "no consensus");      addLink('p-cactions', 'javascript:autoafd_redirect()', "redirect");      addLink('p-cactions', 'javascript:autoafd_merge()', "merge");      addLink('p-cactions', 'javascript:autoafd_other()', "other");    }}addOnloadHook(autoafd_add_afd_tabs);//end AfD closing script// <pre><nowiki>// -----------------------------------------------------------------------------// Modify the page once it is loaded// -----------------------------------------------------------------------------addOnloadHook(PerformRevert);addOnloadHook(AddRevertButtons);// </nowiki></pre>// Filter changes live// [[User:Lupin/recent2.js]] - please include this linedocument.write('<script type="text/javascript" src="'              + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'              + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');// Big thanks to User:JesseW for leading me to:// [[Wikipedia:WikiProject_User_scripts/Techniques#Onload_Structure]]// and to User:Sasquatch for the if(document.get ... code// References:// http://en.wikipedia.org/wiki/MediaWiki:Monobook.js// User:JesseW/monobook.js --- User:Drini/monobook.js//// RoyBoy - Working version done: Nov 2 2005 @ 7:44 PM EST// Shortens edit, protect, talk and delete tabs//// Nov 10 2005: Added contrib and block tab, with default other time//// Optimized for 800x600 res. used with CDVF, see at:// http://www.flickr.com/photos/34345738@N00/62015752/// <nowiki>//////////////////////////////////////////// Tabs by Korath// returns <li><a href="url">name</a></li>/////////////////////////////////////////function addlilink(url, name){  var na = document.createElement('a');  na.setAttribute('href', url);  var txt = document.createTextNode(name);  na.appendChild(txt);  var li = document.createElement('li');  li.appendChild(na);  return li;}//Hybirdization of ABCD afd closerfunction closeafd(bold, notbold){    var form = document.editform;    var txt = form.wpTextbox1;    txt.value = "{{subst:at}} '''" + bold + "'''" + notbold + ". ~~~~\n" + txt.value + "\n{{subst:ab}}\n";    form.wpSummary.value = "close discussion: " + bold + notbold;    form.wpWatchthis.checked = false;}function afdresult(){    var res = prompt("Result?");    if(!res) return;    var form = document.editform;    form.wpSummary.value = 'AFD result';    var txt = form.wpTextbox1;    txt.value += '{{subst:oldafdfull|date=[[DAY MONTH]] [[2006]]|result=' + res + '|votepage={{subst:PAGENAME}}}}';    txt.focus();}function afddelete(){    document.forms.deleteconfirm.wpReason.value = '[[Wikipedia:Articles for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')).replace(/^(Talk|Wikipedia( talk)?):/, '') + ']]';}function fairusedelete(){    document.forms.deleteconfirm.wpReason.value = 'Orphanned fair use image (' + '[[' + 'WP:CSD' + ']]' + ' I5)';}function replace(){    var s = prompt("Search regexp?");    if(s){        var r = prompt("Replace regexp?");        if(!r && r != '') return;        var txt = document.editform.wpTextbox1;        txt.value = txt.value.replace(new RegExp(s, "g"), r);    }}function afdresult(){    var res = prompt("Result?");	var day = prompt("On which day was it nominated?");    if(!res) return;    var form = document.editform;    form.wpSummary.value = 'AFD result';    var txt = form.wpTextbox1;    txt.value += '{{subst:oldafdfull|date=[[' + day + ']] [[2006]]|result=' + res + '|votepage={{subst:PAGENAME}}}}';    txt.focus();}// appends msg to the currently-editted page, sets the summary to summ,// and marks or unmarks the Watch this page checkbox according to watch.function edit_summary_watch(msg, summ, watch){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += msg;  f.wpSummary.value = summ;}function test(number){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "test" + number + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding your recent edits";}function vw(number){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "Uw-vandalism" + number + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding your recent edits";}function verror(number){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "verror" + number + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding your recent edits";}function comment(number){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "comment" + number + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding your recent edits";}function test1a(){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "test1a" + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding your recent edits";}function obscene(){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "obscene" + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding your recent edits";}function specialtest4(){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "User:Yamamoto_Ichiro/t4" + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding your recent edits";}function blanknote(number){  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "Blank" + number + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding your recent edits";}function testn(number){  var page = prompt("Vandalism to which article?")  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "test" + number + "-n|" + page + "}} -" + " " + "~" + "~" + "~" + "~";  if (t.value > 2)    f.wpSummary.value = "Regarding your change to [[" + page + "]]" + number;  else       f.wpSummary.value = "Regarding your change to [[" + page + "]]";}function vwn(number){  var page = prompt("Vandalism to which article?")  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "Uw-vandalism" + number + "|" + page + "}} -" + " " + "~" + "~" + "~" + "~";  if (t.value > 2)    f.wpSummary.value = "Regarding your change to [[" + page + "]]" + number;  else       f.wpSummary.value = "Regarding your change to [[" + page + "]]";}function blankwarn(number){  var page = prompt("Vandalism to which article?")  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "test2a-n|" + page + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding your change to [[" + page + "]]";}function bvn(number){  var page = prompt("Vandalism to which article?")  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  t.value += "{{subst:" + "bv-n|" + page + "}} -" + " " + "~" + "~" + "~" + "~";  f.wpSummary.value = "Regarding [[" + page + "]]";}// adds various tabs to call the abovefunction add_tabs(){  var c1 = document.getElementById('column-one');  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];  // Only add contribs tab for "User talk:" but not while Editing  if (document.title.indexOf("User") != -1 && document.title.indexOf("Editing User talk:"))    {      // use the "edit this page" tab to get already-tidied url      var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;      // cut everything up to "title=" from the start and everything past "&action=edit" from the end      editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));      editlk = editlk.substring(editlk.indexOf(':') + 1);      var slloc = editlk.indexOf('/');      if (slloc > 0)        editlk = editlk.substring(0, slloc);      tabs.appendChild(addlilink('/wiki/Special:Contributions/' + editlk, 'c'));  }  // Only add for pages with "Editing User talk:" somewhere in the title  if (document.title.indexOf("Editing User talk:") != -1)    {      //change move > m, hist > h, pro > p, del > d for more room      if(document.getElementById('ca-move'))        document.getElementById('ca-move').firstChild.innerHTML = 'm';      if(document.getElementById('ca-history'))        document.getElementById('ca-history').firstChild.innerHTML = 'h';      if(document.getElementById('ca-protect'))        document.getElementById('ca-protect').firstChild.innerHTML = 'p';      if(document.getElementById('ca-delete'))        document.getElementById('ca-delete').firstChild.innerHTML = 'd';      //change "user page" tab to "anon" to put them in their place, HA!      if(document.getElementById('ca-nstab-user'))             document.getElementById('ca-nstab-user').firstChild.innerHTML = 'anon';      //tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:anon}} -" + " " + "~" + "~" + "~" + "~", "{{" + "anon}}", false, 0)',"Anon"));      //tabs.appendChild(addlilink('javascript:edit_summary_watch("{{" + "subst:welcome5}} -" + " " + "~" + "~" + "~" + "~", "Welcome!", false, 0)',"Welcome!"));           tabs.appendChild(addlilink('javascript:test(1)',"1"));      tabs.appendChild(addlilink('javascript:vwn(1)',"v1"));      tabs.appendChild(addlilink('javascript:vw(2)',"2"));      tabs.appendChild(addlilink('javascript:vwn(2)',"v2"));      tabs.appendChild(addlilink('javascript:vw(3)',"3"));      tabs.appendChild(addlilink('javascript:specialtest4(4)',"4"));      tabs.appendChild(addlilink('javascript:blanknote(1)',"pb"));      tabs.appendChild(addlilink('javascript:test1a(2)',"b1"));      tabs.appendChild(addlilink('javascript:blanknote(2)',"b2"));      tabs.appendChild(addlilink('javascript:bvn(1)',"v"));      tabs.appendChild(addlilink('javascript:verror(2)',"v2"));      tabs.appendChild(addlilink('javascript:comment(2)',"c2"));      tabs.appendChild(addlilink('javascript:comment(3)',"c3"));      tabs.appendChild(addlilink('javascript:obscene(1)',"o"));obscene      tabs.appendChild(addlilink('javascript:edit_summary_watch(":{{" + "subst:test5}} -" + " " + "~" + "~" + "~" + "~", "Blocked user!", true, 1)',"5"));    }	if (document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1)    {        tabs.appendChild(addlilink('javascript:closeafd("keep", "")', 'Keep', ''));        tabs.appendChild(addlilink('javascript:closeafd("delete", "")', 'Delete', ''));        tabs.appendChild(addlilink('javascript:closeafd(prompt("Result?"), "")', 'Other', ''));    }}function addEditSection0() {  ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];  if (!document.getElementById) return;  x = document.getElementById('ca-edit');  if(!x) return;  y = document.createElement('LI');  y.id = 'ca-edit-0';  if (x.className == 'selected') {    if (/&action=edit&section=0$/.test(window.location.href)) {      x.className = 'istalk';      y.className = 'selected';    } else {      x.className = 'selected istalk';    }  } else if (x.className == 'selected istalk') {    if (/&action=edit&section=0$/.test(window.location.href)) {      x.className = 'istalk';      y.className = 'selected istalk';    } else {      y.className = 'istalk';    }  } else {    y.className = x.className;    x.className = 'istalk';  }  z = document.createElement('A');  if (x.children) {    z.href = x.children[0].href + '&section=0';    z.appendChild(document.createTextNode('0'));    y.appendChild(z);    document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);  } else {    z.href = x.childNodes[0].href + '&section=0';    z.appendChild(document.createTextNode('0'));    y.appendChild(z);    document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);  }}function shortTabs() {  if(document.getElementById('ca-edit'))    document.getElementById('ca-edit').firstChild.innerHTML = 'edit';  if(document.getElementById('ca-history'))    document.getElementById('ca-history').firstChild.innerHTML = 'hist';  if(document.getElementById('ca-protect'))    document.getElementById('ca-protect').firstChild.innerHTML = 'pro';  if(document.getElementById('ca-unprotect'))    document.getElementById('ca-unprotect').firstChild.innerHTML = 'unp';  if(document.getElementById('ca-talk'))    document.getElementById('ca-talk').firstChild.innerHTML = 'talk';  if(document.getElementById('ca-delete'))    document.getElementById('ca-delete').firstChild.innerHTML = 'del';  if(document.getElementById('ca-unwatch'))    document.getElementById('ca-unwatch').firstChild.innerHTML = 'unw';  if(document.getElementById('ca-watch'))    document.getElementById('ca-watch').firstChild.innerHTML = 'w';}// Adds a "blocklog" tab and fills in the username field on Special:Blockip, if a "&faketarget=username" is present.function do_blockip_stuff(){  // focus on Reason field  document.getElementsByName('wpBlockReason')[0].focus();  // Look for a &faketarget= for the username/ip  var l = location.search.substring(1).split('&');  var target = '';  for (var i = 0; i < l.length; ++i)    {      var n = l[i].indexOf('=');      if (l[i].substring(0, n) == 'faketarget')	{	  target = l[i].substring(n + 1);	  break;	}    }  if (target == '')    return;  // put account name in "IP Address/username" field  var addr = document.getElementsByName('wpBlockAddress')[0];  addr.value = unescape(target);  // insert a default ban time  var defaultTime = document.getElementsByName('wpBlockOther')[0];  defaultTime.value = "24 hours";  // add "blocklog" tab  var c1 = document.getElementById('column-one');  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];  tabs.appendChild(addlilink('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + target, 'blocklog'));}// Adds "block" and "blocklog" tabs to User: and User talk: pages.function add_block_tab(){  var c1 = document.getElementById('column-one');  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];  // use the "edit this page" tab to get already-tidied url  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;  // cut everything up to "title=" from the start and everything past "&action=edit" from the end  editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));  editlk = editlk.substring(editlk.indexOf(':') + 1);  var slloc = editlk.indexOf('/');  if (slloc > 0)    editlk = editlk.substring(0, slloc);  // add "block" tab  tabs.appendChild(addlilink('/w/index.php?title=Special%3ABlockip&faketarget=' + editlk, 'b'));  // To open the block page and block log simultaneously, replace the above line with:  // tabs.appendChild(addlilink('javascript:blockpage_and_log("' + editlk + '")', 'b'));  // and uncomment the blockpage_and_log() function above.  // add "blocklog" tab  //tabs.appendChild(addlilink('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + editlk, 'bl'));}//  Add a "Kate" link to your monobook "personal menu" list at the very//  top of the page.////  Indicate where you would like "Kate" to appear://    pt-userpage, pt-mytalk, pt-preferences,//    pt-watchlist, pt-mycontris, pt-logout//gsKateInsertBefore = 'pt-mycontris'; // leave blank to append after "logout" function KateLink()  {    // use the "edit this page" tab to get user name    var user = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;    // cut everything up to "title=" from the start and everything past "&action=edit" from the end    user = user.substring(user.indexOf('title=') + 6, user.lastIndexOf('&action=edit'));    user = user.substring(user.indexOf(':') + 1);      var li = document.createElement( 'li' );    li.id = 'pt-kate';      var a = document.createElement( 'a' );    a.appendChild( document.createTextNode( 'count' ) ); // eh, the css makes the text lowercase    a.href = 'http://tools.wikimedia.de/~kate/cgi-bin/count_edits?dbname=enwiki&user=' + user;      li.appendChild( a );      if ( ! gsKateInsertBefore ) // append to end (right) of list    {       document.getElementById( 'pt-logout' ).parentNode.appendChild( li );    }    else    {        var before = document.getElementById( gsKateInsertBefore );        before.appendChild( li, before );    }  }// ***** Window Load ******window.onload = Main;function Main(){  shortTabs();  add_tabs();  //add section 0 if not Editing a User talk page  if (document.title.indexOf("Editing User talk:") != 0)    addEditSection0();  //block tab on all user pages  if (document.title.indexOf("User") != -1)     add_block_tab();   //block ip stuff if on Block user page  if (document.title.indexOf("Block user") != -1)    do_blockip_stuff();  if (document.title.indexOf("User") != -1)    KateLink(); //count menu option on user pages}// [[User:Lupin/popups.js]] - please include this line importScript('User:Lupin/popups.js');popupStructure='nostalgia';simplePopups=true;//<pre><nowiki> function aivlist(type) {  var f = document.editform, t = f.wpTextbox1;  if (t.value.length > 0)    t.value += '\n';  var ip = prompt("Enter IP address", "");  var reason = prompt("Enter reason for listing", "");  t.value += "*{{" + type + "|" + ip +"}} " + reason + "--~" + "~" + "~" + "~";  f.wpSummary.value = "Listing " + ip;  f.submit(); }addOnloadHook( function addaivlink() {   if (document.title.indexOf("Editing Wikipedia:Administrator intervention against vandalism") != -1)  {    addPortletLink("p-cactions", "javascript:aivlist('vandal')", "vandal", "ca-vandal", "Report a vandal", "");    addPortletLink("p-cactions", "javascript:aivlist('ipvandal')", "ipvandal", "ca-ipvandal", "Report an ipvandal", "");  } });//</nowiki></pre>//Please leave the following line//[[user:Where/easy db]], maintained by [[User:MER-C]]//Start db scriptaddOnloadHook(function(){  //check if called from deletion request  if (document.title.indexOf("Editing ") != -1)  {    if (document.URL.lastIndexOf("&fakeaction=huff") == -1)      return;    // does the page exist?    if (wgCurRevisionId == false)    {      alert("The page has already been deleted.");      return;    }    if (document.URL.lastIndexOf("&reason=off") != -1)    {      var type = prompt("Enter criteria for speedy deletion, Key: G1: Nonsense ? G2: Test pages ? G3: Vandalism ? G4: Previously deleted ? G5: Banned user ? G6: Housekeeping ? G7: Author's request ? G8: Talk pages without a main page ? G9: Office actions ? G10: Attack pages/libel ? G11:Spam ? G12: Copyright infringement");      if (type == null)        return;      var f = document.editform, t = f.wpTextbox1;      t.value = "{{db-" + type.toLowerCase() + "}}\n" + t.value;      f.wpSummary.value = "Requesting speedy deletion ([[WP:CSD#" + type + "|CSD " + type.toUpperCase() + "]])";      f.wpSave.click();      return;    }    else if (document.URL.lastIndexOf("&reason=on") != -1)    {      var type = prompt("Enter reason for speedy deletion");      if (type == null)        return;      var f = document.editform, t = f.wpTextbox1;      t.value = "{{db|" + type + "}}\n" + t.value;      f.wpSummary.value = "Requesting speedy deletion";      f.wpSave.click();      return;    }  }  if (wgCanonicalNamespace == "Special")    return;  addPortletLink("p-cactions", "javascript:easyDb(0)", "db (csd)", "ca-db0", "Request speedy deletion according to WP:CSD", "");  addPortletLink("p-cactions", "javascript:easyDb(1)", "db (reason)", "ca-db1", "Request speedy deletion with reason", "");}); function easyDb(n){  var title = wgPageName.replace("&", "%26").replace("+", "%21");  if (n == 0)    location.assign("/w/index.php?&action=edit&fakeaction=huff&reason=off&title=" + title);     if (n == 1)    location.assign("/w/index.php?&action=edit&fakeaction=huff&reason=on&title=" + title);}//End db script//// (C) Andrea Giammarchi - JSL 1.4bvar undefined;function $JSL(){	this.inArray=function(){		var tmp=false,i=arguments[1].length;		while(i&&!tmp)tmp=arguments[1][--i]===arguments[0];		return tmp;	};	this.has=function(str){return $JSL.inArray(str,$has)};	this.random=function(elm){		var tmp=$JSL.$random();		while(typeof(elm[tmp])!=="undefined")tmp=$JSL.$random();		return tmp;	};	this.$random=function(){return (Math.random()*1234567890).toString()};	this.reverse=function(str){return str.split("").reverse().join("")};	this.replace=function(str){		var tmp=str.split(""),i=tmp.length;		while(i>0)tmp[--i]=$JSL.$replace(tmp[i]);		return tmp.join("");	};	this.$replace=function(tmp){		var i=tmp.length===1?tmp.charCodeAt(0):0;		switch(i) {			case 8	:tmp="\\b";break;			case 10	:tmp="\\n";break;			case 11	:tmp="\\v";break;			case 12	:tmp="\\f";break;			case 13	:tmp="\\r";break;			case 34	:tmp="\\\"";break;			case 92	:tmp="\\\\";break;			default:				tmp=tmp.replace(/([\x00-\x07]|[\x0E-\x1F]|[\x7F-\xFF])/g,function(a,b){return "\\x"+$JSL.charCodeAt(b)}).					replace(/([\u0100-\uFFFF])/g,function(a,b){b=$JSL.charCodeAt(b);return b.length<4?"\\u0"+b:"\\u"+b});				break;		};		return tmp;	};	this.charCodeAt=function(str){return $JSL.$charCodeAt(str.charCodeAt(0))};	this.$charCodeAt=function(i){		var str=i.toString(16).toUpperCase();		return str.length<2?"0"+str:str;	};	this.$toSource=function(elm){return elm.toSource().replace(/^(\(new \w+\()([^\000]+)(\)\))$/,"$2")};	this.$toInternalSource=function(elm){		var tmp=null;		switch(elm.constructor) {			case Boolean:			case Number:				tmp=elm;				break;			case String:				tmp=$JSL.$toSource(elm);				break;			default:				tmp=elm.toSource();				break;		};		return tmp;	};	this.getElementsByTagName=function(scope,i,elm,str){		var tmp=$JSL.$getElementsByTagName(scope),j=tmp.length,$tmp=[];		while(i<j){if(tmp[i][str]===elm||elm==="*")$tmp.push($JSL.$getElementsByName(tmp[i]));++i};		if(!$tmp.item){if(!$JSL.has("item"))$has.push("item");$tmp.item=function(tmp){return this[tmp]}};		return $tmp;	};	this.$getElementsByTagName=function(scope){return scope.layers||scope.all};	this.$getElementsByName=function(elm) {		if(!elm.getElementsByTagName)	elm.getElementsByTagName=document.getElementsByTagName;		return elm;	};	this.encodeURI=function(str){return str.replace(/"/g,"%22").replace(/\\/g,"%5C")};	this.$encodeURI=function(str){return $JSL.$charCodeAt(str)};	this.$encodeURIComponent=function(a,b){		var i=b.charCodeAt(0),str=[];		if(i<128)		str.push(i);		else if(i<2048)		str.push(0xC0+(i>>6),0x80+(i&0x3F));		else if(i<65536)	str.push(0xE0+(i>>12),0x80+(i>>6&0x3F),0x80+(i&0x3F));		else			str.push(0xF0+(i>>18),0x80+(i>>12&0x3F),0x80+(i>>6&0x3F),0x80+(i&0x3F));		return "%"+str.map($JSL.$encodeURI).join("%");	};	this.$decodeURIComponent=function(a,b,c,d,e){		var i=0;		if(e)	  i=parseInt(e.substr(1,2),16);		else if(d)i=((parseInt(d.substr(1,2),16)-0xC0)<<6)+(parseInt(d.substr(4,2),16)-0x80);		else if(c)i=((parseInt(c.substr(1,2),16)-0xE0)<<12)+((parseInt(c.substr(4,2),16)-0x80)<<6)+(parseInt(c.substr(7,2),16)-0x80);		else	  i=((parseInt(b.substr(1,2),16)-0xF0)<<18)+((parseInt(b.substr(4,2),16)-0x80)<<12)+((parseInt(b.substr(7,2),16)-0x80)<<6)+(parseInt(b.substr(10,2),16)-0x80);		return String.fromCharCode(i);	};	var $has=[];	if(!Object.prototype.toSource){$has[$has.length]="toSource";Object.prototype.toSource=function(){		var str=[];		switch(this.constructor) {			case Boolean:				str.push("(new Boolean(",this,"))");				break;			case Number:				str.push("(new Number(",this,"))");				break;			case String:				str.push("(new String(\"",$JSL.replace(this),"\"))");				break;			case Date:				str.push("(new Date(",this.getTime(),"))");				break;			case Error().constructor:				str.push("(new Error(",$JSL.$toSource(this.message),",",$JSL.$toSource(this.fileName),",",this.lineNumber,"))");				break;			case Function:				str.push("(",$JSL.$replace(this.toString()),")");				break;			case Array:				var i=0,j=this.length;				while(i<j)	str.push($JSL.$toInternalSource(this[i++]));				str=["[",str.join(", "),"]"];				break;			default:				var i=0,tmp;				for(i in this){if(i!=="toSource")					str.push($JSL.$toSource(i)+":"+$JSL.$toInternalSource(this[i]));				};				str=["{",str.join(", "),"}"];				break;		};		return str.join("");	}};	if(!Function.prototype.apply){$has[$has.length]="apply";Function.prototype.apply=function(){		var i=arguments.length===2?arguments[1].length:0,str,tmp=[],elm=(""+this).replace(/[^\(]+/,"function");		if(!arguments[0])arguments[0]={};		while(i)tmp.unshift("arguments[1]["+(--i)+"]");		do{str="__".concat($JSL.random(arguments[0]).replace(/\./,"_"),"__")}while(new RegExp(str).test(elm));		eval("var ".concat(str,"=arguments[0];tmp=(",elm.replace(/([^$])\bthis\b([^$])/g,"$1".concat(str,"$2")),")(",tmp.join(","),")"));		return tmp;	}};	if(!Function.prototype.call){$has[$has.length]="call";Function.prototype.call=function(){		var i=arguments.length,tmp=[];		while(i>1)tmp.unshift(arguments[--i]);		return this.apply((i?arguments[0]:{}),tmp);	}};	if(!Array.prototype.pop){$has[$has.length]="pop";Array.prototype.pop=function(){		var a=this.length,r=this[--a];		if(a>=0)this.length=a;		return r;	}};	if(!Array.prototype.push){$has[$has.length]="push";Array.prototype.push=function(){		var a=0,b=arguments.length,r=this.length;		while(a<b)this[r++]=arguments[a++];		return r;	}};	if(!Array.prototype.shift){$has[$has.length]="shift";Array.prototype.shift=function(){		this.reverse();		var r=this.pop();		this.reverse();		return r;	}};	if(!Array.prototype.splice){$has[$has.length]="splice";Array.prototype.splice=function(){		var a,b,c,d=arguments.length,tmp=[],r=[];		if(d>1){			arguments[0]=parseInt(arguments[0]);			arguments[1]=parseInt(arguments[1]);			c=arguments[0]+arguments[1];			for(a=0,b=this.length;a<b;a++){				if(a<arguments[0]||a>=c){					if(a===c&&d>2){						for(a=2;a<d;a++)tmp.push(arguments[a]);						a=c;					};					tmp.push(this[a]);				}				else					r.push(this[a]);			};			for(a=0,b=tmp.length;a<b;a++)				this[a]=tmp[a];			this.length = a;		};		return r;	}};	if(!Array.prototype.unshift){$has[$has.length]="unshift";Array.prototype.unshift=function(){		var i=arguments.length;		this.reverse();		while(i>0)this.push(arguments[--i]);		this.reverse();		return this.length;	}};	if(!Array.prototype.indexOf){$has[$has.length]="indexOf";Array.prototype.indexOf=function(elm,i){		var j=this.length;		if(!i)i=0;		if(i>=0){while(i<j){if(this[i++]===elm){			i=i-1+j;j=i-j;		}}}		else			j=this.indexOf(elm,j+i);		return j!==this.length?j:-1;	}};	if(!Array.prototype.lastIndexOf){$has[$has.length]="lastIndexOf";Array.prototype.lastIndexOf=function(elm,i){		var j=-1;		if(!i)i=this.length;		if(i>=0){do{if(this[i--]===elm){			j=i+1;i=0;		}}while(i>0)}		else if(i>-this.length)			j=this.lastIndexOf(elm,this.length+i);		return j;	}};	if(!Array.prototype.every){$has[$has.length]="every";Array.prototype.every=function(callback,elm){		var b=false,i=0,j=this.length;		if(!elm){	while(i<j&&!b)	b=!callback(this[i]||this.charAt(i),i++,this)}		else {		while(i<j&&!b)	b=!callback.apply(elm,[this[i]||this.charAt(i),i++,this]);}		return !b;	}};	if(!Array.prototype.filter){$has[$has.length]="filter";Array.prototype.filter=function(callback,elm){		var r=[],i=0,j=this.length;		if(!elm){while(i<j){if(callback(this[i],i++,this))			r.push(this[i-1]);		}} else {while(i<j){if(callback.apply(elm,[this[i],i++,this]))			r.push(this[i-1]);		}}		return r;	}};	if(!Array.prototype.forEach){$has[$has.length]="forEach";Array.prototype.forEach=function(callback,elm){		var i=0,j=this.length;		if(!elm){	while(i<j)	callback(this[i],i++,this)}		else {		while(i<j)	callback.apply(elm,[this[i],i++,this]);}	}};	if(!Array.prototype.map){$has[$has.length]="map";Array.prototype.map=function(callback,elm){		var r=[],i=0,j=this.length;		if(!elm){	while(i<j)	r.push(callback(this[i],i++,this))}		else {		while(i<j)	r.push(callback.apply(elm,[this[i],i++,this]));}		return r;	}};	if(!Array.prototype.some){$has[$has.length]="some";Array.prototype.some=function(callback,elm){		var b=false,i=0,j=this.length;		if(!elm){	while(i<j&&!b)	b=callback(this[i],i++,this)}		else {		while(i<j&&!b)	b=callback.apply(elm,[this[i],i++,this]);}		return b;	}};	if(!String.prototype.lastIndexOf){if(!this.inArray("lastIndexOf",$has))$has[$has.length]="lastIndexOf";String.prototype.lastIndexOf=function(elm,i){		var str=$JSL.reverse(this),elm=$JSL.reverse(elm),r=str.indexOf(elm,i);		return r<0?r:this.length-r;	}};	if("aa".replace(/\w/g,function(){return arguments[1]+" "})!=="0 1 "){$has[$has.length]="replace";String.prototype.replace=function(replace){return function(reg,func){		var r="",tmp=$JSL.random(String);		String.prototype[tmp]=replace;		if(func.constructor!==Function)			r=this[tmp](reg,func);		else {			function getMatches(reg,pos,a) {				function io() {					var a=reg.indexOf("(",pos),b=a;					while(a>0&&reg.charAt(--a)==="\\"){};					pos=b!==-1?b+1:b;					return (b-a)%2===1?1:0;				};				do{a+=io()}while(pos!==-1);				return a;			};			function $replace(str){				var j=str.length-1;				while(j>0)str[--j]='"'+str[j].substr(1,str[j--].length-2)[tmp](/(\\|")/g,'\\$1')+'"';				return str.join("");			};			var p=-1,i=getMatches(""+reg,0,0),args=[],$match=this.match(reg),elm=$JSL.$random()[tmp](/\./,'_AG_');			while(this.indexOf(elm)!==-1)elm=$JSL.$random()[tmp](/\./,'_AG_');			while(i)args[--i]=[elm,'"$',(i+1),'"',elm].join("");			if(!args.length)r="$match[i],(p=this.indexOf($match[i++],p+1)),this";			else		r="$match[i],"+args.join(",")+",(p=this.indexOf($match[i++],p+1)),this";			r=eval('['+$replace((elm+('"'+this[tmp](reg,'"'+elm+',func('+r+'),'+elm+'"')+'"')+elm).split(elm))[tmp](/\n/g,'\\n')[tmp](/\r/g,'\\r')+'].join("")');		};		delete String.prototype[tmp];		return r;	}}(String.prototype.replace)};	if((new Date().getYear()).toString().length===4){$has[$has.length]="getYear";Date.prototype.getYear=function(){		return this.getFullYear()-1900;	}};};$JSL=new $JSL();if(typeof(encodeURI)==="undefined"){function encodeURI(str){	var elm=/([\x00-\x20]|[\x25|\x3C|\x3E|\x5B|\x5D|\x5E|\x60|\x7F]|[\x7B-\x7D]|[\x80-\uFFFF])/g;	return $JSL.encodeURI(str.toString().replace(elm,$JSL.$encodeURIComponent));}};if(typeof(encodeURIComponent)==="undefined"){function encodeURIComponent(str){	var elm=/([\x23|\x24|\x26|\x2B|\x2C|\x2F|\x3A|\x3B|\x3D|\x3F|\x40])/g;	return $JSL.encodeURI(encodeURI(str).replace(elm,function(a,b){return "%"+$JSL.charCodeAt(b)}));}};if(typeof(decodeURIComponent)==="undefined"){function decodeURIComponent(str){	var elm=/(%F[0-9A-F]%E[0-9A-F]%[A-B][0-9A-F]%[8-9A-B][0-9A-F])|(%E[0-9A-F]%[A-B][0-9A-F]%[8-9A-B][0-9A-F])|(%[C-D][0-9A-F]%[8-9A-B][0-9A-F])|(%[0-9A-F]{2})/g;	return str.toString().replace(elm,$JSL.$decodeURIComponent);}};if(typeof(decodeURI)==="undefined"){function decodeURI(str){	return decodeURIComponent(str);}};if(!document.getElementById){document.getElementById=function(elm){	return $JSL.$getElementsByName($JSL.$getElementsByTagName(this)[elm]);}};if(!document.getElementsByTagName){document.getElementsByTagName=function(elm){	return $JSL.getElementsByTagName(this,0,elm.toUpperCase(),"tagName");}};if(!document.getElementsByName){document.getElementsByName=function(elm){	return $JSL.getElementsByTagName(this,0,elm,"name");}};if(typeof(XMLHttpRequest)==="undefined"){XMLHttpRequest=function(){	var tmp=null,elm=navigator.userAgent;	if(elm.toUpperCase().indexOf("MSIE 4")<0&&window.ActiveXObject)		tmp=elm.indexOf("MSIE 5")<0?new ActiveXObject("Msxml2.XMLHTTP"):new ActiveXObject("Microsoft.XMLHTTP");	return tmp;}};if(typeof(Error)==="undefined")Error=function(){};Error = function(base){return function(message){	var tmp=new base();	tmp.message=message||"";	if(!tmp.fileName)		tmp.fileName=document.location.href;	if(!tmp.lineNumber)		tmp.lineNumber=0;	if(!tmp.stack)		tmp.stack="Error()@:0\n(\""+this.message+"\")@"+tmp.fileName+":"+this.lineNumber+"\n@"+tmp.fileName+":"+this.lineNumber;	if(!tmp.name)		tmp.name="Error";	return tmp;}}(Error);/*** return 'p-tb' if id is included in array, else return 'p-cactions';*/function chooseBox( id, arr ) {	return arr.indexOf( id ) == -1 ? 'p-cactions' : 'p-tb';}/*** Will escape a string to be used in a RegExp*/RegExp.escape = function( text, space_fix ) {	if ( !arguments.callee.sRE ) {		arguments.callee.sRE = /(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\$|\^)/g;	}	text = text.replace( arguments.callee.sRE , '\\$1' );	// Special Mediawiki escape, underscore/space is the same, often at lest:	if( space_fix ) {		text = text.replace( / |_/g, '[_ ]' );	}	return text;}namespaces	=	{	'-2':	'Media',	'-1':	'Special',	'0'	:	'',	'1'	:	'Talk',	'2'	:	'User',	'3'	:	'User_talk',	'4'	:	'Project',	'5'	:	'Project talk',	'6'	:	'Image',	'7'	:	'Image 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'};// Helper functions to change case of a stringString.prototype.toUpperCaseFirstChar = function() {	return this.substr( 0, 1 ).toUpperCase() + this.substr( 1 );}String.prototype.toLowerCaseFirstChar = function() {	return this.substr( 0, 1 ).toLowerCase() + this.substr( 1 );}String.prototype.toUpperCaseEachWord = function( delim ) {	delim = delim ? delim : ' ';	return this.split( delim ).map( function(v) { return v.toUpperCaseFirstChar() } ).join( delim );}String.prototype.toLowerCaseEachWord = function( delim ) {	delim = delim ? delim : ' ';	return this.split( delim ).map( function(v) { return v.toLowerCaseFirstChar() } ).join( delim );}/*** Helper functions to get the month as a string instead of a number*/Date.monthNames = [	'January',	'February',	'March',	'April',	'May',	'June',	'July',	'August',	'September',	'October',	'November',	'December'];Date.monthNamesAbbrev = [	'Jan',	'Feb',	'Mar',	'Apr',	'May',	'Jun',	'Jul',	'Aug',	'Sep',	'Oct',	'Nov',	'Dec'];Date.prototype.getMonthName = function() {	return Date.monthNames[ this.getMonth() ];}Date.prototype.getMonthNameAbbrev = function() {	return Date.monthNamesAbbrev[ this.getMonth() ];}Date.prototype.getUTCMonthName = function() {	return Date.monthNames[ this.getUTCMonth() ];}Date.prototype.getUTCMonthNameAbbrev = function() {	return Date.monthNamesAbbrev[ this.getUTCMonth() ];}// Simple helper functions to see what groups a user might belongfunction userIsInGroup( group ) {	return ( wgUserGroups != null && wgUserGroups.indexOf( group ) != -1 ) || ( wgUserGroups == null && group == 'anon' );}function userIsAnon() {	return wgUserGroups == null;}// AOL Proxy IP Addresses (2007-02-03)var AOLNetworks = [	'64.12.96.0/19',	'149.174.160.0/20',	'152.163.240.0/21',	'152.163.248.0/22',	'152.163.252.0/23',	'152.163.96.0/22',	'152.163.100.0/23',	'195.93.32.0/22',	'195.93.48.0/22',	'195.93.64.0/19',	'195.93.96.0/19',	'195.93.16.0/20',	'198.81.0.0/22',	'198.81.16.0/20',	'198.81.8.0/23',	'202.67.64.128/25',	'205.188.192.0/20',	'205.188.208.0/23',	'205.188.112.0/20',	'205.188.146.144/30',	'207.200.112.0/21',];// AOL Client IP Addresses (2007-02-03)var AOLClients = [	'172.128.0.0/10',	'172.192.0.0/12',	'172.208.0.0/14',	'202.67.66.0/23',	'172.200.0.0/15',	'172.202.0.0/15',	'172.212.0.0/14',	'172.216.0.0/16',	'202.67.68.0/22',	'202.67.72.0/21',	'202.67.80.0/20',	'202.67.96.0/19',];/*** ipadress is in the format 1.2.3.4 and network is in the format 1.2.3.4/5*/function isInNetwork( ipaddress, network ) {	var iparr = ipaddress.split('.');	var ip = (parseInt(iparr[0]) << 24) + (parseInt(iparr[1]) << 16) + (parseInt(iparr[2]) << 8) + (parseInt(iparr[3]));	var netmask = 0xffffffff << network.split('/')[1];	var netarr = network.split('/')[0].split('.');	var net = (parseInt(netarr[0]) << 24) + (parseInt(netarr[1]) << 16) + (parseInt(netarr[2]) << 8) + (parseInt(netarr[3]));	return (ip & netmask) == net;}/* Returns true if given string contains a valid IP-address, that is, from 0.0.0.0 to 255.255.255.255*/function isIPAddress( string ){	var res = /(\d{1,4})\.(\d{1,3})\.(\d{1,3})\.(\d{1,4})/.exec( string );	return res != null && res.slice( 1, 5 ).every( function( e ) { return e < 256; } );}/*** Maps the querystring to an object** Functions:** QueryString.exists(key)*     returns true if the particular key is set* QueryString.get(key)*     returns the value associated to the key* QueryString.equals(key, value)*     returns true if the value associated with given key equals given value* QueryString.toString()*     returns the query string as a string* QueryString.create( hash )*     creates an querystring and encodes strings via encodeURIComponent and joins arrays with | ** In static context, the value of location.search.substring(1), else the value given to the constructor is going to be used. The mapped hash is saved in the object.** Example:** var value = QueryString.get('key');* var obj = new QueryString('foo=bar&baz=quux');* value = obj.get('foo');*/function QueryString(qString) {	this.string = qString;	this.params = {};	if( qString.length == 0 ) {		return;	}	qString.replace(/\+/, ' ');	var args = qString.split('&');	for( var i in args ) {		if( typeof( args[i] ) != 'string' ) {			continue;		}		var pair = args[i].split( '=' );		var key = decodeURIComponent( pair[0] ), value = key;		if( pair.length == 2 ) {			value = decodeURIComponent( pair[1] );		}		this.params[key] = value;	}}QueryString.static = null;QueryString.staticInit = function() {	if( QueryString.static == null ) {		QueryString.static = new QueryString(location.search.substring(1));	}}QueryString.get = function(key) {	QueryString.staticInit();	return QueryString.static.get(key);};QueryString.prototype.get = function(key) {	return this.params[key] ? this.params[key] : null;};QueryString.exists = function(key) {	QueryString.staticInit();	return QueryString.static.exists(key);}QueryString.prototype.exists = function(key) {	return this.params[key] ? true : false;}QueryString.equals = function(key, value) {	QueryString.staticInit();	return QueryString.static.equals(key, value);}QueryString.prototype.equals = function(key, value) {	return this.params[key] == value ? true : false;}QueryString.toString = function() {	QueryString.staticInit();	return QueryString.static.toString();}QueryString.prototype.toString = function() {	return this.string ? this.string : null;}QueryString.create = function( arr ) {	var resarr = Array();	for( var i in arr ) {		if( typeof arr[i] == 'object' ){			var v =  Array();			for(var j in arr[i] ) {				v[j] = encodeURIComponent( arr[i][j] );			}			resarr.push( encodeURIComponent( i ) + '=' +  v.join('|')  );		} else {			resarr.push( encodeURIComponent( i ) + '=' + encodeURIComponent( arr[i] ) );		}	}	return resarr.join('&');}QueryString.prototype.create = QueryString.create;/*** Simple exception handling*/Exception = function( str ) {	this.str = str || '';}Exception.prototype.what = function() {	return this.str;}/*** Status updating class*/Status = function() {}/*Initiate an element to be a status window, it will remove all it's childs*/Status.init = function( elem ) {	if( !( elem instanceof Element ) ) {		throw new Exception( 'object not an instance of Element' );	}	Status.elem = elem;	Status.currentNode = null;	while( elem.hasChildNodes() ) {		elem.removeChild( elem.firstChild );	}}// Private functionStatus.append = function( obj, node ) {	if( Status.elem == null ) {		throw new Exception( 'no initialized object found' );	}	if ( ! ( obj instanceof Array ) ) {		obj = [ obj ];	}	node = node || Status.currentNode;	for( var i in obj ) {		if( typeof obj[i] == 'string' ) {			node.appendChild( document.createTextNode( obj[i] ) );		} else if( obj[i] instanceof Element ) {			node.appendChild( obj[i] );		}	}}Status.error = function( obj ) {	Status.currentNode = document.createElement( 'div' );	Status.currentNode.style.color = 'OrangeRed';	Status.currentNode.style.fontWeight = '900';	Status.append( obj );	Status.elem.appendChild( Status.currentNode );	return Status.currentNode;}Status.warn = function( obj ) {	Status.currentNode = document.createElement( 'div' );	Status.currentNode.style.color = 'OrangeRed';	Status.append( obj );	Status.elem.appendChild( Status.currentNode );	return Status.currentNode;}Status.info = function( obj ) {	Status.currentNode = document.createElement( 'div' );	Status.currentNode.style.color = 'ForestGreen';	Status.append( obj );	Status.elem.appendChild( Status.currentNode );	return Status.currentNode;}Status.debug = function( obj , level ) {	level = level || 1;	if( Status.debugLevel >= level ) {		Status.currentNode = document.createElement( 'div' );		Status.currentNode.style.color = 'DimGray';		Status.append( "Debug (" + level + "): " );		Status.append( obj );		Status.elem.appendChild( Status.currentNode );		return Status.currentNode;	} else {		return null;	}}Status.debugLevel = 0;Status.status = function( obj ) {	Status.currentNode = document.createElement( 'div' );	Status.currentNode.style.color = 'SteelBlue';	Status.append( obj );	Status.elem.appendChild( Status.currentNode );	return Status.currentNode;}Status.progress = function ( obj, node ) {	Status.append( obj, node );	}// Simple helper function to create a simple nodefunction htmlNode( type, content, color ) {	var node = document.createElement( type );	if( color ) {		node.style.color = color;	}	node.appendChild( document.createTextNode( content ) );	return node;}// A simple dragable windowfunction SimpleWindow( width, height ) {	this.width = width;	this.height = height;	this.frame = document.createElement( 'div' );	SimpleWindow.frames.push( this.frame );	this.topbar = document.createElement( 'div' );	this.topbarover = document.createElement( 'div' );	this.closeButton = document.createElement( 'span' );	this.frame.appendChild( this.topbar );	this.topbarover.appendChild( this.closeButton );	this.frame.style.zIndex = 100;	this.frame.style.width = width + 'px';	this.frame.style.height = height + 'px';	this.frame.style.position = 'fixed';	this.frame.style.background = 'AliceBlue';	this.frame.style.border = '2px ridge Black';	this.frame.simpleWindow = this;	this.frame.addEventListener( 'mousedown', this.focus, true );	this.closeButton.appendChild( document.createTextNode( '[close]' ) );	this.closeButton.style.position = 'absolute';	this.closeButton.style.fontWeight = '100';	this.closeButton.style.fontSize = '0.7em';	this.closeButton.style.top = '0px';	this.closeButton.style.left = '0px';	this.closeButton.style.cursor = 'pointer';	this.closeButton.simpleWindow = this;	this.closeButton.addEventListener( 'click', this.close, false );	this.topbar.style.width = '100%';	this.topbar.style.height = '20px';	this.topbar.style.background = 'LightSteelBlue';	this.topbar.style.position = 'absolute';	this.topbar.style.fontWeight = '900';	this.topbar.style.fontSize = '1em';	this.topbar.style.fontFamily = 'sans-serif';	this.topbar.style.textAlign = 'center';	this.topbar.style.verticalAlign = 'baseline';	this.topbar.style.top = '0px';	this.topbar.style.left = '0px';	this.topbarover.style.width = '100%';	this.topbarover.style.height = '24px';	this.topbarover.style.position = 'absolute';	this.topbarover.style.top = '0px';	this.topbarover.style.left = '0px';	this.topbarover.simpleWindow = this;	this.topbarover.addEventListener( 'mousedown', this.beginMove, true );}SimpleWindow.prototype.focus = function(e) {	for( var i in SimpleWindow.frames ) {		SimpleWindow.frames[i].style.zIndex = 99;	}	this.simpleWindow.frame.style.zIndex = 100;}SimpleWindow.prototype.display = function() {	this.title = this.title || "Title";	this.content = this.content || document.createTextNode( "" );	this.topbar.appendChild( document.createTextNode( this.title ) );	var content = document.createElement( 'div' );	content.style.position = 'relative';	content.style.top = '20px';	content.style.height = ( this.height -  20 ) + 'px';	content.style.overflow = 'auto';	content.appendChild( this.content );	this.frame.appendChild( content );	this.frame.appendChild( this.topbarover );	this.frame.style.width = this.width + 'px';	this.frame.style.height = this.height + 'px';	this.frame.style.top = (window.innerHeight - this.height  )/2 + 'px' ;	this.frame.style.left = (window.innerWidth - this.width  )/2 + 'px';	document.getElementsByTagName('body')[0].appendChild( this.frame );}SimpleWindow.prototype.close = function(e) {	if( e ) {		this.simpleWindow.frame.parentNode.removeChild(this.simpleWindow.frame);	} else {		this.frame.parentNode.removeChild(this.frame);	}}SimpleWindow.prototype.setWidth = function( width ) {	this.width = width;}SimpleWindow.prototype.setHeight = function( height ) {	this.height = height;}SimpleWindow.prototype.setTitle = function( title ) {	this.title = title;}SimpleWindow.prototype.setContent = function( content ) {	this.content = content;}SimpleWindow.frames = [];SimpleWindow.prototype.currentObject = null;SimpleWindow.prototype.beginMove = function(e) {	if( e.button != 0 ) {		return;	}	this.simpleWindow.initX = e.layerX;	this.simpleWindow.initY = e.layerY;	this.simpleWindow.lastX = e.clientX;	this.simpleWindow.lastY = e.clientY;	SimpleWindow.currentObject = this.simpleWindow;	window.addEventListener( 'mousemove', SimpleWindow.moveWindow, false );	window.addEventListener( 'mouseup', function(e) { 		SimpleWindow.currentObject = null;		window.removeEventListener( 'mousemove', SimpleWindow.moveWindow, false );		window.removeEventListener( 'mouseup', SimpleWindow.moveWindow, false );	}, false );}SimpleWindow.moveWindow = function(e) {	if( SimpleWindow.currentObject == null ) {		return;	}	var y = e.clientY - SimpleWindow.currentObject.initY;	var x = e.clientX - SimpleWindow.currentObject.initX;	SimpleWindow.currentObject.frame.style.top  = y + 'px';	SimpleWindow.currentObject.frame.style.left = x + 'px';	e.stopPropagation();}/*The CSS for this to work is on the talk page.*/function addlimenu(tabs, name, id){    (na = document.createElement("a")).appendChild(document.createTextNode(name));    na.href = "#";    var mn = document.createElement("ul");    (li = document.createElement("li")).appendChild(na);    li.appendChild(mn);    if(id) li.id = id;    li.className = 'tabmenu';    tabs.appendChild(li);    return mn;  // useful because it gives us the <ul> to add <li>s to}// If TwinkleConfig aint exist.if( typeof( TwinkleConfig ) == 'undefined' ) {	TwinkleConfig = {};}/** TwinkleConfig.summaryAd (string) If ad should be added or not to summary, default [[WP:TWINKLE|TWINKLE]] */if( typeof( TwinkleConfig.summaryAd ) == 'undefined' ) {	TwinkleConfig.summaryAd = " using [[WP:TWINKLE|TW]]";}/** TwinkleConfig.markAIVReportAsMinor (boolean) Defines if a reports to AIV should be marked as minor, if false, default is applied as per preference. */if( typeof( TwinkleConfig.markAIVReportAsMinor ) == 'undefined' ) {	TwinkleConfig.markAIVReportAsMinor = true;}/** TwinkleConfig.confirmUsernameToAIV (boolean) (deprecated) Defines if a username reports to AIV should be confirmed before sent. */if( typeof( TwinkleConfig.confirmUsernameToAIV ) == 'undefined' ) {	TwinkleConfig.confirmUsernameToAIV = true;}/** TwinkleConfig.toolboxButtons (string) If id defined in this array, the button of the action is located inthe toolbox instead of in the actions bar. */if( typeof( TwinkleConfig.toolboxButtons ) == 'undefined' ) {	TwinkleConfig.toolboxButtons = [];}function getChecked( nodelist ) {	if( !( nodelist instanceof NodeList ) ) {		throw nodelist + " not instance of NodeList";	}	var result = [];	for(var i in nodelist ) {		if( nodelist[i].checked ) {			result.push( nodelist[i].value );		}	}	return result;}function getTexts( nodelist ) {	if ( nodelist instanceof HTMLInputElement ) {		return [ nodelist.value ];	}	if( !( nodelist instanceof NodeList ) ) {		throw nodelist + " not instance of NodeList";	}	var result = [];	for(var i in nodelist ) {		if( nodelist[i].type == 'text' && nodelist[i].value != '' ) {			result.push( nodelist[i].value );		}	}	return result;}function num2order( num ) {	switch( num ) {	case 1: return '';	case 2: return '2nd';	case 3: return '3rd';	default: return num + 'th';	}}function createOption( data ) {	var option = document.createElement( 'option' );	option.setAttribute( 'value', data.value );	if( data.selected ) {		option.setAttribute( 'selected', 'selected' );	}	option.setAttribute( 'label', data.label );	option.appendChild( document.createTextNode( data.label ) );	return option;}function createInput( data ) {	var div = document.createElement( data.elem || 'span' );	var input = document.createElement( 'input' );	input.setAttribute( 'value', data.value );	input.setAttribute( 'name', data.name );	input.setAttribute( 'id', data.id );	input.setAttribute( 'type', data.type );	if( data.size ) {		input.setAttribute( 'size', data.size );	}	if( data.checked ) {		input.setAttribute( 'checked', 'checked' );	}	if( data.disabled ) {		input.setAttribute( 'disabled', 'disabled' );	}	if( data.event && data.type == 'button' ){		input.addEventListener( 'click', data.event, true );	} else if( data.event ) {		input.addEventListener( 'keyup', data.event, true );	}	if( data.type == 'button' || data.type == 'submit' || data.type == 'reset' ) {		div.appendChild( input );	} else {		var label = document.createElement( 'label' );		label.setAttribute( 'for', data.id );		label.appendChild( document.createTextNode( data.text ) );		if( [ 'radio', 'checkbox' ].indexOf( data.type ) != -1 ) {			div.appendChild( input );			div.appendChild( label );		} else {			div.appendChild( label );			div.appendChild( input );		}	}	return div;}function createSimpleCheckbox( label, name, id ) {	return createInput( {			id:id,			name:name,			value:id,			text:label + ' ',			type:'checkbox',			elem:'div'		} );}function createOptGroup( label ) {	var optgroup = document.createElement( 'optgroup' );	optgroup.setAttribute( 'label', label );	return optgroup;}addOnloadHook( twinkleARVBase );function twinkleARVBase(){	var username;	if ( wgNamespaceNumber == 3 || wgNamespaceNumber == 2 || ( wgNamespaceNumber == -1 && wgTitle == "Contributions" )){		// If we are on the contributions page, need to parse some then		if( wgNamespaceNumber == -1 && wgTitle == "Contributions" ) {			username = document.getElementById( 'contentSub' ).getElementsByTagName( 'a' )[0].getAttribute('title').split(':')[1];		} else {			username = wgTitle.split( '/' )[0]; // only first part before any slashes		}		if( !username ) {			// Something is fishy, there was no user? lets about everything			throw "given username was " + username + " and thus makes no sense.";		}		var name = isIPAddress( username ) ? 'Report IP' : 'Report';		var title =  isIPAddress( username ) ? 'Report IP to Administators' : 'Report user to Administrators';		addPortletLink( chooseBox( 'tw-arv', TwinkleConfig.toolboxButtons ), "javascript:twinklearv(\"" + username + "\")", "arv", "tw-arv", name, title );	}}function twinklearv( uid ) {	if( uid == wgUserName ){		alert( 'You don\'t want to report yourself , do you?' );		return;	}	twinklearv.uid = uid;	twinklearv.Window = new SimpleWindow( 600, 300 );	twinklearv.Window.setTitle( "Advance Reporting and Vetting" ); //Backronym	twinklearv.form = document.createElement( 'form' );	twinklearv.form.setAttribute( 'action', 'javascript:void(0);');	twinklearv.form.addEventListener( 'submit',twinklearv.evaluate , true );	var main_choices = document.createElement( 'select' );	main_choices.addEventListener( 'change',twinklearv.choose , true );	main_choices.setAttribute('name', 'main_choices');	main_choices.setAttribute('id', 'twArvMainChoices');	label = document.createElement( 'label' );	label.setAttribute( 'for', 'main_choices' );	label.appendChild( document.createTextNode( 'Type of Report ' ) );	main_choices.appendChild( createOption( { label:'Vandalism', value:'aiv' } ) );	if( !isIPAddress( uid ) ) {		main_choices.appendChild( createOption( { label:'Username', value:'username' } ) );	}	main_choices.appendChild( createOption( { label:'Sockpuppet', value:'sock' } ) );	twinklearv.form.appendChild( label );	twinklearv.form.appendChild( main_choices );	twinklearv.form.appendChild( document.createElement( 'br' ) );	twinklearv.choices = document.createElement( 'fieldset' );	twinklearv.form.appendChild( twinklearv.choices );	twinklearv.Window.setContent( twinklearv.form );	twinklearv.choose();	twinklearv.Window.display();}twinklearv.choose = function(e) {	while( twinklearv.choices.hasChildNodes() ){		twinklearv.choices.removeChild( twinklearv.choices.firstChild );	}	switch( twinklearv.form.main_choices.value ) {	default:	case 'aiv':		var legend = document.createElement( 'legend' );		legend.appendChild( document.createTextNode( 'Report user for vandalism' ) );		twinklearv.choices.appendChild( legend );		twinklearv.choices.appendChild( createInput( {					id:'twArvAivPage',					value: QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '',					text:'Page (leave empty for no page) ',					type:'text',					name:'page',					size:40,					elem:'div',					event: function(e) {						if( e.target.value == '' ) {							twinklearv.form.badid.disabled = twinklearv.form.goodid.disabled = true;						} else {							twinklearv.form.badid.disabled = false;							twinklearv.form.goodid.disabled = twinklearv.form.badid.value == '';						}					}				} ) );		twinklearv.choices.appendChild( createInput( {					id:'twArvAivBadId',					value: QueryString.exists( 'vanarticlerevid' ) ? QueryString.get( 'vanarticlerevid' ) : '',					text:'Vandal revision id ',					disabled: !QueryString.exists( 'vanarticle' ),					type:'text',					name:'badid',					size:20,					elem:'div',					event: function(e) {						twinklearv.form.goodid.disabled = e.target.value == '';					}				} ) );		twinklearv.choices.appendChild( createInput( {					id:'twArvAivGoodId',					value: QueryString.exists( 'vanarticlegoodrevid' ) ? QueryString.get( 'vanarticlegoodrevid' ) : 'prev',					text:'Last good revision id ',					disabled: !QueryString.exists( 'vanarticle' ) || QueryString.exists( 'vanarticlerevid' ),					type:'text',					name:'goodid',					size:20,					elem:'div'				} ) );		types = document.createElement( 'div' );		types.appendChild( createInput( { 					id:'twArvAivFinal',					name:'aivtype',					value:'final',					text:'Vandalism after final warning given ',					type:'checkbox',					elem:'div'				} ) );		types.appendChild( createInput( { 					id:'twArvAivPostBlock',					name:'aivtype',					value:'postblock',					text:'Vandalism after recent release of block ',					type:'checkbox',					elem:'div'				} ) );		types.appendChild( createInput( {					id:'twArvAivVandalonly',					name:'aivtype',					value:'vandalonly',					text:'Evidently vandalism only account ',					type:'checkbox',					elem:'div'				} ) );		types.appendChild( createInput( { 					id:'twArvAivSpambot',					name:'aivtype',					value:'spambot',					text:'Account is evidently a spambot or a compromized account ',					type:'checkbox',					elem:'div'				} ) );		twinklearv.choices.appendChild( types );		twinklearv.choices.appendChild( createInput( {					id:'twArvReason',					value:'',					text:'Comment ',					type:'text',					name:'reason',					size:80,					elem:'div'				} ) );		twinklearv.choices.appendChild( createInput( {					id:'twArvSubmit',					value: 'Submit',					name:'submit',					type:'submit',					elem:'div'				} ) );		break;	case 'username':		var legend = document.createElement( 'legend' );		legend.appendChild( document.createTextNode( 'Report username violation' ) );		twinklearv.choices.appendChild( legend );		var types = document.createElement( 'div' );		types.appendChild( document.createElement( 'h5' ) ).appendChild( document.createTextNode( 'Missleading username' ) );		types.appendChild( createSimpleCheckbox( 'Implies the user is an admin or other official figure on Wikipedia, or of the Wikimedia Foundation', 'arvtype', 'a1' ) );		types.appendChild( createSimpleCheckbox( 'Closely resembles the name of another Wikipedia user', 'arvtype', 'a2' ) );		types.appendChild( createSimpleCheckbox( 'Matches the name of a well-known living or recently deceased person', 'arvtype', 'a3' ) );		types.appendChild( createSimpleCheckbox( 'Matches the name of a well-known company or group', 'arvtype', 'a4' ) );		types.appendChild( createSimpleCheckbox( 'Resembles an IP address, e-mail address or web page address,', 'arvtype', 'a5' ) );		types.appendChild( createSimpleCheckbox( 'Confusingly refers to a Wikipedia process, namespace, or toolbar item', 'arvtype', 'a6' ) );		types.appendChild( createSimpleCheckbox( 'Implies an automated account, such as names containing "robot", "bot", or a variation thereof', 'arvtype', 'a7' ) );		types.appendChild( createSimpleCheckbox( 'Consists of a lengthy repetition, or apparently random sequence, of characters, e.g. "aaaaaaaaaaaa" or "ghfjkghdfjgkdhfjkg"', 'arvtype', 'a8' ) );		types.appendChild( createSimpleCheckbox( 'Is extremely lengthy', 'arvtype', 'a9' ) );		types.appendChild( document.createElement( 'h5' ) ).appendChild( document.createTextNode( 'Harrasing username' ) );		types.appendChild( createSimpleCheckbox( 'Is defamatory or insulting to other people, groups, articles or processes', 'arvtype', 'b1' ) );		types.appendChild( createSimpleCheckbox( 'Contains personal information about people, such as a telephone number or street address', 'arvtype', 'b2' ) );		types.appendChild( createSimpleCheckbox( 'Gives the impression of intent to cause trouble here, such as by alluding to hacking, spamming, trolling, vandalism, legal threats or computer viruses', 'arvtype', 'b3' ) );		types.appendChild( createSimpleCheckbox( 'Is similar to those used by known vandals', 'arvtype', 'b4' ) );		types.appendChild( document.createElement( 'h5' ) ).appendChild( document.createTextNode( 'Offensive username' ) );		types.appendChild( createSimpleCheckbox( 'Is a name of religions or religious figures', 'arvtype', 'c1' ) );		types.appendChild( createSimpleCheckbox( 'Describes performing or endorsing violent real-world actions', 'arvtype', 'c2' ) );		types.appendChild( createSimpleCheckbox( 'Promotions of a controversial or potentially inflammatory point of view', 'arvtype', 'c3' ) );		types.appendChild( createSimpleCheckbox( 'Describes racism, sexism, or sexual orientation', 'arvtype', 'c4' ) );		types.appendChild( createSimpleCheckbox( 'Describes illnesses, disabilities, or medical or psychological conditions', 'arvtype', 'c5' ) );		types.appendChild( createSimpleCheckbox( 'Describes reproductive or excretory body functions, including genitalia and sexual slang', 'arvtype', 'c6' ) );		types.appendChild( createSimpleCheckbox( 'Contains slurs, profanity and obscenities', 'arvtype', 'c7' ) );		twinklearv.choices.appendChild( types );		twinklearv.choices.appendChild( createInput( {					id:'twArvReason',					value:'',					text:'Comment ',					type:'text',					name:'reason',					size:80,					elem:'div'				} ) );		twinklearv.choices.appendChild( createInput( {					id:'twArvSubmit',					value: 'Submit',					name:'submit',					type:'submit',					elem:'div'				} ) );		break;	case 'sock':		var legend = document.createElement( 'legend' );		legend.appendChild( document.createTextNode( 'Report Suspected Sockpuppeter' ) );		twinklearv.choices.appendChild( legend );		twinklearv.socks = document.createElement( 'fieldset' );		twinklearv.socks.appendChild( document.createElement( 'legend' ) ).appendChild( document.createTextNode( 'Suspected Sockpuppets' ) );		twinklearv.nbrsocks = 1;		twinklearv.socks.appendChild( createInput( {					id:'twArvSockpuppet1',					value:'',					text:'Sockpuppet 1 ',					type:'text',					name:'sockpuppet',					size:80,					elem:'div'				} ) );		twinklearv.choices.appendChild( twinklearv.socks );		twinklearv.socks.appendChild( createInput( {					id:'twArvMoreSocks',					value: 'Add more socks',					name:'moresocks',					type:'button',					elem:'div',					event: function(e) {						twinklearv.nbrsocks++;						twinklearv.socks.insertBefore(							createInput( {									id:'twArvSockpuppet' + twinklearv.nbrsocks,									value:'',									text:'Sockpuppet ' + twinklearv.nbrsocks + ' ',									type:'text',									name:'sockpuppet',									size:80,									elem:'div'								} ),							twinklearv.socks.lastChild						);					}				} ) );		twinklearv.choices.appendChild( document.createElement( 'h5' ) ).appendChild( document.createTextNode( 'Evidence' ) );		var textarea = twinklearv.choices.appendChild( document.createElement( 'textarea' ) );		textarea.setAttribute( 'name', 'evidence' );		textarea.setAttribute( 'id', 'twArvEvidence' );		textarea.setAttribute( 'rows', '5' );		textarea.setAttribute( 'cols', '40' );		textarea.setAttribute( 'style', 'width: 90% !important;' );		twinklearv.choices.appendChild( createInput( {					id:'twArvSubmit',					value: 'Submit',					name:'submit',					type:'submit',					elem:'div'				} ) );		break;	}}twinklearv.evaluate = function(e) {	twinklearv.reason = "";	if( twinklearv.form.reason ) {		comment = twinklearv.form.reason.value;	}	switch( twinklearv.form.main_choices.value ) {	default:	case 'aiv':		var types = getChecked( twinklearv.form.aivtype );		if( types.length == 0 && comment == '' ) {			alert( 'You must specify some reason' );			return;		}		types = types.map( function(v) {				switch(v) {				case 'final':					return 'vandalism after final warning';					break;				case 'postblock':					return 'vandalism directly after release of block';					break;				case 'spambot':					return 'account is evidently a spambot or a compromized account';					break;				case 'vandalonly':					return 'actions evidently indicate a vandalism only account';					break;				}			} ).join( ', ' );		if( twinklearv.form.page.value != '' ) {			twinklearv.reason += 'On [[' + twinklearv.form.page.value.replace( /^(Image|Category):/i, ':$1:' ) + ']]';			if( twinklearv.form.badid.value != '' ) {				var query = {					'title': twinklearv.form.page.value,					'diff': twinklearv.form.badid.value,					'oldid': twinklearv.form.goodid.value				};				twinklearv.reason += ' ([' +  wgServer + wgScriptPath + '/index.php?' + QueryString.create( query ) + ' diff])';			}			twinklearv.reason += ';';		}		if( types ) {			twinklearv.reason += " " + types;		}		if (comment != '' ) {			twinklearv.reason += ". " + comment + '.';		}		Status.init( twinklearv.form );		twinklearv.query = {			'title': 'Wikipedia:Administrator intervention against vandalism',			'action': 'submit',			'section': 1		};		Status.status( "Grabbing AIV page" );		twinklearv.xmlhttp = sajax_init_object();		twinklearv.xmlhttp.overrideMimeType('text/xml');		twinklearv.xmlhttp.open( 'GET' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( twinklearv.query ), true);		twinklearv.xmlhttp.onload = function() {			uid = twinklearv.uid;			reason = twinklearv.reason;			var form = twinklearv.xmlhttp.responseXML.getElementById('editform');			if( !form ) {				Status.error( 'Failed to retrieve edit form.' );				return;			}			var text = form.wpTextbox1.value;			var re = new RegExp( "\\{\\{\\s*(?:(?:[Ii][Pp])?[Vv]andal|[Uu]serlinks)\\s*\\|\\s*(?:1=)?\\s*" + RegExp.escape( uid, true ) + "\\s*\\}\\}" );			var myArr;			if( ( myArr = re.exec( text ) ) ) {				Status.info( 'Report already present, will not add a new one' );				return;			}			Status.status( 'Adding new report...' );			var postData = {				'wpMinoredit': TwinkleConfig.markAIVReportAsMinor ? true : form.wpMinoredit.checked, 				'wpWatchthis': form.wpWatchthis.checked,				'wpStarttime': form.wpStarttime.value,				'wpEdittime': form.wpEdittime.value,				'wpAutoSummary': form.wpAutoSummary.value,				'wpEditToken': form.wpEditToken.value,				'wpSummary': 'Reporting [[Special:Contributions/' + uid + '|' + uid + ']].'+ TwinkleConfig.summaryAd,				'wpTextbox1': text + '*{{' + ( isIPAddress( uid ) ? 'IPvandal' : 'vandal' ) + '|' + (/\=/.test( uid ) ? '1=' : '' ) + uid + '}} - ' + reason + ' ~~' + '~~'			};			twinklearv.xmlhttp = sajax_init_object();			twinklearv.xmlhttp.overrideMimeType('text/xml');			twinklearv.xmlhttp.open( 'POST' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( twinklearv.query ), true);			twinklearv.xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');			twinklearv.xmlhttp.onload = function() { window.location =  wgServer + wgArticlePath.replace( '$1', 'Wikipedia:Administrator intervention against vandalism' ); }			twinklearv.xmlhttp.send( QueryString.create( postData ) );		}		twinklearv.xmlhttp.send( null );		break;	case 'username':		var types = getChecked( twinklearv.form.arvtype );		if( types.length == 0 ) {			alert( 'You must specify at least one breached violation' );			return;		}		types = types.map( function(v) { return '\'\'\'' + v.replace( /(\w+)(\d+)/, "$1:$2" ).toUpperCase() + '\'\'\'' } ).join( ", " );		var uid = twinklearv.uid;		twinklearv.reason = "*\{\{userlinks|" + uid +"\}\} &mdash; Violation of username policy per: " + types + "; ";		if (comment != '' ) {			twinklearv.reason += "''" + comment.toUpperCaseFirstChar() + "''. ";		}		twinklearv.reason += "\~\~\~\~";		Status.init( twinklearv.form );		twinklearv.query = {			'title': 'Wikipedia:Usernames for administrator attention',			'action': 'submit',			'section': 1		};		Status.status( "Grabbing UAA page" );		twinklearv.xmlhttp = sajax_init_object();		twinklearv.xmlhttp.overrideMimeType('text/xml');		twinklearv.xmlhttp.open( 'GET' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( twinklearv.query ), true);		twinklearv.xmlhttp.onload = function() {			uid = twinklearv.uid;			reason = twinklearv.reason;			var form = twinklearv.xmlhttp.responseXML.getElementById('editform');			if( !form ) {				Status.error( 'Failed to retrieve edit form.' );				return;			}			var text = form.wpTextbox1.value;			Status.status( 'Adding new report...' );			var postData = {				'wpMinoredit': form.wpMinoredit.checked, 				'wpWatchthis': form.wpWatchthis.checked,				'wpStarttime': form.wpStarttime.value,				'wpEdittime': form.wpEdittime.value,				'wpAutoSummary': form.wpAutoSummary.value,				'wpEditToken': form.wpEditToken.value,				'wpSummary': 'Reporting [[Special:Contributions/' + uid + '|' + uid + ']].'+ TwinkleConfig.summaryAd,				'wpTextbox1': text.replace( /-->/, "-->\n" + reason )			};			twinklearv.xmlhttp = sajax_init_object();			twinklearv.xmlhttp.overrideMimeType('text/xml');			twinklearv.xmlhttp.open( 'POST' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( twinklearv.query ), true);			twinklearv.xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');			twinklearv.xmlhttp.onload = function() { window.location =  wgServer + wgArticlePath.replace( '$1', 'Wikipedia:Usernames for administrator attention' ); }			twinklearv.xmlhttp.send( QueryString.create( postData ) );		}		twinklearv.xmlhttp.send( null );		break;	case 'sock':		twinklearv.sockpuppets = getTexts( twinklearv.form.sockpuppet );		twinklearv.evidence = twinklearv.form.evidence.value;		Status.init( twinklearv.form );		Status.status( 'Grabbing data of eventual previous reports' );		var xmlhttp = sajax_init_object();		xmlhttp.query = {			'title': 'Special:Prefixindex',			'from': 'Suspected sock puppets/' + twinklearv.uid,			'namespace': 4		};		xmlhttp.overrideMimeType('text/xml');		xmlhttp.open( 'GET' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( xmlhttp.query ), true);		xmlhttp.onload = function() {			var a_tags = this.responseXML.getElementsByTagName('a');			var re = new RegExp( RegExp.escape( 'Suspected sock puppets/' + twinklearv.uid ) );			var number = 0;			for( var i in a_tags ) {				var title = a_tags[i].title;				if( re.exec( title ) ) {					var n = /\(\s*(\d+)(?:th|nd|rd|st)\s*\)\s*$/.exec( title );					if( n && n[1] > number ) {						number = n[1];					} else if( number == 0 ) {						number = 1;					}				}			}			if( number == 0 ) {				twinklearv.numbering = number = '';			} else {				number = num2order( parseInt( number ) + 1);				twinklearv.numbering = ' (' + number + ')';			}			Status.status( 'Creating report page [[Wikipedia:Suspected sock puppets/' +  twinklearv.uid + twinklearv.numbering + ']]');			var xmlhttp = sajax_init_object();			xmlhttp.query = {				'title': 'Wikipedia:Suspected sock puppets/' +  twinklearv.uid + twinklearv.numbering,				'action': 'submit'			};			xmlhttp.overrideMimeType('text/xml');			xmlhttp.open( 'GET' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( xmlhttp.query ), true);			xmlhttp.onload = function() {				var form = this.responseXML.getElementById('editform');				var text = 					"===[[User:" + twinklearv.uid + "]]===\n" +					";Suspected sockpuppeteer\n" +					":\{\{user5|" + twinklearv.uid + "\}\}\n\n" +					";Suspected sockpuppets\n" + 					twinklearv.sockpuppets.map( function(v) { return ":\{\{user5|" + v + "\}\}" } ).join( "\n" ) + "\n\n" +					";Report submission by\n" +					"\~\~\~\~\n\n" +					";Evidence\n" +					twinklearv.evidence + "\n\n" +					";Comments\n\n\n" +					";Conclusions\n\n\n" +					"----\n</div>\n";				var postData = {					'wpMinoredit': form.wpMinoredit.checked,					'wpWatchthis': form.wpWatchthis.checked,					'wpStarttime': form.wpStarttime.value,					'wpEdittime': form.wpEdittime.value,					'wpAutoSummary': form.wpAutoSummary.value,					'wpEditToken': form.wpEditToken.value,					'wpSummary': "Creating report for [[User:" +  twinklearv.uid + ']].' + TwinkleConfig.summaryAd,					'wpTextbox1': text				};				var xmlhttp = sajax_init_object();				xmlhttp.overrideMimeType('text/xml');				xmlhttp.open( 'POST' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( this.query ), true);				xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');				xmlhttp.onload = function() { Status.info( 'Report created' ) }				xmlhttp.send( QueryString.create( postData ) );			}			xmlhttp.send( null );			Status.status( 'Linking report to open cases');			var xmlhttp = sajax_init_object();			xmlhttp.query = {				'title': 'Wikipedia:Suspected sock puppets',				'section': 4,				'action': 'submit'			};			xmlhttp.overrideMimeType('text/xml');			xmlhttp.open( 'GET' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( xmlhttp.query ), true);			xmlhttp.onload = function() {				var form = this.responseXML.getElementById('editform');				text = form.wpTextbox1.value.replace( /(<!-- Add .*? list\. -->)/, "$1\n\{\{Wikipedia:Suspected sock puppets/" + twinklearv.uid + twinklearv.numbering + "\}\}");				var postData = {					'wpMinoredit': form.wpMinoredit.checked,					'wpWatchthis': form.wpWatchthis.checked,					'wpStarttime': form.wpStarttime.value,					'wpEdittime': form.wpEdittime.value,					'wpAutoSummary': form.wpAutoSummary.value,					'wpEditToken': form.wpEditToken.value,					'wpSummary': "Adding report for [[User:" +  twinklearv.uid + ']].' + TwinkleConfig.summaryAd,					'wpTextbox1': text				};				var xmlhttp = sajax_init_object();				xmlhttp.overrideMimeType('text/xml');				xmlhttp.open( 'POST' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( this.query ), true );				xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');				xmlhttp.onload = function() { Status.info( 'Added to open cases' ) }				xmlhttp.send( QueryString.create( postData ) );			}			xmlhttp.send( null );			Status.status( 'Notifying suspected sockpuppeter');			var xmlhttp = sajax_init_object();			xmlhttp.query = {				'title': 'User talk:' + twinklearv.uid,				'action': 'submit'			};			xmlhttp.overrideMimeType('text/xml');			xmlhttp.open( 'GET' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( xmlhttp.query ), true);			xmlhttp.onload = function() {				var form = this.responseXML.getElementById('editform');				text = form.wpTextbox1.value;				var postData = {					'wpMinoredit': form.wpMinoredit.checked,					'wpWatchthis': form.wpWatchthis.checked,					'wpStarttime': form.wpStarttime.value,					'wpEdittime': form.wpEdittime.value,					'wpAutoSummary': form.wpAutoSummary.value,					'wpEditToken': form.wpEditToken.value,					'wpSummary': "Notifying about suspicion of sockpuppertering." + TwinkleConfig.summaryAd,					'wpTextbox1': text + "\n\{\{subst:socksuspectnotice|1=" + twinklearv.uid + twinklearv.numbering + "\}\} \~\~\~\~"				};				var xmlhttp = sajax_init_object();				xmlhttp.overrideMimeType('text/xml');				xmlhttp.open( 'POST' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( this.query ), true);				xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');				xmlhttp.onload = function() { Status.info( 'Suspected sockpuppeter notified' ) }				xmlhttp.send( QueryString.create( postData ) );			}			xmlhttp.send( null );			Status.status( 'Tagging suspected socks');			for( var i in twinklearv.sockpuppets ) {				var xmlhttp = sajax_init_object();				xmlhttp.current = twinklearv.sockpuppets[i];				xmlhttp.query = {					'title': 'User:' + xmlhttp.current,					'action': 'submit'				};				xmlhttp.overrideMimeType('text/xml');				xmlhttp.open( 'GET' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( xmlhttp.query ), true);				xmlhttp.onload = function() {					var form = this.responseXML.getElementById('editform');					text = form.wpTextbox1.value;					if( /{{sockpuppet/.exec( text ) ) { // already marked as a sock, just ignore then								return;							}							var postData = {								'wpMinoredit': form.wpMinoredit.checked,								'wpWatchthis': form.wpWatchthis.checked,								'wpStarttime': form.wpStarttime.value,								'wpEdittime': form.wpEdittime.value,								'wpAutoSummary': form.wpAutoSummary.value,								'wpEditToken': form.wpEditToken.value,								'wpSummary': "Adding supsected sockpuppet tag for suspected sockpuppeter [[User:" +  twinklearv.uid + ']].' + TwinkleConfig.summaryAd,								'wpTextbox1': "\{\{subst:socksuspect|1=" + twinklearv.uid + "\}\}\n" + text							};							var xmlhttp = sajax_init_object();							xmlhttp.current = this.current;							xmlhttp.overrideMimeType('text/xml');							xmlhttp.open( 'POST' , wgServer + wgScriptPath + '/index.php?' + QueryString.create( this.query ), true);							xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');							xmlhttp.onload = function() { Status.info( 'Added tag for ' + this.current ) }							xmlhttp.send( QueryString.create( postData ) );						}						xmlhttp.send( null );					}				}				xmlhttp.send( null );			}		}//Status.debugLevel = 1;/*** Last diff tab, show difference between last revision and the one before*//**TwinkleConfig.toolboxButtons (string)If id defined in this array, the button of the action is located inthe toolbox instead of inthe actions bar.*/if( typeof( TwinkleConfig.toolboxButtons ) == 'undefined' ) {	TwinkleConfig.toolboxButtons = [];}function lastdiff() {	if( wgNamespaceNumber >= 0 ) {		var query = {			'title': wgPageName,			'diff': 'cur',			'oldid': 'prev'		};		addPortletLink(chooseBox( 'tw-lastdiff', TwinkleConfig.toolboxButtons ), wgServer + wgScriptPath + '/index.php?' + QueryString.create( query ), 'last', 'tw-lastdiff', 'Show most recent diff' );	}}addOnloadHook(lastdiff);var dataXML;var ntitle;var me;function diffSincePrevUserButton() { 	if( wgNamespaceNumber < 0 ) {		return;	}	if( !QueryString.exists( 'diff' ) ) {		// Not diff page		return;	} 	ntitle = getElementsByClassName( document.getElementById('bodyContent'), 'td' , 'diff-ntitle' )[0];	if( !ntitle ) {		// Nothing to see here, move along...		return;	}	var l = addPortletLink(chooseBox( 'tw-since', TwinkleConfig.toolboxButtons ), "javascript:diffSincePrevUserInit(false);", 'since', 'tw-since', 'Show difference between last diff and the revision made by previous user' );	var l = addPortletLink(chooseBox( 'tw-sincemine', TwinkleConfig.toolboxButtons ), "javascript:diffSincePrevUserInit(true);", 'since mine', 'tw-sincemine', 'Show difference between last diff and my last revision' );}addOnloadHook(diffSincePrevUserButton);function diffSincePrevUserInit(me) {	try {		Status.init( document.getElementById('bodyContent') );		var rev = wgCurRevisionId;		var user;		if( me ) {			Status.debug( '"me" is choosen' );			user = wgUserName;		} else if( vandal ) { 			Status.debug( 'vandal ' + vandal + ' already defined' );			// twinklefluff or simlar have already parsed this thingi			user = vandal;		} else {			Status.debug( 'testing 3:rd element' );			user = ntitle.getElementsByTagName('a')[3].firstChild.nodeValue;			Status.debug( '3:rd element: ' + user );			if( user == 'Current revision' ) {				Status.debug( 'testing 6:th element' );				user = ntitle.getElementsByTagName('a')[6].firstChild.nodeValue;				Status.debug( '6:th element: ' + user );			}		}		diffSincePrevUser( user, rev, me );	} catch(e) {		if(e.what){			alert(e.what())		} else {			alert(e);		}	}}function diffSincePrevUser( user, rev, pMe ) {	me = pMe;	dataXML = sajax_init_object();	dataXML.overrideMimeType('text/xml');	var query = {		'prop': 'revisions',		'format': 'xml',		'action': 'query',		'titles': wgPageName,		'rvlimit': 50,		'rvprop': 'user',		'rvendid': wgCurRevisionId	};	Status.debug( "Query string:" + QueryString.create( query ), 1 );	Status.status( 'Querying revisions' );	dataXML.open( 'GET', wgServer + wgScriptPath + "/api.php?" + QueryString.create( query ) , true );	dataXML.onreadystatechange = function() {		if ( dataXML.readyState != 4 ){			Status.progress('.');					return;		} 		if( dataXML.status != 200 ){			Status.error('Bad status , bailing out');					return;		}		Status.progress(' Done.');				var doc = dataXML.responseXML.documentElement;		var revisions = doc.getElementsByTagName('rev');		Status.debug( 'length: ' + revisions.length, 1 );		var curNode = revisions[0];		Status.debug( 'curNode: ' + curNode, 1 );		Status.debug( 'user: ' + user, 1 );		Status.debug( "rev: " + rev, 1 );		var last = null;		Status.status( 'Finding last revision made by user...' );		while( curNode != null ) {			Status.debug( 'curNode: ' + curNode.getAttribute( 'revid' ), 1 );			if( me ) {				if( curNode.getAttribute( 'revid' ) < rev && curNode.getAttribute( 'user' ) == user ) {					Status.debug( "found rev and user", 1 );					last = curNode.getAttribute( 'revid' );					break;				} 			} else {				if( curNode.getAttribute( 'revid' ) < rev && curNode.getAttribute( 'user' ) != user ) {					Status.debug( "found rev and user", 1 );					last = curNode.getAttribute( 'revid' );					break;				} 			}			curNode = curNode.nextSibling;		}		if( last == null ) {			Status.error( [ 'No previous revision found, or ', user , ' is only contributor ' ] );			return;		}		var query = {			'title': wgPageName,			'oldid': last,			'diff': rev		};		window.location = wgServer + wgScriptPath + '/index.php?' + QueryString.create( query );	};	dataXML.send( null );}