Gebruiker:Roepersbot/monobook.js

Vandaag gaan we Gebruiker:Roepersbot/monobook.js verkennen, een onderwerp dat de aandacht heeft getrokken van mensen van alle leeftijden en lagen van de bevolking. Sinds zijn opkomst heeft Gebruiker:Roepersbot/monobook.js grote belangstelling gewekt vanwege de impact ervan op onze samenleving en ons dagelijks leven. In dit artikel gaan we in de geschiedenis van Gebruiker:Roepersbot/monobook.js duiken, de implicaties ervan in de wereld van vandaag onderzoeken en nadenken over de toekomst ervan. Of u nu een expert op dit gebied bent of er gewoon nieuwsgierig naar bent, dit artikel geeft u een compleet en inzichtelijk overzicht van Gebruiker:Roepersbot/monobook.js. Ga met ons mee op deze fascinerende reis!
//<nowiki>

// redirect shortcut //

function redirect() {
        document.editform.wpTextbox1.value = "#REDIRECT ]";
        document.editform.wpSummary.value = document.editform.wpTextbox1.value;
        document.editform.wpMinoredit.checked = true;
        document.editform.submit();
}

// Image tagging //

function geeninfo() {
        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n+$/,"")+"\n\n{{geeninfo}}";
        document.editform.wpSummary.value = "{{geeninfo}}";
        document.editform.wpMinoredit.checked = false;
        document.editform.submit();
}

function gnu() {
        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n+$/,"")+"\n\n{{GFDL}}";
        document.editform.wpSummary.value = "{{GFDL}}";
        document.editform.wpMinoredit.checked = false;
        document.editform.submit();
}

function pd() {
        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n+$/,"")+"\n\n{{PD}}";
        document.editform.wpSummary.value = "{{PD}}";
        document.editform.wpMinoredit.checked = false;
        document.editform.submit();
}

function pdusgov() {
        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n+$/,"")+"\n\n{{PD-USGov}}";
        document.editform.wpSummary.value = "{{PD-USGov}}";
        document.editform.wpMinoredit.checked = false;
        document.editform.submit();
}

function nietcomm() {
        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n+$/,"")+"\n\n{{NietCommercieel}}";
        document.editform.wpSummary.value = "{{NietCommercieel}}";
        document.editform.wpMinoredit.checked = false;
        document.editform.submit();
}

function beperkt() {
        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n+$/,"")+"\n\n{{beperkt}}";
        document.editform.wpSummary.value = "{{beperkt}}";
        document.editform.wpMinoredit.checked = false;
        document.editform.submit();
}

function eigenwerk() {
        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n+$/,"")+"\n\n{{eigenwerk}}";
        document.editform.wpSummary.value = "{{eigenwerk}}";
        document.editform.wpMinoredit.checked = false;
        document.editform.submit();
}

function enkelwikipedia() {
        document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n+$/,"")+"\n\n{{enkelwikipedia}}";
        document.editform.wpSummary.value = "{{enkelwikipedia}}";
        document.editform.wpMinoredit.checked = false;
        document.editform.submit();
}

// Event functions //

function alwaysAdd() {
        document.getElementById("pt-mytalk").innerHTML = '<a href="https://wikifreehand.com/nl/Overleg_gebruiker:Roepersbot">Overleg</a></li><li id="pt-css-js"><a href="https://wikifreehand.com/nl/Gebruiker:Roepersbot/monobook.css">css</a> / <a href="https://wikifreehand.com/nl/Gebruiker:Roepersbot/monobook.js">js</a>';
        document.getElementById("p-navigation").innerHTML = '<h5>Navigatie</h5><div class="pBody"><ul><li id="n-mainpage"><a href="https://wikifreehand.com/nl/Hoofdpagina">Hoofdpagina</a></li><li id="n-portal"><a href="https://wikifreehand.com/nl/Portaal:Gebruikersportaal">Gebruikersportaal</a></li><li id="n-recentchanges"><a href="https://wikifreehand.com/nl/Speciaal:Recentchanges">Recente wijzigingen</a></li></ul></div>';
        return false; 
}

