MediaWikiCommon.jsajaxrefresh.js

////////////////////////////////////////////////////////////////
// ADVANCED AJAX AUTO-REFRESHING ARTICLES
// Code courtesy of "pcj" of WoWWiki. 
////////////////////////////////////////////////////////////////
 
ajaxPages = new Array("SpecialRecentChanges", "SpecialWatchlist", "SpecialLog", "SpecialContributions");
 
function getXmlHttpRequestObject() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest(); //Not Internet Explorer
} else if(window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP"); //Internet Explorer
} else {
//fail silently
}
}
getRCDataRO = getXmlHttpRequestObject();
var cr = new RegExp("\r", "gm");
var lf = new RegExp("\n", "gm");
var endText = new RegExp('\t\s*?\t\s*?
', "mi"); var rcTimer; var rcRefresh = 60000; function preloadAJAXRC() { if (skin == "monaco") { s = 1; } else { s = 0; } ajaxRCCookie = (getCookie("ajaxload-"+wgPageName)=="on") ? truefalse; document.getElementsByTagName("h1")0.innerHTML += ' '; document.getElementById("ajaxRCtoggle").checked = ajaxRCCookie; if (getCookie("ajaxload-"+wgPageName)=="on") loadRCData(); } function toggleRC() { if (document.getElementById("ajaxRCtoggle").checked == true) { setCookie("ajaxload-"+wgPageName, "on", 30); loadRCData(); } else { setCookie("ajaxload-"+wgPageName, "off", 30); clearTimeout(rcTimer); } } function loadRCData() { if (getRCDataRO.readyState == 4 || getRCDataRO.readyState == 0) { if (location.href.indexOf("/wiki/")) { rcURL = "http//" + location.hostname + "/wiki/" + wgPageName + location.search; } else { rcURL = "http//" + location.hostname + "/" + wgPageName + location.search; } getRCDataRO.open("GET", rcURL, true); getRCDataRO.onreadystatechange = parseRCdata; getRCDataRO.send(null); } } function parseRCdata() { if (getRCDataRO.readyState == 4) { textFilter = new RegExp('
.*?
\t\s*?\t\s*?
', "i"); rawRCdata = getRCDataRO.responseText.replace(cr, "").replace(lf, ""); filteredRCdata = textFilter.exec(rawRCdata); updatedText = filteredRCdata0.replace('
', "").replace(endText, ""); document.getElementById("bodyContent").innerHTML = updatedText; rcTimer = setTimeout("loadRCData();", rcRefresh); } } $(document).ready(function() { for (x in ajaxPages) { if (wgPageName == ajaxPagesx && wgAction == "view" && (typeof(window.enableAjaxRC) == 'undefined' || window.enableAjaxRC)) preloadAJAXRC(); } }); /////////////////////////////////////////////////////////////////////////////////////////////////////////// // END OF AJAX AUTO-REFRESH ///////////////////////////////////////////////////////////////////////////////////////////////////////////
'''ยท'''CategoryGeneral wiki templates|*