MediaWiki:PageParser.js

/** * @name PageParser * @author Manuel de la Fuente (https://manuelfte.com) * @version 1.0.0 * @license CC-BY-SA-3.0 * @description Transcludes a Wikia page into another while bypassing cache */

window.mw.hook('wikipage.content').add(function {  var values = [    [, 'Calendar'],    [, 'RandomEpisode']  ];  function parser (page, id) {    var div = document.getElementById(id);    if (!div) {      return;    }    var request = new XMLHttpRequest;    request.onreadystatechange = function  {      if (request.readyState === 4 && request.status === 200) {        div.innerHTML = JSON.parse(request.responseText).parse.text['*'];      }    };    request.open('GET', '/api.php?action=parse&format=json&disablepp=1&prop=text&text=' + page, true);    request.send;  }  values.forEach(function (args) { parser.apply(null, args); }); });