From 05cb2fcd3ce54a5b589d1202d0eac4b8fd064bd6 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 11 Jul 2012 15:53:51 +0200 Subject: [PATCH] Don't reset the inactive counter when we focus OUT of a tab. derp --- 4chan_x.user.js | 6 ++++++ script.coffee | 2 ++ 2 files changed, 8 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index d0839b048..c0b494d22 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2877,6 +2877,12 @@ } $.add(d.body, dialog); return $.on(d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', function() { + var state; + state = d.visibilityState || d.oVisibilityState || d.mozVisibilityState || d.webkitVisibilityState; + if (state !== 'visible') { + return; + } + $.log(state); Updater.unsuccessfulFetchCount = 0; if (Updater.timer.textContent < -Conf['Interval']) { return Updater.timer.textContent = -Updater.getInterval(); diff --git a/script.coffee b/script.coffee index a124d09f6..254c92f04 100644 --- a/script.coffee +++ b/script.coffee @@ -2306,6 +2306,8 @@ Updater = $.add d.body, dialog $.on d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', -> + state = d.visibilityState or d.oVisibilityState or d.mozVisibilityState or d.webkitVisibilityState + return if state isnt 'visible' # Reset the counter when we focus this tab. Updater.unsuccessfulFetchCount = 0 if Updater.timer.textContent < -Conf['Interval']