summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/inline.js34
1 files changed, 23 insertions, 11 deletions
diff --git a/js/inline.js b/js/inline.js
index e4b24381..1ce0edc3 100644
--- a/js/inline.js
+++ b/js/inline.js
@@ -51,14 +51,11 @@
var $root = $(this).closest('.post')
var targetNum = this.textContent.slice(2)
- var $clone = $root.find('#inline_' + targetNum)
- if ($clone.length)
- return $clone.remove()
-
var srcOP = $root.closest('[id^=thread]').attr('id').match(/\d+/)[0]
var node, targetOP
- if (this.className) {// backlink
+ var isBacklink = !!this.className
+ if (isBacklink) {
node = $root.find('> .intro')
targetOP = srcOP
} else {
@@ -67,14 +64,25 @@
}
var link = {
- node: node,
- id: 'inline_' + targetNum
+ id: 'inline_' + targetNum,
+ isBacklink: isBacklink,
+ node: node
}
var selector = targetNum === targetOP
? '#op_' + srcOP
: '#reply_' + targetNum
+ var $clone = $root.find('#inline_' + targetNum)
+ if ($clone.length) {
+ $clone.remove()
+ $(selector)
+ .show()
+ .next()
+ .show()
+ return
+ }
+
if (srcOP === targetOP) {
if (targetNum === targetOP)
link.node = link.node.next()// bypass `(OP)`
@@ -97,6 +105,13 @@
var add = function(link, $target) {
var $clone = $target.clone(true)
+
+ if (link.isBacklink && App.options.get('hidePost'))
+ $target
+ .hide()
+ .next()
+ .hide()
+
$clone.find('.inline').remove()
$clone.attr({
"class": 'inline post',
@@ -106,10 +121,7 @@
$clone.insertAfter(link.node)
}
- App.options.add('inline', 'Inline quoted posts')
-
- if (!App.options.get('inline'))
- return
+ App.options.add('hidePost', 'Hide inlined backlinked posts')
$('head').append(
'<style>' +