From 5abf8531dfaac18bf888662bb95ad85e104e26b9 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 5 Sep 2011 19:02:43 -0700 Subject: [PATCH] create threads --- 4chan_x.user.js | 16 +++++++++------- script.coffee | 13 +++++++++---- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index a58b99d39..534835a5c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1389,7 +1389,7 @@ }, cooldown: function() { var b, n, now; - if (!QR.qr) { + if (!(g.REPLY && QR.qr)) { return; } cooldown = $.get("cooldown/" + g.BOARD, 0); @@ -1417,13 +1417,11 @@ if (text == null) { text = ''; } - if (tid == null) { - tid = g.THREAD_ID; - } + tid || (tid = g.THREAD_ID || ''); QR.qr = qr = ui.dialog('qr', { top: '0', left: '0' - }, " X
120 Captchas
" + QR.spoiler + "
"); + }, "
X
120 Captchas
" + (g.REPLY ? "" : '') + " " + QR.spoiler + "
"); 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]) : ''; @@ -1457,7 +1455,7 @@ return QR.submit(); }, quote: function(e, blank) { - var i, id, qr, s, sel, ss, ta, text, tid, v, _ref, _ref2; + var i, id, qr, s, sel, ss, ta, text, tid, v, _base, _ref, _ref2; if (e != null) { e.preventDefault(); } @@ -1482,7 +1480,8 @@ ta.value = v.slice(0, ss) + text + v.slice(ss); i = ss + text.length; ta.setSelectionRange(i, i); - return ta.focus(); + ta.focus(); + return (_base = $('[name=resto]', qr)).value || (_base.value = tid); }, receive: function(e) { var data, qr, row, tc, _ref, _ref2; @@ -3523,6 +3522,9 @@ max-height: 250px;\ max-width: 250px;\ }\ + #qr input[name=resto] {\ + width: 80px;\ + }\ ' }; main.init(); diff --git a/script.coffee b/script.coffee index 4e05d276a..41387feee 100644 --- a/script.coffee +++ b/script.coffee @@ -1051,7 +1051,7 @@ QR = $.rm QR.qr QR.qr = null cooldown: -> - return unless QR.qr + return unless g.REPLY and QR.qr cooldown = $.get "cooldown/#{g.BOARD}", 0 now = Date.now() n = Math.ceil (cooldown - now) / 1000 @@ -1066,7 +1066,8 @@ QR = textContent: 'Submit' disabled: false QR.submit() if $('#autopost', QR.qr).checked - dialog: (text='', tid=g.THREAD_ID) -> + dialog: (text='', tid) -> + tid or= g.THREAD_ID or '' QR.qr = qr = ui.dialog 'qr', top: '0', left: '0', "
X @@ -1083,7 +1084,6 @@ QR =
- + #{if g.REPLY then "" else ''} + #{QR.spoiler}
@@ -1148,6 +1149,7 @@ QR = i = ss + text.length ta.setSelectionRange i, i ta.focus() + $('[name=resto]', qr).value or= tid receive: (e) -> $('iframe[name=iframe]').src = 'about:blank' {qr} = QR @@ -2791,6 +2793,9 @@ main = max-height: 250px; max-width: 250px; } + #qr input[name=resto] { + width: 80px; + } ' main.init()