From ee4716b0481cfb2495eab931b3cac115e7f5d912 Mon Sep 17 00:00:00 2001 From: James Campos Date: Thu, 25 Sep 2014 10:11:33 -0700 Subject: [PATCH] work for backlinks --- js/inline.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/js/inline.js b/js/inline.js index 728a887a..df91c8a9 100644 --- a/js/inline.js +++ b/js/inline.js @@ -4,9 +4,10 @@ var inline = function(e) { e.preventDefault() + var $root = $(this).closest('.post') var postNum = this.textContent.slice(2) - var $clone = $('#inline_' + postNum) + var $clone = $root.find('#inline_' + postNum) if ($clone.length) return $clone.remove() @@ -15,9 +16,13 @@ ? '.op .body' : '#reply_' + postNum + ' .body' + var node = this.className + ? $root.find('.body').first().children().first() + : this.nextSibling + var link = { - postNum: postNum, - node: this + node: node, + postNum: postNum } var OP = $('input[name="thread"]').val() @@ -48,7 +53,7 @@ "class": 'inline', id: 'inline_' + link.postNum }) - $clone.insertAfter(link.node) + $clone.insertBefore(link.node) } $('head').append( @@ -60,7 +65,7 @@ '}' + '') - $('.body a') + $('.body a, .mentioned a') .attr('onclick', null)// disable highlightReply. so hacky .click(inline)