op backlinks
This commit is contained in:
parent
5eac55bb49
commit
60e718bc9f
@ -91,6 +91,7 @@
|
|||||||
},
|
},
|
||||||
quote: {
|
quote: {
|
||||||
'Quote Backlinks': [true, 'Add quote backlinks'],
|
'Quote Backlinks': [true, 'Add quote backlinks'],
|
||||||
|
'OP Backlinks': [false, 'Add backlinks to the OP'],
|
||||||
'Quote Inline': [true, 'Show quoted post inline on quote click'],
|
'Quote Inline': [true, 'Show quoted post inline on quote click'],
|
||||||
'Quote Preview': [true, 'Show quote content on hover'],
|
'Quote Preview': [true, 'Show quote content on hover'],
|
||||||
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes']
|
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes']
|
||||||
@ -1711,8 +1712,8 @@
|
|||||||
return g.callbacks.push(quoteBacklink.node);
|
return g.callbacks.push(quoteBacklink.node);
|
||||||
},
|
},
|
||||||
node: function(root) {
|
node: function(root) {
|
||||||
var container, el, id, link, qid, quote, quotes, tid, _i, _len, _ref, _results;
|
var container, el, id, link, opbl, qid, quote, quotes, tid, _i, _len, _ref, _results;
|
||||||
if (root.className) {
|
if (/inline/.test(root.className)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
container = $.el('span', {
|
container = $.el('span', {
|
||||||
@ -1722,13 +1723,14 @@
|
|||||||
id = root.id || $('td[id]', root).id;
|
id = root.id || $('td[id]', root).id;
|
||||||
quotes = {};
|
quotes = {};
|
||||||
tid = g.THREAD_ID || root.parentNode.firstChild.id;
|
tid = g.THREAD_ID || root.parentNode.firstChild.id;
|
||||||
|
opbl = $.config('OP Backlinks');
|
||||||
_ref = $$('a.quotelink', root);
|
_ref = $$('a.quotelink', root);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
quote = _ref[_i];
|
quote = _ref[_i];
|
||||||
if (!(qid = quote.hash.slice(1))) {
|
if (!(qid = quote.hash.slice(1))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (qid === tid) {
|
if (!opbl && qid === tid) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
quotes[qid] = quote;
|
quotes[qid] = quote;
|
||||||
|
|||||||
@ -31,6 +31,7 @@ config =
|
|||||||
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.']
|
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.']
|
||||||
quote:
|
quote:
|
||||||
'Quote Backlinks': [true, 'Add quote backlinks']
|
'Quote Backlinks': [true, 'Add quote backlinks']
|
||||||
|
'OP Backlinks': [false, 'Add backlinks to the OP']
|
||||||
'Quote Inline': [true, 'Show quoted post inline on quote click']
|
'Quote Inline': [true, 'Show quoted post inline on quote click']
|
||||||
'Quote Preview': [true, 'Show quote content on hover']
|
'Quote Preview': [true, 'Show quote content on hover']
|
||||||
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes']
|
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes']
|
||||||
@ -1380,17 +1381,18 @@ quoteBacklink =
|
|||||||
init: ->
|
init: ->
|
||||||
g.callbacks.push quoteBacklink.node
|
g.callbacks.push quoteBacklink.node
|
||||||
node: (root) ->
|
node: (root) ->
|
||||||
return if root.className
|
return if /inline/.test root.className
|
||||||
container = $.el 'span',
|
container = $.el 'span',
|
||||||
className: 'container'
|
className: 'container'
|
||||||
$.before $('br, blockquote', root), container
|
$.before $('br, blockquote', root), container
|
||||||
id = root.id or $('td[id]', root).id
|
id = root.id or $('td[id]', root).id
|
||||||
quotes = {}
|
quotes = {}
|
||||||
tid = g.THREAD_ID or root.parentNode.firstChild.id
|
tid = g.THREAD_ID or root.parentNode.firstChild.id
|
||||||
|
opbl = $.config 'OP Backlinks'
|
||||||
for quote in $$ 'a.quotelink', root
|
for quote in $$ 'a.quotelink', root
|
||||||
continue unless qid = quote.hash[1..]
|
continue unless qid = quote.hash[1..]
|
||||||
#don't backlink the op
|
#don't backlink the op
|
||||||
continue if qid == tid
|
continue if !opbl and qid is tid
|
||||||
#duplicate quotes get overwritten
|
#duplicate quotes get overwritten
|
||||||
quotes[qid] = quote
|
quotes[qid] = quote
|
||||||
for qid, quote of quotes
|
for qid, quote of quotes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user