summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2014-09-25 10:11:33 -0700
committerczaks <marcin@6irc.net>2014-10-07 03:27:34 +0200
commitee4716b0481cfb2495eab931b3cac115e7f5d912 (patch)
treea4742e130b6efad62535648ffcef43b84e766127
parent91ab8eeae663ac5bda1206a95894f2b6d24ab5b2 (diff)
work for backlinks
-rw-r--r--js/inline.js15
1 files 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 @@
'}' +
'</style>')
- $('.body a')
+ $('.body a, .mentioned a')
.attr('onclick', null)// disable highlightReply. so hacky
.click(inline)