From 6d59cc03f1a1aff13289ebeac5065acf3d0f8f67 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Tue, 19 Mar 2013 09:52:19 -0700 Subject: [PATCH] We need to go deeper --- 4chan-X.user.js | 5 +---- lib/polyfill.coffee | 13 +++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/4chan-X.user.js b/4chan-X.user.js index faac376ed..197c6efb8 100644 --- a/4chan-X.user.js +++ b/4chan-X.user.js @@ -1109,10 +1109,7 @@ visibility: function() { var event, prefix, property; - if ('visibilityState' in document) { - return; - } - if (!(prefix = ('webkitVisibilityState' in document ? 'webkit' : 'mozVisibilityState' in document ? 'moz' : void 0))) { + if ('visibilityState' in document || !(prefix = ('webkitVisibilityState' in document ? 'webkit' : 'mozVisibilityState' in document ? 'moz' : void 0))) { return; } property = prefix + 'VisibilityState'; diff --git a/lib/polyfill.coffee b/lib/polyfill.coffee index 5a5b48e10..64224bfc6 100644 --- a/lib/polyfill.coffee +++ b/lib/polyfill.coffee @@ -3,12 +3,13 @@ Polyfill = Polyfill.visibility() visibility: -> # page visibility API - return if 'visibilityState' of document - return unless prefix = ( - if 'webkitVisibilityState' of document - 'webkit' - else if 'mozVisibilityState' of document - 'moz' + return if 'visibilityState' of document or not ( + prefix = ( + if 'webkitVisibilityState' of document + 'webkit' + else if 'mozVisibilityState' of document + 'moz' + ) ) property = prefix + 'VisibilityState'