Reload Every

By Glendon Last update Feb 15, 2008 — Installed 1,371 times. Daily Installs: 0, 1, 5, 1, 1, 1, 0, 0, 3, 1, 5, 6, 1, 2, 2, 1, 2, 0, 3, 2, 3, 2, 2, 3, 3, 5, 1, 2, 2, 8, 4, 5
// ==UserScript==
// @name           Reload Every
// @namespace      http://www.dp.cx/userscripts
// @include        http://www.goblinz.net/bank
// ==/UserScript==

var thepage = location.href;
var timeout = GM_getValue('timeout'+thepage, 3600); // this value is in seconds
var timeoutset = GM_getValue('timeoutset'+thepage,0);

if (!timeoutset) {
	timeout = prompt('How often would you like your page to reload?  This number is in seconds.', timeout);
	GM_setValue('timeout'+thepage, timeout);
	GM_setValue('timeoutset'+thepage,1);
}

setTimeout("window.location.reload()",timeout * 1000);
for(var i = timeout; i > 0; i--) {
	setTimeout("window.status='"+i+" seconds remaining'", (timeout-i)*1000);	
}

document.addEventListener('keypress', function(event) {
	// Everything is a shift combo. Ignore the search field.
	if (!event.shiftKey || event.metaKey || event.altKey || (event.target.type && event.target.type.match(/text/))) {
		return;
	}
	
	// Shift+T
	if (event.charCode == 83) {
		timeout = prompt('How often would you like your page to reload?  This number is in seconds.', timeout);
		GM_setValue('timeout'+thepage, timeout);
		GM_setValue('timeoutset'+thepage,1);
	}
}, false);