From 8245ecba83a46485a5371f8f165b9e0687a7f1e2 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 4 Sep 2011 03:22:35 -0700 Subject: [PATCH] kind of actually works --- 4chan_x.user.js | 22 ++++++++++++++-------- script.coffee | 37 ++++++++++++++++++++++--------------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index bb92e7289..ca6896160 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1311,7 +1311,7 @@ $.set('captchas', captchas); el.value = ''; Recaptcha.reload(); - return captchaLength(captchas); + return QR.captchaLength(captchas); }, captchaShift: function() { var captcha, captchas, cutoff; @@ -1323,7 +1323,7 @@ } } $.set('captchas', captchas); - captchaLength(captchas); + QR.captchaLength(captchas); return captcha; }, captchaLength: function(captchas) { @@ -1375,6 +1375,9 @@ if (text == null) { text = ''; } + if (tid == null) { + tid = g.THREAD_ID; + } /* " X @@ -1401,23 +1404,23 @@ $('[name=email]', qr).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else '' $('[name=pwd]', qr).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value $('textarea', qr).value = text - QR.captchaLength() QR.cooldown() if conf['Cooldown'] $.bind $('.close', qr), 'click', QR.close - $.bind $('form', qr), 'submit', QR.submit - $.bind $('#recaptcha_response_field', qr), 'keydown', QR.keydown - $.bind $('#recaptcha_response_field', qr), 'keydown', Recaptcha.listener $.bind $('[type=file]', qr), 'change', QR.change $.bind $('#attach', qr), 'click', QR.attach */ QR.qr = qr = ui.dialog('qr', { top: '0', left: '0' - }, " X
Subject Name Email
120 Captchas
Derp
"); + }, " X
Subject Name Email
120 Captchas
Derp
"); $.bind($('.click', qr), 'mousedown', function(e) { return e.stopPropagation(); }); + $.bind($('form', qr), 'submit', QR.submit); + $.bind($('#recaptcha_response_field', qr), 'keydown', QR.keydown); + $.bind($('#recaptcha_response_field', qr), 'keydown', Recaptcha.listener); QR.captchaImg(); + QR.captchaLength(); $.append(d.body, qr); ta = $('textarea', qr); l = text.length; @@ -3465,7 +3468,10 @@ #qr .input:hover span, #qr .input input:focus + span {\ display: none;\ }\ - #qr:not(:hover) #autohide:checked ~ .autohide {\ + #qr form {\ + margin: 0;\ + }\ + #qr:not(:hover) #autohide:checked ~ form {\ height: 0;\ overflow: hidden;\ }\ diff --git a/script.coffee b/script.coffee index 3623d5d52..ab9fbacf6 100644 --- a/script.coffee +++ b/script.coffee @@ -1026,7 +1026,7 @@ QR = $.set 'captchas', captchas el.value = '' Recaptcha.reload() - captchaLength captchas + QR.captchaLength captchas captchaShift: -> captchas = $.get 'captchas', [] cutoff = Date.now() - 5*HOUR + 5*MINUTE @@ -1034,7 +1034,7 @@ QR = if captcha.time > cutoff break $.set 'captchas', captchas - captchaLength captchas + QR.captchaLength captchas captcha captchaLength: (captchas) -> captchas or= $.get 'captchas', [] @@ -1066,7 +1066,7 @@ QR = textContent: 'Submit' disabled: false QR.submit() if $('#auto', QR.qr).checked - dialog: (text='', tid) -> + dialog: (text='', tid=g.THREAD_ID) -> ### "
X @@ -1093,12 +1093,8 @@ QR = $('[name=email]', qr).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else '' $('[name=pwd]', qr).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value $('textarea', qr).value = text - QR.captchaLength() QR.cooldown() if conf['Cooldown'] $.bind $('.close', qr), 'click', QR.close - $.bind $('form', qr), 'submit', QR.submit - $.bind $('#recaptcha_response_field', qr), 'keydown', QR.keydown - $.bind $('#recaptcha_response_field', qr), 'keydown', Recaptcha.listener $.bind $('[type=file]', qr), 'change', QR.change $.bind $('#attach', qr), 'click', QR.attach ### @@ -1108,13 +1104,17 @@ QR =
- Subject - Name - Email + Subject + Name + Email
-
- +
+ + + + +
120 Captchas @@ -1123,12 +1123,16 @@ QR =
- Derp + Derp
-
+ " $.bind $('.click', qr), 'mousedown', (e) -> e.stopPropagation() + $.bind $('form', qr), 'submit', QR.submit + $.bind $('#recaptcha_response_field', qr), 'keydown', QR.keydown + $.bind $('#recaptcha_response_field', qr), 'keydown', Recaptcha.listener QR.captchaImg() + QR.captchaLength() $.append d.body, qr ta = $ 'textarea', qr l = text.length @@ -2775,7 +2779,10 @@ main = #qr .input:hover span, #qr .input input:focus + span { display: none; } - #qr:not(:hover) #autohide:checked ~ .autohide { + #qr form { + margin: 0; + } + #qr:not(:hover) #autohide:checked ~ form { height: 0; overflow: hidden; }