diff --git a/4chan_x.user.js b/4chan_x.user.js index b523ccaa5..a4b74be2c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3099,18 +3099,19 @@ return g.callbacks.push(this.node); }, node: function(root) { - var path, quote, tid, _i, _len, _ref; + var hash, path, quote, tid, _i, _len, _ref; if (root.className === 'inline') return; tid = g.THREAD_ID || $.x('ancestor::div[contains(@class,"thread")]', root).firstChild.id; _ref = $$('.quotelink', root); for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (conf['Indicate OP quote'] && quote.hash.slice(1) === tid) { + hash = quote.hash.slice(1); + if (conf['Indicate OP quote'] && hash === tid) { $.add(quote, $.tn('\u00A0(OP)')); return; } path = quote.pathname; - if (conf['Indicate Cross-thread Quotes'] && path.lastIndexOf("/" + tid) === -1 && path.indexOf("/" + g.BOARD + "/") === 0) { + if (conf['Indicate Cross-thread Quotes'] && hash && path.lastIndexOf("/" + tid) === -1 && path.indexOf("/" + g.BOARD + "/") === 0) { $.add(quote, $.tn('\u00A0(Cross-thread)')); } } diff --git a/script.coffee b/script.coffee index 99dddba86..d2b2d593a 100644 --- a/script.coffee +++ b/script.coffee @@ -2441,13 +2441,14 @@ quoteIndicators = # We use contains() so that it works with hidden threads tid = g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]', root).firstChild.id for quote in $$ '.quotelink', root - if conf['Indicate OP quote'] and quote.hash[1..] is tid + hash = quote.hash[1..] + if conf['Indicate OP quote'] and hash is tid # \u00A0 is nbsp $.add quote, $.tn '\u00A0(OP)' return path = quote.pathname #if quote leads to a different thread id and is located on the same board (index 0) - if conf['Indicate Cross-thread Quotes'] and path.lastIndexOf("/#{tid}") is -1 and path.indexOf("/#{g.BOARD}/") is 0 + if conf['Indicate Cross-thread Quotes'] and hash and path.lastIndexOf("/#{tid}") is -1 and path.indexOf("/#{g.BOARD}/") is 0 # \u00A0 is nbsp $.add quote, $.tn '\u00A0(Cross-thread)' return