User:Gracey91/common.js

// AJAX RC var ajaxPages = new Array("Special:RecentChanges"); var ajaxRCOverride = false; var rcTimer; var doRefresh = true; var rcRefresh = 30000; ajaxRCCookie = (getCookie("ajaxRC")=="on"||ajaxRCOverride) ? true:false;

function ajaxRC { appTo = $(".firstHeading"); appTo.append(' AJAX:   '); $("#ajaxRCprogress").bind("ajaxSend", function { $(this).show; }).bind("ajaxComplete", function { $(this).hide; }); $("#ajaxToggle").click(toggleRC); $("#ajaxRCprogress").hide; $("#ajaxToggle").attr("checked", ajaxRCCookie); if (ajaxRCCookie) loadRCData; }

function toggleRC { if ($("#ajaxToggle").attr("checked") == true) { setCookie("ajaxRC", "on", 30); doRefresh = true; loadRCData; } else { setCookie("ajaxRC", "off", 30); doRefresh = false; clearTimeout(rcTimer); } }

function loadRCData { $(article).load(location.href + " "+article+" > *", function (data) { if (doRefresh) rcTimer = setTimeout("loadRCData;", rcRefresh); }); }

//Scripts original source is http://www.wowpedia.org/MediaWiki:Common.js?c=1