User:Villahj Ideeut/RC.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes.
- Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
- Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
- Opera, Konqueror and Safari users can just click the Reload button.
- Chrome: press Ctrl+F5 or Shift+F5
// <nowiki>
if (document.implementation.createDocument) {
var gml_xmlparser = new DOMParser();
}
function addRC() {
if(wgPageName == "Special:RecentChanges") {
addPortletLink('p-cactions', 'javascript:runRC()', 'Realtime', 'td-rc', 'Display in Realtime');
};
}
function getFile(filename) {
oxmlhttp = null;
try {
oxmlhttp = new XMLHttpRequest();
oxmlhttp.overrideMimeType("text/xml");
} catch(e) {
try {
oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
return null;
}
}
if(!oxmlhttp)
return null;
try {
oxmlhttp.open("GET",filename,false);
oxmlhttp.send(null);
} catch(e) {
return null;
}
return oxmlhttp.responseText;
}
function runRC() {
var d = getFile("http://en.uncyclopedia.co/w/index.php?title=Special:Recentchanges");
var start = d.indexOf('<div id="bodyContent">');
var end = d.indexOf('<!-- end content -->');
var txt = d.substring(start,end);
var bugstart= txt.indexOf("<!-- PATCH: Begin addons -->");
var bugstop = txt.indexOf("<!-- analytics (end) -->");
var fin = txt.substring(0,bugstart) + txt.substring(bugstop);
document.getElementById('bodyContent').innerHTML = txt;
var t=setTimeout("runRC()",3000);
}
addOnloadHook(addRC);
// </nowiki>