From 4e2f3efef613bc7f3550c5f526cbfbfdce1c18cf Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 2 Jan 2012 02:08:12 +0100 Subject: [PATCH] Automatically pick threads to reply to. Finish keybinds. --- 4chan_x.user.js | 7 +++++++ script.coffee | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/4chan_x.user.js b/4chan_x.user.js index d1ee96203..8e9fa3bba 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1053,6 +1053,7 @@ } else { qr.open(); } + if (!g.REPLY) qr.pickThread(thread.firstChild.id); return $('textarea', qr.el).focus(); }, open: function(thread, tab) { @@ -1236,10 +1237,16 @@ cleanError: function() { return $('.error', qr.el).textContent = null; }, + pickThread: function(thread) { + return $('select', qr.el).value = thread; + }, quote: function(e) { var caretPos, id, s, sel, ta, text, _ref; if (e != null) e.preventDefault(); qr.open(); + if (!g.REPLY) { + qr.pickThread($.x('ancestor::div[@class="thread"]/div', this).id); + } id = this.textContent; text = ">>" + id + "\n"; sel = window.getSelection(); diff --git a/script.coffee b/script.coffee index 02c3e2589..1bdfd92e3 100644 --- a/script.coffee +++ b/script.coffee @@ -747,6 +747,7 @@ keybinds = qr.quote.call $ '.quotejs + .quotejs', $('.replyhl', thread) or thread else qr.open() + qr.pickThread thread.firstChild.id unless g.REPLY $('textarea', qr.el).focus() open: (thread, tab) -> @@ -901,9 +902,13 @@ qr = cleanError: -> $('.error', qr.el).textContent = null + pickThread: (thread) -> + $('select', qr.el).value = thread + quote: (e) -> e?.preventDefault() qr.open() + qr.pickThread $.x('ancestor::div[@class="thread"]/div', @).id unless g.REPLY id = @textContent text = ">>#{id}\n"