diff --git a/4chan_x.user.js b/4chan_x.user.js index 1defcf307..d6eaa7c78 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -883,7 +883,7 @@ qrLink = $("span[id^=nothread] a:not(:first-child)", thread); } if (quote) { - return qr.quote(qrLink); + return qr.quote.call(qrLink); } else { if (!qr.el) { qr.dialog(qrLink); @@ -1279,12 +1279,6 @@ return qr.push.call(this); } }, - cb: { - quote: function(e) { - e.preventDefault(); - return qr.quote(this); - } - }, close: function() { $.rm(qr.el); return qr.el = null; @@ -1350,7 +1344,7 @@ node: function(root) { var quote; quote = $('a.quotejs:not(:first-child)', root); - return $.bind(quote, 'click', qr.cb.quote); + return $.bind(quote, 'click', qr.quote); }, push: function() { this.nextSibling.textContent = qr.captcha.push({ @@ -1360,14 +1354,17 @@ Recaptcha.reload(); return this.value = ''; }, - quote: function(link) { + quote: function(e) { var id, s, selection, selectionID, ta, text, _ref; + if (e) { + e.preventDefault(); + } if (qr.el) { $('#autohide', qr.el).checked = false; } else { - qr.dialog(link); + qr.dialog(this); } - id = link.textContent; + id = this.textContent; text = ">>" + id + "\n"; selection = window.getSelection(); if (s = selection.toString()) { diff --git a/script.coffee b/script.coffee index b5b0a4294..cc84430da 100644 --- a/script.coffee +++ b/script.coffee @@ -631,7 +631,7 @@ keybinds = qrLink = $ "span[id^=nothread] a:not(:first-child)", thread if quote - qr.quote qrLink + qr.quote.call qrLink else unless qr.el qr.dialog qrLink @@ -971,6 +971,7 @@ qr = # persistent captcha # code review # rm Recaptcha + # group captcha init: -> g.callbacks.push qr.node $.bind window, 'message', qr.message @@ -1011,11 +1012,6 @@ qr = $('#autohide', qr.el).checked = true if conf['Auto Hide QR'] qr.push.call this - cb: - quote: (e) -> - e.preventDefault() - qr.quote @ - close: -> $.rm qr.el qr.el = null @@ -1093,7 +1089,7 @@ qr = node: (root) -> quote = $ 'a.quotejs:not(:first-child)', root - $.bind quote, 'click', qr.cb.quote + $.bind quote, 'click', qr.quote push: -> @nextSibling.textContent = qr.captcha.push @@ -1102,13 +1098,15 @@ qr = Recaptcha.reload() @value = '' - quote: (link) -> + quote: (e) -> + e.preventDefault() if e + if qr.el $('#autohide', qr.el).checked = false else - qr.dialog link + qr.dialog @ - id = link.textContent + id = @textContent text = ">>#{id}\n" selection = window.getSelection()