From d583c74049de491a0ee3957bbfd2546ab1896cd7 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 22 Jul 2013 11:48:20 +0200 Subject: [PATCH 1/5] Add the error name and error message in Firefox error reports. Chrome gives the error name and error message in the stack trace already. Also, no need to check `if stack` since we already filter them. --- src/General/Main.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 09fe39241..197e7aa50 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -332,16 +332,18 @@ Main = postErrors: -> return if Main.v2Detected errors = Main.errors.filter((d) -> !!d.error.stack).map((d) -> - {stack} = d.error <% if (type === 'userscript') { %> # Before: # someFn@file:///C:/Users//AppData/Roaming/Mozilla/Firefox/Profiles/.default/gm_scripts/4chan_X/4chan-X.user.js:line_number # someFn@file:///home//.mozilla/firefox/.default/gm_scripts/4chan_X/4chan-X.user.js:line_number # After: # someFn@4chan-X.user.js:line_number - stack = stack.replace /file:\/{3}.+\//g, '' if stack + {name, message, stack} = d.error + stack = stack.replace /file:\/{3}.+\//g, '' + "#{d.message} #{name}: #{message} #{stack}" + <% } else { %> + "#{d.message} #{d.error.stack}" <% } %> - "#{d.message} #{stack}" ).join '\n' return unless errors $.ajax '<%= meta.page %>errors', {}, From b628cd7ebae34e1b62793730afce20eb38a1486b Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 22 Jul 2013 15:06:44 +0200 Subject: [PATCH 2/5] Faster Post::parseQuotes What changed is about 3~4 times faster now. Resulting code is also less complex. --- src/General/Post.coffee | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/General/Post.coffee b/src/General/Post.coffee index e78c6ac4f..0f486e997 100644 --- a/src/General/Post.coffee +++ b/src/General/Post.coffee @@ -78,25 +78,26 @@ class Post parseQuotes: -> quotes = {} for quotelink in $$ '.quotelink', @nodes.comment - # Don't add board links. (>>>/b/) - {hash} = quotelink - continue unless hash - - # Don't add catalog links. (>>>/b/catalog or >>>/b/search) - {pathname} = quotelink - continue if /catalog$/.test pathname - - # Don't add rules links. (>>>/a/rules) - # Don't add text-board quotelinks. (>>>/img/1234) - continue if quotelink.hostname isnt 'boards.4chan.org' + # Only add quotes that link to posts on an imageboard. + # Don't add: + # - board links. (>>>/b/) + # - catalog links. (>>>/b/catalog or >>>/b/search) + # - rules links. (>>>/a/rules) + # - text-board quotelinks. (>>>/img/1234) + continue unless match = quotelink.href.match /// + boards\.4chan\.org/ + ([^/]+) # boardID + /res/\d+#p + (\d+) # postID + $ + /// @nodes.quotelinks.push quotelink # Don't count capcode replies as quotes in OPs. (Admin/Mod/Dev Replies: ...) continue if !@isReply and $.hasClass quotelink.parentNode.parentNode, 'capcodeReplies' - # Basically, only add quotes that link to posts on an imageboard. - quotes["#{pathname.split('/')[1]}.#{hash[2..]}"] = true + quotes["#{match[1]}.#{match[2]}"] = true return if @isClone @quotes = Object.keys quotes From a344ef4afa6853ec3e111dd12c7e7af0af440115 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 22 Jul 2013 15:31:23 +0200 Subject: [PATCH 3/5] Faster Post::parseQuotes What changed is 4~6 times faster. --- src/General/Post.coffee | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/General/Post.coffee b/src/General/Post.coffee index 0f486e997..1d94ec6bd 100644 --- a/src/General/Post.coffee +++ b/src/General/Post.coffee @@ -76,7 +76,7 @@ class Post @info.comment = text.join('').trim().replace /\s+$/gm, '' parseQuotes: -> - quotes = {} + @quotes = [] for quotelink in $$ '.quotelink', @nodes.comment # Only add quotes that link to posts on an imageboard. # Don't add: @@ -95,11 +95,12 @@ class Post @nodes.quotelinks.push quotelink # Don't count capcode replies as quotes in OPs. (Admin/Mod/Dev Replies: ...) - continue if !@isReply and $.hasClass quotelink.parentNode.parentNode, 'capcodeReplies' - - quotes["#{match[1]}.#{match[2]}"] = true - return if @isClone - @quotes = Object.keys quotes + continue if @isClone or !@isReply and $.hasClass quotelink.parentNode.parentNode, 'capcodeReplies' + + # ES6 Set when? + fullID = "#{match[1]}.#{match[2]}" + @quotes.push fullID if @quotes.indexOf(fullID) is -1 + return parseFile: (that) -> return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl From d0dac27ca713462b7a1568e40076d0007fcca0d8 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 22 Jul 2013 15:37:25 +0200 Subject: [PATCH 4/5] Factor Post::parseQuote out of Post::parseQuotes --- src/General/Post.coffee | 47 ++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/General/Post.coffee b/src/General/Post.coffee index 1d94ec6bd..7faf5f343 100644 --- a/src/General/Post.coffee +++ b/src/General/Post.coffee @@ -78,29 +78,32 @@ class Post parseQuotes: -> @quotes = [] for quotelink in $$ '.quotelink', @nodes.comment - # Only add quotes that link to posts on an imageboard. - # Don't add: - # - board links. (>>>/b/) - # - catalog links. (>>>/b/catalog or >>>/b/search) - # - rules links. (>>>/a/rules) - # - text-board quotelinks. (>>>/img/1234) - continue unless match = quotelink.href.match /// - boards\.4chan\.org/ - ([^/]+) # boardID - /res/\d+#p - (\d+) # postID - $ - /// - - @nodes.quotelinks.push quotelink - - # Don't count capcode replies as quotes in OPs. (Admin/Mod/Dev Replies: ...) - continue if @isClone or !@isReply and $.hasClass quotelink.parentNode.parentNode, 'capcodeReplies' - - # ES6 Set when? - fullID = "#{match[1]}.#{match[2]}" - @quotes.push fullID if @quotes.indexOf(fullID) is -1 + @parseQuote quotelink return + + parseQuote: (quotelink) -> + # Only add quotes that link to posts on an imageboard. + # Don't add: + # - board links. (>>>/b/) + # - catalog links. (>>>/b/catalog or >>>/b/search) + # - rules links. (>>>/a/rules) + # - text-board quotelinks. (>>>/img/1234) + return unless match = quotelink.href.match /// + boards\.4chan\.org/ + ([^/]+) # boardID + /res/\d+#p + (\d+) # postID + $ + /// + + @nodes.quotelinks.push quotelink + + # Don't count capcode replies as quotes in OPs. (Admin/Mod/Dev Replies: ...) + return if @isClone or !@isReply and $.hasClass quotelink.parentNode.parentNode, 'capcodeReplies' + + # ES6 Set when? + fullID = "#{match[1]}.#{match[2]}" + @quotes.push fullID if @quotes.indexOf(fullID) is -1 parseFile: (that) -> return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl From 282f0b8639a47044cfbbf70890c3a820f4c906a6 Mon Sep 17 00:00:00 2001 From: Enzo Moretti Date: Mon, 22 Jul 2013 22:29:45 +0200 Subject: [PATCH 5/5] Readding /v/ to Foolz Archive --- json/archives.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/archives.json b/json/archives.json index 59efbf14a..8fd76aebf 100644 --- a/json/archives.json +++ b/json/archives.json @@ -5,7 +5,7 @@ "http": true, "https": true, "software": "foolfuuka", - "boards": ["a", "co", "gd", "jp", "m", "q", "sp", "tg", "tv", "vg", "vp", "vr", "wsg"], + "boards": ["a", "co", "gd", "jp", "m", "q", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"], "files": ["a", "gd", "jp", "m", "q", "tg", "vg", "vp", "vr", "wsg"] }, { "uid": 1,