From 41b840139985b5489414840be832a652f0940ba3 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 27 May 2013 20:13:29 +0200 Subject: [PATCH 1/2] Better, simpler visibility API. No need to polyfill for Gecko anymore. --- lib/polyfill.coffee | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/polyfill.coffee b/lib/polyfill.coffee index 0c098b212..5d9ddc124 100644 --- a/lib/polyfill.coffee +++ b/lib/polyfill.coffee @@ -3,20 +3,10 @@ Polyfill = Polyfill.visibility() visibility: -> # page visibility API - return if 'visibilityState' of document - if 'webkitVisibilityState' of document - prefix = 'webkit' - else if 'mozVisibilityState' of document - prefix = 'moz' - else - return - - property = prefix + 'VisibilityState' - event = prefix + 'visibilitychange' - - d.visibilityState = d[property] - d.hidden = d.visibilityState is 'hidden' - $.on d, event, -> - d.visibilityState = d[property] - d.hidden = d.visibilityState is 'hidden' - $.event 'visibilitychange' + return unless 'webkitHidden' of document + Object.defineProperties HTMLDocument.prototype, + visibilityState: + get: -> @webkitVisibilityState + hidden: + get: -> @webkitHidden + $.on d, 'webkitvisibilitychange', -> $.event 'visibilitychange' From acd2f100c969ff68bd0902342858c17a960f0b0d Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 27 May 2013 20:26:37 +0200 Subject: [PATCH 2/2] Fix #1129. --- src/Miscellaneous/Keybinds.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index e731a8a5f..e264120d6 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -176,8 +176,11 @@ Keybinds = rect = postEl.getBoundingClientRect() if rect.bottom >= topMargin and rect.top <= doc.clientHeight # We're at least partially visible root = postEl.parentNode - next = $.x 'child::div[contains(@class,"post reply")]', - if delta is +1 then root.nextElementSibling else root.previousElementSibling + axe = if delta is +1 + 'following' + else + 'preceding' + next = $.x "#{axe}-sibling::div[contains(@class,'replyContainer')][1]/child::div[contains(@class,'reply')]", root unless next @focus postEl return