From cbd00356d869877bb95824794c231842a3406ee7 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 May 2013 20:51:37 +0200 Subject: [PATCH 01/31] Update deps. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0e7b2d796..f25a8cee5 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,10 @@ "grunt-concurrent": "~0.2.0", "grunt-contrib-clean": "~0.4.1", "grunt-contrib-coffee": "~0.7.0", - "grunt-contrib-compress": "~0.5.0", + "grunt-contrib-compress": "~0.5.1", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-copy": "~0.4.1", - "grunt-contrib-watch": "~0.4.3", + "grunt-contrib-watch": "~0.4.4", "grunt-shell": "~0.2.2" }, "repository": { From 90e40e11e750223941540a3435ad9cde4f5b92fe Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 May 2013 21:20:16 +0200 Subject: [PATCH 02/31] Fix #1131. --- src/Monitoring/Unread.coffee | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index a951be09a..b381a4441 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -44,12 +44,18 @@ Unread = break if prevID is post.ID prevID = post.ID break unless post.isHidden - onload = -> root.scrollIntoView false + onload = -> root.scrollIntoView false if checkPosition root else # Scroll to the last read post. - posts = Object.keys Unread.thread.posts - post = Unread.thread.posts[posts[posts.length - 1]] - onload = -> Header.scrollToPost post.nodes.root + posts = Object.keys Unread.thread.posts + {root} = Unread.thread.posts[posts[posts.length - 1]].nodes + onload = -> Header.scrollToPost root if checkPosition root + checkPosition = (target) -> + # Don't scroll to the target if + # - it's visible. + # - we've scrolled past it. + {top, height} = target.getBoundingClientRect() + top + height - doc.clientHeight > 0 # Prevent the browser to scroll back to # the previous scroll location on page load. $.on window, 'load', onload @@ -66,8 +72,8 @@ Unread = Unread.setLine() Unread.update() - addPosts: (newPosts) -> - for post in newPosts + addPosts: (posts) -> + for post in posts {ID} = post if ID <= Unread.lastReadPost or post.isHidden continue @@ -81,7 +87,7 @@ Unread = Unread.addPostQuotingYou post if Conf['Unread Line'] # Force line on visible threads if there were no unread posts previously. - Unread.setLine Unread.posts[0] in newPosts + Unread.setLine Unread.posts[0] in posts Unread.read() Unread.update() From 1752e15da9d79689b713ad24ca1217cd6f50ce20 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 May 2013 21:44:06 +0200 Subject: [PATCH 03/31] Close #1128. --- CHANGELOG.md | 2 ++ src/General/Config.coffee | 3 ++- src/Miscellaneous/Keybinds.coffee | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b95641c98..904b7595a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Added the `Deselect reply` keybind. + ## 3.5.0 - *2013-05-26* - The Thread Stats counters now include the number of the page where the thread is. diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 59f7230ad..f7a1e24e4 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -153,7 +153,7 @@ Config = usercss: '' hotkeys: # Header, QR & Options - 'Toggle board list': ['Ctrl+b', 'Toggle the full board list.'] + 'Toggle board list': ['Ctrl+b', 'Toggle the full board list.'] 'Open empty QR': ['q', 'Open QR without post number inserted.'] 'Open QR': ['Shift+q', 'Open QR with post number inserted.'] 'Open settings': ['Alt+o', 'Open Settings.'] @@ -183,6 +183,7 @@ Config = # Reply Navigation 'Next reply': ['j', 'Select next reply.'] 'Previous reply': ['k', 'Select previous reply.'] + 'Deselect reply': ['Shift+d', 'Deselect reply.'] 'Hide': ['x', 'Hide thread.'] updater: checkbox: diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index e264120d6..7f33b2b74 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -91,6 +91,8 @@ Keybinds = Keybinds.hl +1, threadRoot when Conf['Previous reply'] Keybinds.hl -1, threadRoot + when Conf['Deselect reply'] + Keybinds.hl 0, threadRoot when Conf['Hide'] ThreadHiding.toggle thread if g.VIEW is 'index' else @@ -166,6 +168,10 @@ Keybinds = location.href = url hl: (delta, thread) -> + unless delta + if postEl = $ '.reply.highlight', thread + $.rmClass postEl, 'highlight' + return if Conf['Bottom header'] topMargin = 0 else From 448273441d4a68ec7fbcb317a609d3661ad373b1 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 31 May 2013 22:19:53 +0200 Subject: [PATCH 04/31] Small refactor. --- src/Monitoring/ThreadUpdater.coffee | 75 +++++++++++++++-------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index a8ab419e9..0c3f5317c 100644 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -231,43 +231,46 @@ ThreadUpdater = post.kill true deletedFiles.push post + sendEvent = -> + $.event 'ThreadUpdate', + 404: false + thread: ThreadUpdater.thread + newPosts: posts + deletedPosts: deletedPosts + deletedFiles: deletedFiles + postCount: OP.replies + 1 + fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead) + unless count ThreadUpdater.set 'status', null, null ThreadUpdater.outdateCount++ + sendEvent() + return + + ThreadUpdater.set 'status', "+#{count}", 'new' + ThreadUpdater.outdateCount = 0 + if Conf['Beep'] and d.hidden and Unread.posts and !Unread.posts.length + unless ThreadUpdater.audio + ThreadUpdater.audio = $.el 'audio', src: ThreadUpdater.beep + ThreadUpdater.audio.play() + + ThreadUpdater.lastPost = posts[count - 1].ID + Main.callbackNodes Post, posts + + scroll = Conf['Auto Scroll'] and ThreadUpdater.scrollBG() and + ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25 + $.add ThreadUpdater.root, nodes + sendEvent() + if scroll + if Conf['Bottom Scroll'] + <% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>.scrollTop = d.body.clientHeight + else + Header.scrollToPost nodes[0] + + # Enable 4chan features. + threadID = ThreadUpdater.thread.ID + {length} = $$ '.thread > .postContainer', ThreadUpdater.root + if Conf['Enable 4chan\'s Extension'] + $.globalEval "Parser.parseThread(#{threadID}, #{-count})" else - ThreadUpdater.set 'status', "+#{count}", 'new' - ThreadUpdater.outdateCount = 0 - if Conf['Beep'] and d.hidden and Unread.posts and !Unread.posts.length - unless ThreadUpdater.audio - ThreadUpdater.audio = $.el 'audio', src: ThreadUpdater.beep - ThreadUpdater.audio.play() - - ThreadUpdater.lastPost = posts[count - 1].ID - Main.callbackNodes Post, posts - - scroll = Conf['Auto Scroll'] and ThreadUpdater.scrollBG() and - ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25 - $.add ThreadUpdater.root, nodes - if scroll - if Conf['Bottom Scroll'] - <% if (type === 'crx') { %>d.body<% } else { %>doc<% } %>.scrollTop = d.body.clientHeight - else - Header.scrollToPost nodes[0] - - $.queueTask -> - # Enable 4chan features. - threadID = ThreadUpdater.thread.ID - {length} = $$ '.thread > .postContainer', ThreadUpdater.root - if Conf['Enable 4chan\'s Extension'] - $.globalEval "Parser.parseThread(#{threadID}, #{-count})" - else - Fourchan.parseThread threadID, length - count, length - - $.event 'ThreadUpdate', - 404: false - thread: ThreadUpdater.thread - newPosts: posts - deletedPosts: deletedPosts - deletedFiles: deletedFiles - postCount: OP.replies + 1 - fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead) + Fourchan.parseThread threadID, length - count, length From 982ec6ecc6bf24498c1457c5ff836cb8fff02869 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Jun 2013 17:03:49 +0200 Subject: [PATCH 05/31] Remove PSA workaround. Also this DOMAttrModified actually works. --- src/General/Main.coffee | 1 - src/Miscellaneous/PSAHiding.coffee | 12 +----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 50dabbe63..a09b9afbb 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -161,7 +161,6 @@ Main = attributes: true attributeFilter: ['href'] else - # XXX this doesn't seem to work? $.on mainStyleSheet, 'DOMAttrModified', setStyle initReady: -> diff --git a/src/Miscellaneous/PSAHiding.coffee b/src/Miscellaneous/PSAHiding.coffee index 9f69780b0..356e99532 100644 --- a/src/Miscellaneous/PSAHiding.coffee +++ b/src/Miscellaneous/PSAHiding.coffee @@ -32,17 +32,7 @@ PSAHiding = href: 'javascript:;' $.on btn, 'click', PSAHiding.toggle - # XXX remove hiddenPSAs workaround in the future. - items = - hiddenPSA: 0 - hiddenPSAs: null - - $.get items, ({hiddenPSA, hiddenPSAs}) -> - if hiddenPSAs - $.delete 'hiddenPSAs' - if psa.textContent.replace(/\W+/g, '').toLowerCase() in hiddenPSAs - hiddenPSA = +$.id('globalMessage').dataset.utc - $.set 'hiddenPSA', hiddenPSA + $.get hiddenPSA, 0, ({hiddenPSA}) -> PSAHiding.sync hiddenPSA $.before psa, btn $.rmClass doc, 'hide-announcement' From 399df131fdd16b683a8726fe3b558383afdf42b9 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Jun 2013 17:30:36 +0200 Subject: [PATCH 06/31] Test the water, see if we can start removing these workarounds. --- src/Archive/Redirect.coffee | 5 +++++ src/Filtering/Filter.coffee | 5 +++++ src/General/DataBoard.coffee | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index 3a381510a..390312af3 100644 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -11,6 +11,11 @@ Redirect = # XXX I get obscure reports of: # "Redirect" initialization crashed. TypeError: Cannot read property 'length' of undefined # comming from here. + Main.logError + message: "XXX Conf['archives'].length still failing" + error: new Error """ + Conf['archives'] === #{JSON.stringify Conf['archives']} + """ Conf['archives'] = Redirect.archives $.delete ['archives', 'lastarchivecheck'] Redirect.update() diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index 98cdbf11c..dac5df378 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -8,6 +8,11 @@ Filter = if Conf[key] is undefined # XXX hopefully tmp fix for the rare people getting this mysterious error: # "Filter" initialization crashed. TypeError: Cannot call method 'split' of undefined + Main.logError + message: 'XXX some filters are still undefined' + error: new Error """ + Conf[#{key}] === undefined + """ $.delete key continue for filter in Conf[key].split '\n' diff --git a/src/General/DataBoard.coffee b/src/General/DataBoard.coffee index 4cd054375..510bf9335 100644 --- a/src/General/DataBoard.coffee +++ b/src/General/DataBoard.coffee @@ -60,6 +60,12 @@ class DataBoard # XXX tmp fix for users that had the `null` # value for a board with the Unread features: if typeof @data.boards[boardID] isnt 'object' + Main.logError + message: 'XXX weird DataBoard values' + error: new Error """ + @key === #{@key} + @data.boards[#{boardID}] === #{@data.boards[boardID]} + """ delete @data.boards[boardID] else @deleteIfEmpty {boardID} From 30b435133e8ff115947cf266692131081aa41f42 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Jun 2013 17:46:25 +0200 Subject: [PATCH 07/31] Let's see what body>.desktop elements are there when the #boardNavDesktop is null --- src/General/Header.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/General/Header.coffee b/src/General/Header.coffee index d873adf0f..e826a9bb5 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -100,6 +100,12 @@ Header = innerHTML: ' - ' $.on btn, 'click', Header.toggleBoardList $.add fullBoardList, btn + else + Main.logError + message: "Header crash: nav is null" + error: new Error """ + #{$$('body > .desktop').map((el) -> el.id).join ','} + """ Header.setCustomNav Conf['Custom Board Navigation'] Header.generateBoardList Conf['boardnav'] From 2e0e15b59dd64b2818ab6632f4333eaa57def6c4 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Jun 2013 17:49:22 +0200 Subject: [PATCH 08/31] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 904b7595a..334c936f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - Added the `Deselect reply` keybind. +- Minor fixes. ## 3.5.0 - *2013-05-26* From 2200a3ce523e631084bd7e586958d8db01b55367 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Jun 2013 17:49:59 +0200 Subject: [PATCH 09/31] Release 4chan X v3.5.1. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 334c936f6..f0b70238e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.5.1 - *2013-06-01* + - Added the `Deselect reply` keybind. - Minor fixes. diff --git a/package.json b/package.json index f25a8cee5..89216fd15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.5.0", + "version": "3.5.1", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From 8251b4677863665679ac71bed2e90aa5b4913b00 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Jun 2013 20:55:33 +0200 Subject: [PATCH 10/31] typo --- 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 356e99532..f215f2c1b 100644 --- a/src/Miscellaneous/PSAHiding.coffee +++ b/src/Miscellaneous/PSAHiding.coffee @@ -32,7 +32,7 @@ PSAHiding = href: 'javascript:;' $.on btn, 'click', PSAHiding.toggle - $.get hiddenPSA, 0, ({hiddenPSA}) -> + $.get 'hiddenPSA', 0, ({hiddenPSA}) -> PSAHiding.sync hiddenPSA $.before psa, btn $.rmClass doc, 'hide-announcement' From 757bd220b5e7b578438de2fa7e3c40a3c194cab9 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Jun 2013 20:56:13 +0200 Subject: [PATCH 11/31] Release 4chan X v3.5.2. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0b70238e..f101db181 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.5.2 - *2013-06-01* + ### 3.5.1 - *2013-06-01* - Added the `Deselect reply` keybind. diff --git a/package.json b/package.json index 89216fd15..8fe9dafce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.5.1", + "version": "3.5.2", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From b42ab994af448d2dffab87ae7b143d30bbc51bc7 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 1 Jun 2013 20:57:53 +0200 Subject: [PATCH 12/31] Changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f101db181..30127e318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ### 3.5.2 - *2013-06-01* +- Fix minor regression. + ### 3.5.1 - *2013-06-01* - Added the `Deselect reply` keybind. From d772180f0f5bc0467ca39f317dce172aa2623f34 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 3 Jun 2013 22:26:55 +0200 Subject: [PATCH 13/31] Filter and Redirect crashes seem related: missing values in the Conf object, only on Chrome: bug in the extension storage API? Not seeing any databoard errors anymore. Zero `body > .desktop` elements, both on Chrome and Firefox, no clue what's going on. --- src/Archive/Redirect.coffee | 15 --------------- src/Filtering/Filter.coffee | 10 ---------- src/General/DataBoard.coffee | 13 +------------ src/General/Header.coffee | 6 ------ 4 files changed, 1 insertion(+), 43 deletions(-) diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index 390312af3..3e4ef732e 100644 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -5,21 +5,6 @@ Redirect = file: {} init: -> - try - Conf['archives'].length - catch err - # XXX I get obscure reports of: - # "Redirect" initialization crashed. TypeError: Cannot read property 'length' of undefined - # comming from here. - Main.logError - message: "XXX Conf['archives'].length still failing" - error: new Error """ - Conf['archives'] === #{JSON.stringify Conf['archives']} - """ - Conf['archives'] = Redirect.archives - $.delete ['archives', 'lastarchivecheck'] - Redirect.update() - for boardID, data of Conf['selectedArchives'] for type, uid of data for archive in Conf['archives'] diff --git a/src/Filtering/Filter.coffee b/src/Filtering/Filter.coffee index dac5df378..8ac6e18c9 100644 --- a/src/Filtering/Filter.coffee +++ b/src/Filtering/Filter.coffee @@ -5,16 +5,6 @@ Filter = for key of Config.filter @filters[key] = [] - if Conf[key] is undefined - # XXX hopefully tmp fix for the rare people getting this mysterious error: - # "Filter" initialization crashed. TypeError: Cannot call method 'split' of undefined - Main.logError - message: 'XXX some filters are still undefined' - error: new Error """ - Conf[#{key}] === undefined - """ - $.delete key - continue for filter in Conf[key].split '\n' continue if filter[0] is '#' diff --git a/src/General/DataBoard.coffee b/src/General/DataBoard.coffee index 510bf9335..1fa9f742f 100644 --- a/src/General/DataBoard.coffee +++ b/src/General/DataBoard.coffee @@ -57,18 +57,7 @@ class DataBoard clean: -> for boardID, val of @data.boards - # XXX tmp fix for users that had the `null` - # value for a board with the Unread features: - if typeof @data.boards[boardID] isnt 'object' - Main.logError - message: 'XXX weird DataBoard values' - error: new Error """ - @key === #{@key} - @data.boards[#{boardID}] === #{@data.boards[boardID]} - """ - delete @data.boards[boardID] - else - @deleteIfEmpty {boardID} + @deleteIfEmpty {boardID} now = Date.now() if (@data.lastChecked or 0) < now - 2 * $.HOUR diff --git a/src/General/Header.coffee b/src/General/Header.coffee index e826a9bb5..d873adf0f 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -100,12 +100,6 @@ Header = innerHTML: ' - ' $.on btn, 'click', Header.toggleBoardList $.add fullBoardList, btn - else - Main.logError - message: "Header crash: nav is null" - error: new Error """ - #{$$('body > .desktop').map((el) -> el.id).join ','} - """ Header.setCustomNav Conf['Custom Board Navigation'] Header.generateBoardList Conf['boardnav'] From eeb5d974dd2218769bb791b7c33e19812ce9b198 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 4 Jun 2013 16:41:22 +0200 Subject: [PATCH 14/31] v3 doesn't support browsers with prefixed MutationObservers. --- src/General/Main.coffee | 2 +- src/Posting/QR.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index a09b9afbb..36ca8436b 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -155,7 +155,7 @@ Main = $.addClass doc, style setStyle() return unless mainStyleSheet - if MutationObserver = window.MutationObserver or window.WebKitMutationObserver or window.OMutationObserver + if MutationObserver observer = new MutationObserver setStyle observer.observe mainStyleSheet, attributes: true diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index f219575ec..1c260737a 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -703,7 +703,7 @@ QR = img: imgContainer.firstChild input: input - if MutationObserver = window.MutationObserver or window.WebKitMutationObserver or window.OMutationObserver + if MutationObserver observer = new MutationObserver @load.bind @ observer.observe @nodes.challenge, childList: true From dbdb8db61cabdc2cdea7f1d749a941306f422694 Mon Sep 17 00:00:00 2001 From: noface Date: Wed, 5 Jun 2013 00:27:43 +0200 Subject: [PATCH 15/31] =?UTF-8?q?spoiler=20=E2=86=92=20s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/General/Get.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/General/Get.coffee b/src/General/Get.coffee index d246493b0..781b066fa 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -163,9 +163,9 @@ Get = when '[/b]' '' when '[spoiler]' - '' + '' when '[/spoiler]' - '' + '' when '[code]' '
'
           when '[/code]'

