From: zottel Date: Tue, 6 Dec 2011 08:00:27 +0000 (-0800) Subject: Added stopping automatic reloads with Ctrl-Space. Will stay stopped till next Ctrl... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c5c99089ff363831f199e27c188410fec682fda5;p=friendica.git Added stopping automatic reloads with Ctrl-Space. Will stay stopped till next Ctrl-Space. --- diff --git a/js/main.js b/js/main.js index f41071ca1e..2b486bedad 100644 --- a/js/main.js +++ b/js/main.js @@ -16,12 +16,12 @@ document.getElementById(theID).style.display = "none" } - var src = null; var prev = null; var livetime = null; var msie = false; var stopped = false; + var totStopped = false; var timer = null; var pr = 0; var liking = 0; @@ -148,26 +148,26 @@ NavUpdate(); // Allow folks to stop the ajax page updates with the pause/break key - $(document).keypress(function(event) { - if(event.keyCode == '19') { + $(document).keydown(function(event) { + if(event.keyCode == '19' || (event.ctrlKey && event.which == '32')) { event.preventDefault(); if(stopped == false) { stopped = true; + if (event.ctrlKey) { + totStopped = true; + } $('#pause').html('pause'); - } - else { + } else { stopped = false; + totStopped = false; $('#pause').html(''); } - } - else { - // any key to resume - if(stopped == true) { + } else { + if (!totStopped) { stopped = false; $('#pause').html(''); } } - });