Added stopping automatic reloads with Ctrl-Space. Will stay stopped till next Ctrl-Space.

This commit is contained in:
zottel 2011-12-06 00:00:27 -08:00
parent ced28a8827
commit c5c99089ff

View file

@ -16,12 +16,12 @@
document.getElementById(theID).style.display = "none" document.getElementById(theID).style.display = "none"
} }
var src = null; var src = null;
var prev = null; var prev = null;
var livetime = null; var livetime = null;
var msie = false; var msie = false;
var stopped = false; var stopped = false;
var totStopped = false;
var timer = null; var timer = null;
var pr = 0; var pr = 0;
var liking = 0; var liking = 0;
@ -148,26 +148,26 @@
NavUpdate(); NavUpdate();
// Allow folks to stop the ajax page updates with the pause/break key // Allow folks to stop the ajax page updates with the pause/break key
$(document).keypress(function(event) { $(document).keydown(function(event) {
if(event.keyCode == '19') { if(event.keyCode == '19' || (event.ctrlKey && event.which == '32')) {
event.preventDefault(); event.preventDefault();
if(stopped == false) { if(stopped == false) {
stopped = true; stopped = true;
if (event.ctrlKey) {
totStopped = true;
}
$('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />'); $('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
} else {
stopped = false;
totStopped = false;
$('#pause').html('');
} }
else { } else {
if (!totStopped) {
stopped = false; stopped = false;
$('#pause').html(''); $('#pause').html('');
} }
} }
else {
// any key to resume
if(stopped == true) {
stopped = false;
$('#pause').html('');
}
}
}); });