From afcc55b2c84f6d27854eeefd197ac5c0310e2f4a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 6 Mar 2012 19:53:43 +0100 Subject: [PATCH] Fix indentation and next.focus() -> td.focus(). --- 4chan_x.user.js | 30 +++++++++++++++--------------- script.coffee | 22 +++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index df8a142e6..e3d87e523 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1167,24 +1167,24 @@ rect = td.getBoundingClientRect(); if (rect.bottom >= 0 && rect.top <= d.body.clientHeight) { next = delta === +1 ? $.x('following::td[@class="reply"]', td) : $.x('preceding::td[@class="reply"]', td); - } - if (!next) { - td.className = 'replyhl'; - td.tabIndex = 0; + if (!next) { + td.className = 'replyhl'; + td.tabIndex = 0; + td.focus(); + return; + } + if (!(g.REPLY || $.x('ancestor::div[@class="thread"]', next) === thread)) { + return; + } + rect = next.getBoundingClientRect(); + if (rect.top < 0 || rect.bottom > d.body.clientHeight) { + next.scrollIntoView(delta === -1); + } + next.className = 'replyhl'; + next.tabIndex = 0; next.focus(); return; } - if (!(g.REPLY || $.x('ancestor::div[@class="thread"]', next) === thread)) { - return; - } - rect = next.getBoundingClientRect(); - if (rect.top < 0 || rect.bottom > d.body.clientHeight) { - next.scrollIntoView(delta === -1); - } - next.className = 'replyhl'; - next.tabIndex = 0; - next.focus(); - return; } replies = $$('.reply', thread); if (delta === -1) replies.reverse(); diff --git a/script.coffee b/script.coffee index 4e4fe1e41..f8a03c54a 100644 --- a/script.coffee +++ b/script.coffee @@ -954,19 +954,19 @@ Keybinds = $.x 'following::td[@class="reply"]', td else $.x 'preceding::td[@class="reply"]', td - unless next - td.className = 'replyhl' - td.tabIndex = 0 + unless next + td.className = 'replyhl' + td.tabIndex = 0 + td.focus() + return + return unless g.REPLY or $.x('ancestor::div[@class="thread"]', next) is thread + rect = next.getBoundingClientRect() + if rect.top < 0 or rect.bottom > d.body.clientHeight + next.scrollIntoView delta is -1 + next.className = 'replyhl' + next.tabIndex = 0 next.focus() return - return unless g.REPLY or $.x('ancestor::div[@class="thread"]', next) is thread - rect = next.getBoundingClientRect() - if rect.top < 0 or rect.bottom > d.body.clientHeight - next.scrollIntoView delta is -1 - next.className = 'replyhl' - next.tabIndex = 0 - next.focus() - return replies = $$ '.reply', thread replies.reverse() if delta is -1