diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 3e5f5d971..e2d01a629 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -5300,8 +5300,13 @@ } }, qiQuote: function(link, hidden) { + var name; + name = "hashlink"; + if (hidden) { + name += "filtered"; + } return $.el('a', { - className: "hashlink" + (hidden ? ' filtered' : ''), + className: name, textContent: '#', href: link.href }); @@ -12544,20 +12549,22 @@ return $.on(replyLink, 'click', Navigate.navigate); }, post: function() { - var hashlink, postlink, _i, _len, _ref; + var boardID, hashlink, postID, postlink, threadID, _i, _len, _ref, _ref1; + if (Conf['Quote Hash Navigation']) { + _ref = $$('.hashlink', this.nodes.comment); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + hashlink = _ref[_i]; + _ref1 = Get.postDataFromLink(hashlink), boardID = _ref1.boardID, threadID = _ref1.threadID, postID = _ref1.postID; + if (boardID !== g.BOARD.ID || (threadID !== g.THREADID)) { + $.on(hashlink, 'click', Navigate.navigate); + } + } + } if (g.VIEW === 'thread' && this.thread.ID === g.THREADID) { return; } postlink = $('a[title="Highlight this post"]', this.nodes.info); - $.on(postlink, 'click', Navigate.navigate); - if (!Conf['Quote Hash Navigation']) { - return; - } - _ref = $$('.hashlink', this.nodes.comment); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - hashlink = _ref[_i]; - $.on(hashlink, 'click', Navigate.navigate); - } + return $.on(postlink, 'click', Navigate.navigate); }, clean: function() { g.threads.forEach(function(thread) { diff --git a/builds/crx/script.js b/builds/crx/script.js index 08f1ce1dc..992fb0b5c 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -5352,8 +5352,13 @@ } }, qiQuote: function(link, hidden) { + var name; + name = "hashlink"; + if (hidden) { + name += "filtered"; + } return $.el('a', { - className: "hashlink" + (hidden ? ' filtered' : ''), + className: name, textContent: '#', href: link.href }); @@ -12558,20 +12563,22 @@ return $.on(replyLink, 'click', Navigate.navigate); }, post: function() { - var hashlink, postlink, _i, _len, _ref; + var boardID, hashlink, postID, postlink, threadID, _i, _len, _ref, _ref1; + if (Conf['Quote Hash Navigation']) { + _ref = $$('.hashlink', this.nodes.comment); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + hashlink = _ref[_i]; + _ref1 = Get.postDataFromLink(hashlink), boardID = _ref1.boardID, threadID = _ref1.threadID, postID = _ref1.postID; + if (boardID !== g.BOARD.ID || (threadID !== g.THREADID)) { + $.on(hashlink, 'click', Navigate.navigate); + } + } + } if (g.VIEW === 'thread' && this.thread.ID === g.THREADID) { return; } postlink = $('a[title="Highlight this post"]', this.nodes.info); - $.on(postlink, 'click', Navigate.navigate); - if (!Conf['Quote Hash Navigation']) { - return; - } - _ref = $$('.hashlink', this.nodes.comment); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - hashlink = _ref[_i]; - $.on(hashlink, 'click', Navigate.navigate); - } + return $.on(postlink, 'click', Navigate.navigate); }, clean: function() { g.threads.forEach(function(thread) { diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 19707eb97..f67ea5ac3 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -22,17 +22,18 @@ Navigate = replyLink = $ 'a.replylink', @OP.nodes.info $.on replyLink, 'click', Navigate.navigate - post: -> + post: -> # Allows us to navigate via JSON from thread to thread by hashes and quote highlights. + if Conf['Quote Hash Navigation'] + for hashlink in $$ '.hashlink', @nodes.comment + {boardID, threadID, postID} = Get.postDataFromLink hashlink + if boardID isnt g.BOARD.ID or (threadID isnt g.THREADID) + $.on hashlink, 'click', Navigate.navigate + # We don't need to reload the thread inside the thread return if g.VIEW is 'thread' and @thread.ID is g.THREADID postlink = $ 'a[title="Highlight this post"]', @nodes.info $.on postlink, 'click', Navigate.navigate - return unless Conf['Quote Hash Navigation'] - for hashlink in $$ '.hashlink', @nodes.comment - $.on hashlink, 'click', Navigate.navigate - return - clean: -> # Garbage collection g.threads.forEach (thread) -> thread.collect() diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee index 9fa982ae3..95d44529f 100755 --- a/src/Quotelinks/QuoteInline.coffee +++ b/src/Quotelinks/QuoteInline.coffee @@ -26,8 +26,10 @@ QuoteInline = return qiQuote: (link, hidden) -> + name = "hashlink" + name += "filtered" if hidden $.el 'a', - className: "hashlink#{if hidden then ' filtered' else ''}" + className: name textContent: '#' href: link.href