From 4c85e87d7e7b1763154ac3f10e422d73fdd1f881 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 11 Dec 2012 13:11:28 +0100 Subject: [PATCH] Don't parse catalog quotelinks. Hopefully I didn't miss any. --- 4chan_x.user.js | 24 +++++++++++++----------- script.coffee | 19 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 16c30759c..f27b0685e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -856,12 +856,13 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if ((el = $.id(quote.hash.slice(1))) && el.hidden) { - $.addClass(quote, 'filtered'); - if (Conf['Recursive Filtering'] && post.ID !== post.threadID) { - show_stub = !!$.x('preceding-sibling::div[contains(@class,"stub")]', el); - ReplyHiding.hide(post.root, show_stub); - } + if (!((el = $.id(quote.hash.slice(1))) && !/catalog$/.test(quote.pathname) && el.hidden)) { + continue; + } + $.addClass(quote, 'filtered'); + if (Conf['Recursive Filtering'] && post.ID !== post.threadID) { + show_stub = !!$.x('preceding-sibling::div[contains(@class,"stub")]', el); + ReplyHiding.hide(post.root, show_stub); } } } @@ -4024,7 +4025,7 @@ if (quote.parentNode.parentNode.className === 'capcodeReplies') { break; } - if (qid = quote.hash.slice(2)) { + if (!/catalog$/.test(quote.pathname) && (qid = quote.hash.slice(2))) { quotes[qid] = true; } } @@ -4065,7 +4066,7 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!(quote.hash || /\bdeadlink\b/.test(quote.className))) { + if (!(quote.hash && !/catalog$/.test(quote.pathname) || /\bdeadlink\b/.test(quote.className))) { continue; } $.on(quote, 'click', QuoteInline.toggle); @@ -4158,9 +4159,10 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (quote.hash || /\bdeadlink\b/.test(quote.className)) { - $.on(quote, 'mouseover', QuotePreview.mouseover); + if (!(quote.hash && !/catalog$/.test(quote.pathname) || /\bdeadlink\b/.test(quote.className))) { + continue; } + $.on(quote, 'mouseover', QuotePreview.mouseover); } _ref1 = post.backlinks; for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { @@ -4297,7 +4299,7 @@ _ref = post.quotes; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!quote.hash) { + if (!(quote.hash && !/catalog$/.test(quote.pathname))) { continue; } path = quote.pathname.split('/'); diff --git a/script.coffee b/script.coffee index 3f958fcfd..b6c6f126c 100644 --- a/script.coffee +++ b/script.coffee @@ -706,11 +706,11 @@ StrikethroughQuotes = node: (post) -> return if post.isInlined for quote in post.quotes - if (el = $.id quote.hash[1..]) and el.hidden - $.addClass quote, 'filtered' - if Conf['Recursive Filtering'] and post.ID isnt post.threadID - show_stub = !!$.x 'preceding-sibling::div[contains(@class,"stub")]', el - ReplyHiding.hide post.root, show_stub + continue unless (el = $.id quote.hash[1..]) and !/catalog$/.test(quote.pathname) and el.hidden + $.addClass quote, 'filtered' + if Conf['Recursive Filtering'] and post.ID isnt post.threadID + show_stub = !!$.x 'preceding-sibling::div[contains(@class,"stub")]', el + ReplyHiding.hide post.root, show_stub return ExpandComment = @@ -3319,7 +3319,7 @@ QuoteBacklink = # Stop at 'Admin/Mod/Dev Replies:' on /q/ break if quote.parentNode.parentNode.className is 'capcodeReplies' # Don't process >>>/b/. - if qid = quote.hash[2..] + if !/catalog$/.test(quote.pathname) and qid = quote.hash[2..] # Duplicate quotes get overwritten. quotes[qid] = true a = $.el 'a', @@ -3347,7 +3347,7 @@ QuoteInline = Main.callbacks.push @node node: (post) -> for quote in post.quotes - continue unless quote.hash or /\bdeadlink\b/.test quote.className + continue unless quote.hash and !/catalog$/.test(quote.pathname) or /\bdeadlink\b/.test quote.className $.on quote, 'click', QuoteInline.toggle for quote in post.backlinks $.on quote, 'click', QuoteInline.toggle @@ -3416,7 +3416,8 @@ QuotePreview = Main.callbacks.push @node node: (post) -> for quote in post.quotes - $.on quote, 'mouseover', QuotePreview.mouseover if quote.hash or /\bdeadlink\b/.test quote.className + continue unless quote.hash and !/catalog$/.test(quote.pathname) or /\bdeadlink\b/.test quote.className + $.on quote, 'mouseover', QuotePreview.mouseover for quote in post.backlinks $.on quote, 'mouseover', QuotePreview.mouseover return @@ -3511,7 +3512,7 @@ QuoteCT = node: (post) -> return if post.isInlined and not post.isCrosspost for quote in post.quotes - unless quote.hash + unless quote.hash and !/catalog$/.test quote.pathname # Make sure this isn't a link to the board we're on. continue path = quote.pathname.split '/'