MediaWiki:Gadget-RecentChangesRefresh.js: Difference between revisions

From Halopedia, the Halo wiki

No edit summary
mNo edit summary
Line 1: Line 1:
// Code courtesy of pcj of WoWWiki.
// Auto-refresh recent changes
// This is a modified version of the WoWWiki site version.
// Code courtesy of pcj of WoWWiki
 
// Modified to support the Nimbus skin
// Code adds a checkbox at the top of the Special:RecentChanges list, next to the header.
// Ticking it sets a cookie (should be individual to wikis) and starts updating the RC list.
// This occurs silently every 30 seconds without a full page reload occurring.


var rcRefresh = 30000;
var rcRefresh = 30000;
Line 30: Line 27:


function ajaxRC() {
function ajaxRC() {
$(appTo).append('&nbsp;<span style="position:absolute; margin-left:10px;"><span style="font-size: xx-small; cursor:help;" title="Automatically refresh the current page every ' + Math.floor(rcRefresh / 1000) + ' seconds">AUTO-REFRESH:</span><input type="checkbox" id="autoRefreshToggle"><span style="position:relative; left:5px;" id="autoRefreshProgress"><img src="/images/loader.gif" border="0" alt="AJAX operation in progress" /></span></span>');
$(appTo).append('&nbsp;<span style="position:absolute; margin-left:10px;"><span style="font-size:xx-small; cursor:help;" title="Automatically refresh the current page every ' + Math.floor(rcRefresh / 1000) + ' seconds">AUTO-REFRESH:</span><input type="checkbox" id="autoRefreshToggle"><span style="position:relative; left:5px;" id="autoRefreshProgress"><img src="/images/loader.gif" border="0" alt="AJAX operation in progress" /></span></span>');
$('#autoRefreshToggle').click(function () {
$('#autoRefreshToggle').click(function () {
setCookie('ajaxRC', $('#autoRefreshToggle').prop('checked') ? 'on' : 'off');
setCookie('ajaxRC', $('#autoRefreshToggle').prop('checked') ? 'on' : 'off');