function addButtons() {
        str = "<input type=button value=redirect onclick=\"redirect()\" class=subbutt accesskey=\"=\">";
        if(location.href.match(/Afbeelding:/)) {
             str += "<input type=button value=gi onclick=\"geeninfo()\" class=subbutt accesskey=7> <input type=button value=gnu onclick=\"gnu()\" class=subbutt accesskey=8> <input type=button value=pd onclick=\"pd()\" class=subbutt accesskey=9> <input type=button value=usgov onclick=\"pdusgov()\" class=subbutt accesskey=0> <input type=button value=nietcomm onclick=\"nietcomm()\" class=subbutt accesskey='{'> <input type=button value=beperkt onclick=\"beperkt()\" class=subbutt accesskey=';'> <input type=button value=eigen onclick=\"eigenwerk()\" class=subbutt accesskey=']'> <input type=button value=ew onclick=\"enkelwikipedia()\" class=subbutt accesskey='/'>";
        }

        document.getElementById("editpage-copywarn").innerHTML=document.getElementById("editpage-copywarn").innerHTML.replace(/(<div class=\"plainlinks\")/,"<form action=\"\">"+str+"</form><br />$1");
        return false; 
}

function addPurge() {
        document.getElementById("ca-watch").innerHTML=document.getElementById("ca-watch").innerHTML.replace(/watch/,"purge").replace(/volg/g,"purge");
        return false; 
}

// Declare events //

if (window.addEventListener) {
  window.addEventListener("load", alwaysAdd, false);
} else if (window.attachEvent) {
  window.attachEvent("onload", alwaysAdd);
}
if(location.href.match(/action=(edit)|(submit)/)) {
  if (window.addEventListener) {
    window.addEventListener("load", addButtons, false);
  } else if (window.attachEvent) {
    window.attachEvent("onload", addButtons);
  }
} else if(!location.href.match(/action=/)) {
  if (window.addEventListener) {
    window.addEventListener("load", addPurge, false);
  } else if (window.attachEvent) {
    window.attachEvent("onload", addPurge);
  }
}



// -----------------------------------------------------------------------------
// God-like Monobook skin
// (c) 2005 Sam Hocevar <[email protected]>
// $Id: godmode-light.js 907 2005-06-28 12:57:06Z 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 ] by ] (]); someone else has edited or rolled back the page already. Last edit was by ] (]). ';
var revertpage = 'Reverted edits by ] to last version by $1';
switch (document.getElementsByTagName('html').lang) {
  case 'nl':
    rollbacklink = 'rollback';
    cantrollback = 'Terugdraaien onmogelijk, de laatste gebruiker is de enige auteur van deze pagina.';
    alreadyrolled = 'Terugdraaien van laatste wijziging van ] van ] (]); onmogelijk. De laatste wijziging was van ] (]). ';
    revertpage = "Wijzigingen door ] hersteld tot de versie na de laatste wijziging door $1 (js)";
    break;
  case 'fr':
    rollbacklink = 'révoquer';
    cantrollback = 'Impossible de révoquer: dernier auteur est le seul à avoir modifié cet article';
    alreadyrolled = 'Impossible de révoquer la dernière modification de ] par  ] (]); quelqu\'un d\'autre à déjà modifer ou révoquer l\'article. La dernière modificaion était de ] (]). '; // lol @ pathetic grammar
    revertpage = "Révocation des modifications de ] et restauration d'une précédente version de $1";
    break;
  case 'de':
    rollbacklink = 'Zurücksetzen';
    cantrollback = 'Die �nderung kann nicht zurückgenommen werden; der letzte Autor ist der einzige.';
    alreadyrolled = 'Die Zurücknahme des Artikels ] von ] (]) ist nicht möglich, da eine andere �nderung oder Rücknahme erfolgt ist.  Die letzte �nderung ist von ] (])';
    revertpage = '�nderungen von ] rückgängig gemacht und letzte Version von ] wiederhergestellt';
    break;
  case 'es':
    rollbacklink = 'Revertir';
    cantrollback = 'No se pueden revertir las ediciones; el último colaborador es el único autor de este artículo.';
    alreadyrolled = 'No se puede revertir la última edición de ] por ] (]); alguien más ya ha editado o revertido esa página.  La última edición fue hecha por ] (]). ';
    revertpage = 'Revertida a la última edición de $1';
    break;
  case 'it':
    rollbacklink = 'rollback';
    cantrollback = 'Impossibile tornare ad una versione precedente: l\'ultima modifica è 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ão foi possível reverter a edição; o último contribuidor é o único autor deste artigo.';
    alreadyrolled = 'Não foi possível reverter as edições de  ] por ] (]); alguém o editou ou já o reverteu.  A última edição foi de  ] (]). ';
    revertpage = 'Revertidas edições por ], para a última versão por $1';
    break;
}

// -----------------------------------------------------------------------------
// XMLHttpRequest support
// -----------------------------------------------------------------------------
if (document.implementation.createDocument) {
  var xmlparser = new DOMParser();
}

function XMLParse(string) {
  if (document.implementation.createDocument) {
    return xmlparser.parseFromString(string, "text/xml");
  } else if (window.ActiveXObject) {
    var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
    xmldoc.async = "false";
    ret = xmldoc.loadXML(string);      
    if (!ret)
      return null;
    return xmldoc.documentElement;
  }
  return null;
}

var xmlhttp;

function HTTPClient() {
  var http;
  if(window.XMLHttpRequest) {
    http = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    try {
      http = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        http = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        http = false;
      }
    }
  }
  return 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 |= 0x80 << ((len) % 32);
  x = 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, 7 , -680876936); d = md5_ff(d, a, b, c, x, 12, -389564586); c = md5_ff(c, d, a, b, x, 17,  606105819); b = md5_ff(b, c, d, a, x, 22, -1044525330); a = md5_ff(a, b, c, d, x, 7 , -176418897); d = md5_ff(d, a, b, c, x, 12,  1200080426); c = md5_ff(c, d, a, b, x, 17, -1473231341); b = md5_ff(b, c, d, a, x, 22, -45705983); a = md5_ff(a, b, c, d, x, 7 ,  1770035416); d = md5_ff(d, a, b, c, x, 12, -1958414417); c = md5_ff(c, d, a, b, x, 17, -42063); b = md5_ff(b, c, d, a, x, 22, -1990404162); a = md5_ff(a, b, c, d, x, 7 ,  1804603682); d = md5_ff(d, a, b, c, x, 12, -40341101); c = md5_ff(c, d, a, b, x, 17, -1502002290); b = md5_ff(b, c, d, a, x, 22,  1236535329);

    a = md5_gg(a, b, c, d, x, 5 , -165796510); d = md5_gg(d, a, b, c, x, 9 , -1069501632); c = md5_gg(c, d, a, b, x, 14,  643717713); b = md5_gg(b, c, d, a, x, 20, -373897302); a = md5_gg(a, b, c, d, x, 5 , -701558691); d = md5_gg(d, a, b, c, x, 9 ,  38016083); c = md5_gg(c, d, a, b, x, 14, -660478335); b = md5_gg(b, c, d, a, x, 20, -405537848); a = md5_gg(a, b, c, d, x, 5 ,  568446438); d = md5_gg(d, a, b, c, x, 9 , -1019803690); c = md5_gg(c, d, a, b, x, 14, -187363961); b = md5_gg(b, c, d, a, x, 20,  1163531501); a = md5_gg(a, b, c, d, x, 5 , -1444681467); d = md5_gg(d, a, b, c, x, 9 , -51403784); c = md5_gg(c, d, a, b, x, 14,  1735328473); b = md5_gg(b, c, d, a, x, 20, -1926607734);

    a = md5_hh(a, b, c, d, x, 4 , -378558); d = md5_hh(d, a, b, c, x, 11, -2022574463); c = md5_hh(c, d, a, b, x, 16,  1839030562); b = md5_hh(b, c, d, a, x, 23, -35309556); a = md5_hh(a, b, c, d, x, 4 , -1530992060); d = md5_hh(d, a, b, c, x, 11,  1272893353); c = md5_hh(c, d, a, b, x, 16, -155497632); b = md5_hh(b, c, d, a, x, 23, -1094730640); a = md5_hh(a, b, c, d, x, 4 ,  681279174); d = md5_hh(d, a, b, c, x, 11, -358537222); c = md5_hh(c, d, a, b, x, 16, -722521979); b = md5_hh(b, c, d, a, x, 23,  76029189); a = md5_hh(a, b, c, d, x, 4 , -640364487); d = md5_hh(d, a, b, c, x, 11, -421815835); c = md5_hh(c, d, a, b, x, 16,  530742520); b = md5_hh(b, c, d, a, x, 23, -995338651);

    a = md5_ii(a, b, c, d, x, 6 , -198630844); d = md5_ii(d, a, b, c, x, 10,  1126891415); c = md5_ii(c, d, a, b, x, 15, -1416354905); b = md5_ii(b, c, d, a, x, 21, -57434055); a = md5_ii(a, b, c, d, x, 6 ,  1700485571); d = md5_ii(d, a, b, c, x, 10, -1894986606); c = md5_ii(c, d, a, b, x, 15, -1051523); b = md5_ii(b, c, d, a, x, 21, -2054922799); a = md5_ii(a, b, c, d, x, 6 ,  1873313359); d = md5_ii(d, a, b, c, x, 10, -30611744); c = md5_ii(c, d, a, b, x, 15, -1560198380); b = md5_ii(b, c, d, a, x, 21,  1309151649); a = md5_ii(a, b, c, d, x, 6 , -145523070); d = md5_ii(d, a, b, c, x, 10, -1120210379); c = md5_ii(c, d, a, b, x, 15,  718787259); b = md5_ii(b, c, d, a, x, 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 |= (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%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray >> ((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.indexOf('=');
    var name = l.substring(0, n);
    if (name == 'fakeaction') {
      if (l.substring(n + 1) == 'rollback')
        revert = true;
    } else if (name == 'vandal') {
      gml_vandal = unescape(l.substring(n + 1));
    } else if (name == 'token') {
      token = unescape(l.substring(n + 1));
    } else if (name == 'title') {
      gml_url += '?' + l;
    }
  }
  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;
  }

  xmlhttp = HTTPClient();
  if (!xmlhttp)
    return;
  document.getElementById('bodyContent').innerHTML += '<br />Getting article history...';
  xmlhttp.open("GET", gml_url + '&action=history&limit=50', true);
  xmlhttp.onreadystatechange = RevertStepTwo;
  xmlhttp.send(null);
}

function RevertStepTwo() {
  if (xmlhttp.readyState != 4)
    return
  var l;
  var oldid;
  // Get the vandal and new editor names
  gml_editor = '';
  doc = XMLParse(xmlhttp.responseText);
  l = doc.getElementById('pagehistory').getElementsByTagName('li');
  //l = doc.selectSingleNode('//*').getElementsByTagName('li');
  for (i = 0; i < l.length; i++) {
    var name = l.getElementsByTagName('span').getElementsByTagName('a').innerHTML;
    if (i == 0 && name != gml_vandal) {
      document.getElementById('bodyContent').innerHTML += '<br />Error: ' + gml_vandal + ' is not the last editor!';
      return;
    } else if (i > 0 && name != gml_vandal) {
      oldid = l.getElementsByTagName('input').value;
      gml_editor = name;
      break;
    }
  }
  if (gml_editor == '') {
    document.getElementById('bodyContent').innerHTML += '<br />Error: ' + gml_vandal + ' is the only editor!';
    return;
  }

  xmlhttp = HTTPClient();
  if (!xmlhttp)
    return;
  document.getElementById('bodyContent').innerHTML += '<br />Getting article edit form...';
  xmlhttp.open("GET", gml_url + '&action=edit&oldid=' + oldid, true);
  xmlhttp.onreadystatechange = RevertStepThree;
  xmlhttp.send(null);
}

function RevertStepThree() {
  if (xmlhttp.readyState != 4)
    return
  var l;
  // Insert the downloaded form in our current page, using
  // only hidden form inputs.
  var oldform = XMLParse(xmlhttp.responseText).getElementById('editform');
  var newform = document.createElement('form');
  l = oldform.getElementsByTagName('textarea');
  for (i = l.length; i--; ) {
    var t = document.createElement('input');
    t.type = 'hidden';
    t.name = l.name;
    t.value = l.innerHTML;
    newform.appendChild(t);
  }
  l = oldform.getElementsByTagName('input');
  for (i = l.length; i--; ) {
    if (l.name == 'wpSummary') {
      l.value = revertpage.replace(/\$1/g, gml_editor).replace(/\$2/g, gml_vandal);
    } else if (l.name == 'wpMinoredit') {
      l.value = '1';
    } else if (l.name == 'wpWatchthis') {
      if (!l.checked)
        continue; // Donâ¬"t touch the "watch" status
      l.value = "on";
    } else if (l.name == 'wpPreview') {
      continue;
    } else if (l.name == 'wpDiff') {
      continue;
    }
    l.type = 'hidden';
    newform.appendChild(l);
  }
  newform.name = oldform.name;
  newform.method = oldform.method;
  newform.id = oldform.id;
  newform.action = oldform.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.className == 'diff-otitle') {
      article = l.getElementsByTagName('a').href.split('&').replace(/*\/\/*/, '');
    } else if (l.className == 'diff-ntitle') {
      var toplink = l.getElementsByTagName('a').href;
      vandal = l.getElementsByTagName('a').title.split(':');
      var t = l.innerHTML
      n = t.indexOf('</a>) <br') + t.indexOf('</A>) <BR') + 1; // XXX: WOW HACK!!!!
      if (n >= 0 && article != '' && toplink.indexOf('oldid=') == -1) {
        l.innerHTML = t.substring(0, n + 5) + ' &nbsp;&nbsp;&nbsp;<strong></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.innerHTML;
    } else {
      vandal = c.innerHTML.replace(/ \(.*/, '').replace(/.* /, '');
    }
    l = document.getElementById('bodyContent').getElementsByTagName('li');
    for (i = 0; i < l.length; i++) {
      var t = l.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.getElementsByTagName('a').href.split('&').replace(/*\/\/*/, '');
        l.innerHTML += ' ';
      }
    }
  }
}

// -----------------------------------------------------------------------------
// 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);
}



//</nowiki>