From 7bc8447d3f02643fc71df70fe9703efa2d1fd121 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Thu, 6 Mar 2014 21:20:26 -0700 Subject: [PATCH] Fix Quote Hash Navigation on Backlinks (again) --- builds/4chan-X.user.js | 14 +++++++++----- builds/crx/script.js | 14 +++++++++----- src/Quotelinks/QuoteBacklink.coffee | 2 ++ src/Quotelinks/QuoteInline.coffee | 5 +++-- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index d644f6fb9..b68a1bcdb 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -5263,6 +5263,9 @@ } if (Conf['Quote Inlining']) { $.on(a, 'click', QuoteInline.toggle); + if (Conf['Quote Hash Navigation']) { + QuoteInline.qiQuote(a, quoter.isHidden); + } } return frag; } @@ -5274,10 +5277,11 @@ return; } this.process = Conf['Quote Hash Navigation'] ? function(link, clone) { - if (!clone) { - $.after(link, QuoteInline.qiQuote(link, $.hasClass(link, 'filtered'))); + $.on(link, 'click', QuoteInline.toggle); + if (clone) { + return; } - return $.on(link, 'click', QuoteInline.toggle); + return QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')); } : function(link) { return $.on(link, 'click', QuoteInline.toggle); }; @@ -5310,11 +5314,11 @@ if (hidden) { name += "filtered"; } - return $.el('a', { + return $.after(link, $.el('a', { className: name, textContent: '#', href: link.href - }); + })); }, toggle: function(e) { var boardID, context, postID, threadID, _ref; diff --git a/builds/crx/script.js b/builds/crx/script.js index ac5f6a754..9ac7a1162 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -5315,6 +5315,9 @@ } if (Conf['Quote Inlining']) { $.on(a, 'click', QuoteInline.toggle); + if (Conf['Quote Hash Navigation']) { + QuoteInline.qiQuote(a, quoter.isHidden); + } } return frag; } @@ -5326,10 +5329,11 @@ return; } this.process = Conf['Quote Hash Navigation'] ? function(link, clone) { - if (!clone) { - $.after(link, QuoteInline.qiQuote(link, $.hasClass(link, 'filtered'))); + $.on(link, 'click', QuoteInline.toggle); + if (clone) { + return; } - return $.on(link, 'click', QuoteInline.toggle); + return QuoteInline.qiQuote(link, $.hasClass(link, 'filtered')); } : function(link) { return $.on(link, 'click', QuoteInline.toggle); }; @@ -5362,11 +5366,11 @@ if (hidden) { name += "filtered"; } - return $.el('a', { + return $.after(link, $.el('a', { className: name, textContent: '#', href: link.href - }); + })); }, toggle: function(e) { var boardID, context, postID, threadID, _ref; diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index fffde3e2c..654f42989 100755 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -69,4 +69,6 @@ QuoteBacklink = $.on a, 'mouseover', QuotePreview.mouseover if Conf['Quote Inlining'] $.on a, 'click', QuoteInline.toggle + if Conf['Quote Hash Navigation'] + QuoteInline.qiQuote a, quoter.isHidden frag diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index 95d44529f..ad6e9435a 100755 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -4,8 +4,9 @@ QuoteInline = @process = if Conf['Quote Hash Navigation'] (link, clone) -> - $.after link, QuoteInline.qiQuote link, $.hasClass link, 'filtered' unless clone $.on link, 'click', QuoteInline.toggle + return if clone + QuoteInline.qiQuote link, $.hasClass link, 'filtered' else (link) -> @@ -28,7 +29,7 @@ QuoteInline = qiQuote: (link, hidden) -> name = "hashlink" name += "filtered" if hidden - $.el 'a', + $.after link, $.el 'a', className: name textContent: '#' href: link.href