From b6d00257fad11361950b36a3c81d3c29d6db0d22 Mon Sep 17 00:00:00 2001
From: Mayhem 
Date: Thu, 6 Jun 2013 17:16:06 +0200
Subject: [PATCH 16/31] "Fix" #1139.

---
 src/General/Header.coffee | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/General/Header.coffee b/src/General/Header.coffee
index d873adf0f..863e5c987 100644
--- a/src/General/Header.coffee
+++ b/src/General/Header.coffee
@@ -242,7 +242,7 @@ Header =
     $('input[name=boardnav]', settings).focus()
 
   hashScroll: ->
-    return unless post = $.id @location.hash[1..]
+    return unless (hash = @location.hash[1..]) and post = $.id hash
     return if (Get.postFromRoot post).isHidden
     Header.scrollToPost post
   scrollToPost: (post) ->

From e9f3b512b5b34d15d00581a1f0a7d102912ba6ed Mon Sep 17 00:00:00 2001
From: Mayhem 
Date: Fri, 7 Jun 2013 14:01:41 +0200
Subject: [PATCH 17/31] Fix #1144.

---
 src/General/Build.coffee | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/General/Build.coffee b/src/General/Build.coffee
index f24e7ad5e..786e931fb 100644
--- a/src/General/Build.coffee
+++ b/src/General/Build.coffee
@@ -112,7 +112,7 @@ Build =
         ''
 
     if file?.isDeleted
