From 2f85073d281bc9cc6d8a09c5607f9a182c81004e Mon Sep 17 00:00:00 2001 From: James Campos Date: Fri, 3 Oct 2014 13:40:05 -0700 Subject: [PATCH] fix front page backlink --- js/inline.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/js/inline.js b/js/inline.js index fb50684b..2b5200fc 100644 --- a/js/inline.js +++ b/js/inline.js @@ -11,21 +11,26 @@ if ($clone.length) return $clone.remove() - var targetOP = this.pathname.match(/(\d+).html/)[1] - var selector = targetNum === targetOP - ? '.op .body' - : '#reply_' + targetNum + var srcOP = $root.closest('[id^=thread]').attr('id').match(/\d+/)[0] - var node = this.className - ? $root.find('> .intro') - : $(this) + var node, targetOP + if (this.className) {// backlink + node = $root.find('> .intro') + targetOP = srcOP + } else { + node = $(this) + targetOP = this.pathname.match(/(\d+).html/)[1] + } var link = { node: node, targetNum: targetNum } - var srcOP = $root.closest('[id^=thread]').attr('id').match(/\d+/)[0] + var selector = targetNum === targetOP + ? '.op .body' + : '#reply_' + targetNum + if (srcOP === targetOP) { // XXX post hover adds fetched threads to the DOM selector = '#thread_' + srcOP + ' ' + selector