diff --git a/4chan_x.user.js b/4chan_x.user.js index ca6896160..015ca05a8 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -913,7 +913,7 @@ if (QR.qr) { return $('textarea', QR.qr).focus(); } else { - return QR.dialog('', g.THREAD_ID || thread.firstChild.id); + return QR.dialog('', thread != null ? thread.firstChild.id : void 0); } } }, @@ -1436,15 +1436,15 @@ return QR.submit(); }, quote: function(e, blank) { - var i, id, qr, s, sel, ss, ta, text, tid, v, _ref; + var i, id, qr, s, sel, ss, ta, text, tid, v, _ref, _ref2; if (e != null) { e.preventDefault(); } - tid = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', this).id; + tid = (_ref = $.x('ancestor::div[@class="thread"]/div', this)) != null ? _ref.id : void 0; id = this.textContent; text = ">>" + id + "\n"; sel = getSelection(); - if (id === ((_ref = $.x('preceding::input[@type="checkbox"][1]', sel.anchorNode)) != null ? _ref.name : void 0)) { + if (id === ((_ref2 = $.x('preceding::input[@type="checkbox"][1]', sel.anchorNode)) != null ? _ref2.name : void 0)) { if (s = sel.toString().replace(/\n/g, '\n>')) { text += ">" + s + "\n"; } diff --git a/script.coffee b/script.coffee index ab9fbacf6..455c8a3bd 100644 --- a/script.coffee +++ b/script.coffee @@ -656,7 +656,7 @@ keybinds = if QR.qr $('textarea', QR.qr).focus() else - QR.dialog '', g.THREAD_ID or thread.firstChild.id + QR.dialog '', thread?.firstChild.id open: (thread, tab) -> id = thread.firstChild.id @@ -1145,7 +1145,7 @@ QR = QR.submit() #derpy, but prevents checking for content twice quote: (e, blank) -> e?.preventDefault() - tid = g.THREAD_ID or $.x('ancestor::div[@class="thread"]/div', @).id + tid = $.x('ancestor::div[@class="thread"]/div', @)?.id id = @textContent text = ">>#{id}\n" sel = getSelection()