-      fileHtml = if isOP
+      fileHTML = if isOP
         "
" + "File deleted." + "
" From 5ab212fa79199a270ad7eef3f1b9db19e79d4640 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 7 Jun 2013 14:59:38 +0200 Subject: [PATCH 18/31] Remove the only -o-prefixed CSS property as it will never exist. --- css/style.css | 1 - 1 file changed, 1 deletion(-) diff --git a/css/style.css b/css/style.css index c364037d5..1baa06d03 100644 --- a/css/style.css +++ b/css/style.css @@ -663,7 +663,6 @@ a.hide-announcement { position: relative; -webkit-user-select: none; -moz-user-select: none; - -o-user-select: none; user-select: none; } #dump-list { From f589fb127247b926d779fd6267b0d69237093f56 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 8 Jun 2013 19:42:30 +0200 Subject: [PATCH 19/31] warosu doesn't archive /s4s/ anymore. --- json/archives.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json/archives.json b/json/archives.json index 055da85b2..4bd0477bf 100644 --- a/json/archives.json +++ b/json/archives.json @@ -104,6 +104,6 @@ "http": true, "https": true, "software": "fuuka", - "boards": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "s4s", "tg", "vr"], - "files": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "s4s", "vr"] + "boards": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "tg", "vr"], + "files": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "vr"] }] From 336e69c4fef3b579dfe67218496a78ba569d104f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 8 Jun 2013 20:20:59 +0200 Subject: [PATCH 20/31] No need to use   to preserve whitespaces anymore. --- src/Miscellaneous/Fourchan.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Miscellaneous/Fourchan.coffee b/src/Miscellaneous/Fourchan.coffee index 4e1073d72..edb2fd36b 100644 --- a/src/Miscellaneous/Fourchan.coffee +++ b/src/Miscellaneous/Fourchan.coffee @@ -7,7 +7,7 @@ Fourchan = $.globalEval """ window.addEventListener('prettyprint', function(e) { var pre = e.detail; - pre.innerHTML = prettyPrintOne(pre.innerHTML.replace(/\\s/g, ' ')); + pre.innerHTML = prettyPrintOne(pre.innerHTML); }, false); """ Post::callbacks.push From 45fcd8f59dc66d09e7c0302d172e49fae54e3887 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 8 Jun 2013 20:46:15 +0200 Subject: [PATCH 21/31] Safer DB.set --- src/General/DataBoard.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/General/DataBoard.coffee b/src/General/DataBoard.coffee index 1fa9f742f..bbdbbccac 100644 --- a/src/General/DataBoard.coffee +++ b/src/General/DataBoard.coffee @@ -31,9 +31,9 @@ class DataBoard else unless Object.keys(@data.boards[boardID]).length delete @data.boards[boardID] set: ({boardID, threadID, postID, val}) -> - if postID + if postID isnt undefined ((@data.boards[boardID] or= {})[threadID] or= {})[postID] = val - else if threadID + else if threadID isnt undefined (@data.boards[boardID] or= {})[threadID] = val else @data.boards[boardID] = val From 5c5894198d8465021d5f0839090bbff075ea29de Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 8 Jun 2013 21:04:23 +0200 Subject: [PATCH 22/31] Log `chrome.runtime.lastError`s when getting. Don't reset `items`, no need to. crbug.com/245798 --- lib/$.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/$.coffee b/lib/$.coffee index a37a9c494..8a8b23f0e 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -263,9 +263,10 @@ $.get = (key, val, cb) -> else (syncItems or= {})[key] = val - items = {} count = 0 done = (item) -> + if chrome.runtime.lastError + c.error chrome.runtime.lastError $.extend items, item cb items unless --count From 598bbb82741846d1d43cdb8d13d7ab7b35022c48 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 8 Jun 2013 21:08:03 +0200 Subject: [PATCH 23/31] Log the message too. --- lib/$.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index 8a8b23f0e..74b76e04c 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -265,8 +265,9 @@ $.get = (key, val, cb) -> count = 0 done = (item) -> - if chrome.runtime.lastError - c.error chrome.runtime.lastError + {lastError} = chrome.runtime + if lastError + c.error lastError, lastError.message or 'No message.' $.extend items, item cb items unless --count From 029a2dac2cbbd5d19ff189391ca284c151ebd35c Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 10 Jun 2013 17:25:15 +0200 Subject: [PATCH 24/31] Close #1147. --- src/General/Main.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 36ca8436b..5582ffdfe 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -55,7 +55,7 @@ Main = URL = Redirect.to 'file', boardID: g.BOARD.ID filename: pathname[pathname.length - 1] - location.href = URL if URL + location.replace URL if URL return initFeature = (name, module) -> @@ -170,7 +170,7 @@ Main = boardID: g.BOARD.ID threadID: g.THREADID postID: +location.hash.match /\d+/ # post number or 0 - location.href = href or "/#{g.BOARD}/" + location.replace href or "/#{g.BOARD}/" return unless $.hasClass doc, 'fourchan-x' From 0f742f0d0baa5a8d40be4b7f98a46c7603fed7ee Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Jun 2013 17:03:13 +0200 Subject: [PATCH 25/31] Show "Dead" instead of the page number when the thread 404s. --- src/Monitoring/ThreadStats.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Monitoring/ThreadStats.coffee b/src/Monitoring/ThreadStats.coffee index 8b0b2e55f..cfe1658a7 100644 --- a/src/Monitoring/ThreadStats.coffee +++ b/src/Monitoring/ThreadStats.coffee @@ -35,7 +35,10 @@ ThreadStats = (if thread.postLimit and !thread.isSticky then $.addClass else $.rmClass) postCountEl, 'warning' (if thread.fileLimit and !thread.isSticky then $.addClass else $.rmClass) fileCountEl, 'warning' fetchPage: -> - return if ThreadStats.thread.isDead + if ThreadStats.thread.isDead + ThreadStats.pageCountEl.textContent = 'Dead' + $.addClass ThreadStats.pageCountEl, 'warning' + return setTimeout ThreadStats.fetchPage, 2 * $.MINUTE $.ajax "//api.4chan.org/#{ThreadStats.thread.board}/threads.json", onload: ThreadStats.onThreadsLoad, headers: 'If-Modified-Since': ThreadStats.lastModified From dc2ed6f6f35c784fc3705b54281e22a52cddf559 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Jun 2013 17:34:55 +0200 Subject: [PATCH 26/31] Fix captcha support in the report window. Also shave a line. --- src/Miscellaneous/Report.coffee | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Miscellaneous/Report.coffee b/src/Miscellaneous/Report.coffee index eea172ddc..af505998d 100644 --- a/src/Miscellaneous/Report.coffee +++ b/src/Miscellaneous/Report.coffee @@ -1,14 +1,13 @@ Report = init: -> - return unless /report/.test location.search - $.ready @ready + return unless /report/.test(location.search) and d.cookie.indexOf('pass_enabled=1') is -1 + $.asap (-> $.id 'recaptcha_response_field'), Report.ready ready: -> - form = $ 'form' field = $.id 'recaptcha_response_field' $.on field, 'keydown', (e) -> $.globalEval 'Recaptcha.reload("t")' if e.keyCode is 8 and not field.value - $.on form, 'submit', (e) -> + $.on $('form'), 'submit', (e) -> e.preventDefault() response = field.value.trim() field.value = "#{response} #{response}" unless /\s/.test response - form.submit() + @submit() From e155e001d41dc613f9e80ed4e992fc6b30e51b46 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Jun 2013 17:37:07 +0200 Subject: [PATCH 27/31] Changelog. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30127e318..ae1ba5b47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Minor fixes. + ### 3.5.2 - *2013-06-01* - Fix minor regression. From 81e36308f2787525b3d8f151deb159975af2e9b3 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Jun 2013 17:37:22 +0200 Subject: [PATCH 28/31] Release 4chan X v3.5.3. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae1ba5b47..8aeb3ba6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.5.3 - *2013-06-11* + - Minor fixes. ### 3.5.2 - *2013-06-01* diff --git a/package.json b/package.json index 8fe9dafce..513294d07 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.5.2", + "version": "3.5.3", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From d8f08ce07e9d7f5f85bf0f947f0423aa1eae1f8e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Jun 2013 20:52:35 +0200 Subject: [PATCH 29/31] Fix #1154. --- src/General/Main.coffee | 2 +- src/Posting/QR.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 5582ffdfe..95333e029 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -155,7 +155,7 @@ Main = $.addClass doc, style setStyle() return unless mainStyleSheet - if MutationObserver + if window.MutationObserver observer = new MutationObserver setStyle observer.observe mainStyleSheet, attributes: true diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 1c260737a..dec55d596 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -703,7 +703,7 @@ QR = img: imgContainer.firstChild input: input - if MutationObserver + if window.MutationObserver observer = new MutationObserver @load.bind @ observer.observe @nodes.challenge, childList: true From 9728de55ac1193e278014328df7ce213e11ede0c Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Jun 2013 20:52:46 +0200 Subject: [PATCH 30/31] Release 4chan X v3.5.4. --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aeb3ba6f..3a9b0026d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### 3.5.4 - *2013-06-11* + ### 3.5.3 - *2013-06-11* - Minor fixes. diff --git a/package.json b/package.json index 513294d07..0c838ac45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "3.5.3", + "version": "3.5.4", "description": "Cross-browser extension for productive lurking on 4chan.", "meta": { "name": "4chan X", From e21d1ac59b12f56a06aa544efa2f68955833fa00 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Jun 2013 20:55:49 +0200 Subject: [PATCH 31/31] Changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a9b0026d..01fcd2492 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ### 3.5.4 - *2013-06-11* +- Fix regression. + ### 3.5.3 - *2013-06-11* - Minor fixes.