From 83a15f88eff7e010de9efe3521541195f55ae832 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 3 Sep 2011 14:07:38 -0700 Subject: [PATCH] index reply --- 4chan_x.user.js | 9 +++++---- script.coffee | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 06ffe3de3..edbf6d546 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1359,7 +1359,7 @@ } } }, - dialog: function(text) { + dialog: function(text, tid) { var c, l, m, qr, ta; if (text == null) { text = ''; @@ -1367,7 +1367,7 @@ QR.qr = qr = ui.dialog('qr', { top: '0', left: '0' - }, " X
Quick Reply
" + QR.spoiler + "
" + ($.get('captchas', []).length) + " captchas
attach another file
"); + }, " X
Quick Reply
" + QR.spoiler + "
" + ($.get('captchas', []).length) + " captchas
attach another file
"); c = d.cookie; $('[name=name]', qr).value = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; $('[name=email]', qr).value = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; @@ -1395,8 +1395,9 @@ return QR.submit(); }, quote: function(e) { - var i, id, qr, s, sel, ss, ta, text, v, _ref; + var i, id, qr, s, sel, ss, ta, text, tid, v, _ref; e.preventDefault(); + tid = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', this).id; id = this.textContent; text = ">>" + id + "\n"; sel = getSelection(); @@ -1407,7 +1408,7 @@ } qr = QR.qr; if (!qr) { - QR.dialog(text); + QR.dialog(text, tid); return; } $('#autohide', qr).checked = false; diff --git a/script.coffee b/script.coffee index fbc705b0a..1caae9e68 100644 --- a/script.coffee +++ b/script.coffee @@ -961,9 +961,8 @@ cooldown = qr.autoPost() QR = + #TODO create new thread #FIXME DRY - #index reply - #create new thread #sys normal post form fallback init: -> g.callbacks.push (root) -> @@ -1057,12 +1056,12 @@ QR = textContent: 'Submit' disabled: false QR.submit() if $('#auto', QR.qr).checked - dialog: (text='') -> + dialog: (text='', tid) -> QR.qr = qr = ui.dialog 'qr', top: '0', left: '0', " X
Quick Reply
- + @@ -1100,6 +1099,7 @@ QR = QR.submit() #derpy, but prevents calling QR.hasContent twice quote: (e) -> e.preventDefault() + tid = g.THREAD_ID or $.x('ancestor::div[@class="thread"]/div', @).id id = @textContent text = ">>#{id}\n" sel = getSelection() @@ -1108,7 +1108,7 @@ QR = text += ">#{s}\n" {qr} = QR if not qr - QR.dialog text + QR.dialog text, tid return $('#autohide', qr).checked = false ta = $ 'textarea', qr