From 3244c0f69678094f37296745548beaaa6b3d8ad6 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 26 Apr 2013 17:51:37 +0200 Subject: [PATCH 1/3] Safer hr selecting. --- src/Miscellaneous/PSAHiding.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Miscellaneous/PSAHiding.coffee b/src/Miscellaneous/PSAHiding.coffee index 4f43c25a8..9d740389d 100644 --- a/src/Miscellaneous/PSAHiding.coffee +++ b/src/Miscellaneous/PSAHiding.coffee @@ -58,7 +58,7 @@ PSAHiding = true else false - if hr = $.x 'following-sibling::hr', psa + if (hr = psa.nextElementSibling) and hr.nodeName is 'HR' hr.hidden = psa.hidden trim: (psa) -> psa.textContent.replace(/\W+/g, '').toLowerCase() From f2a9ba5a0c5b193ff0265def6f89562713d09058 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 26 Apr 2013 18:38:56 +0200 Subject: [PATCH 2/3] Fix unread count not taking into account hidden posts on page load. Fix unread freezing on page load. --- CHANGELOG.md | 2 ++ src/Monitoring/Unread.coffee | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9825f7ea..a3e89c4e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Fix bug where a thread would freeze on load. + ### 3.2.1 - *2013-04-26* - Minor fixes. diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 8d1695cfb..00231e253 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -15,26 +15,34 @@ Unread = node: -> Unread.thread = @ Unread.title = d.title - posts = [] - for ID, post of @posts - posts.push post if post.isReply Unread.lastReadPost = Unread.db.get boardID: @board.ID threadID: @ID defaultValue: 0 - Unread.addPosts posts + $.on d, '4chanXInitFinished', Unread.ready $.on d, 'ThreadUpdate', Unread.onUpdate $.on d, 'scroll visibilitychange', Unread.read $.on d, 'visibilitychange', Unread.setLine if Conf['Unread Line'] $.on window, 'load', Unread.scroll if Conf['Scroll to Last Read Post'] + ready: -> + $.off d, '4chanXInitFinished', Unread.ready + posts = [] + for ID, post of Unread.thread.posts + posts.push post if post.isReply + Unread.addPosts posts + scroll: -> # Let the header's onload callback handle it. return if (hash = location.hash.match /\d+/) and hash[0] of Unread.thread.posts if Unread.posts.length # Scroll to before the first unread post. + prevID = 0 while root = $.x 'preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root - break unless (Get.postFromRoot root).isHidden + post = Get.postFromRoot root + break if prevID is post.ID + prevID = post.ID + break unless post.isHidden root.scrollIntoView false return # Scroll to the last read post. From 16b7e46a6145566c9a582ac7c79be1d8dd078a84 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 26 Apr 2013 19:11:24 +0200 Subject: [PATCH 3/3] Fix the Cooldown description. --- src/General/Config.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index c1d1a1bad..afccfe169 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -59,7 +59,7 @@ Config = 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'] 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'] 'Hide Original Post Form': [true, 'Hide the normal post form.'] - 'Cooldown': [true, 'Prevent "flood detected" errors.'] + 'Cooldown': [true, 'Indicate the remaining time before posting again.'] 'Cooldown Prediction': [true, 'Decrease the cooldown time by taking into account upload speed. Disable it if it\'s inaccurate for you.'] 'Quote Links': 'Quote Backlinks': [true, 'Add quote backlinks.']