diff --git a/4chan_x.coffee b/4chan_x.coffee index 7ed50973a..b3f6d7262 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -459,6 +459,10 @@ cooldown = -> if seconds == 0 submit.disabled = false submit.value = 'Submit' + auto = submit.previousSibling.lastChild + if auto.checked + $('#qr form').submit() + #submit.click() doesn't work else submit.value = seconds - 1 window.setTimeout cooldown, 1000 @@ -474,7 +478,7 @@ iframeLoad = -> textContent: error className: 'error' addTo qr, span - $('input[title=autohide]:not(:checked)', qr)?.click() + $('input[title=autohide]:checked', qr)?.click() else if REPLY and getConfig 'Persistent QR' $('textarea', qr).value = '' $('input[name=recaptcha_response_field]', qr).value = '' @@ -554,6 +558,14 @@ quickReply = (e) -> name: 'resto' value: x(xpath, this).name addTo clone, input + else if getConfig 'Persistent QR' + submit = $ 'input[type=submit]', clone + auto = n 'label', + textContent: 'Auto' + autoBox = n 'input', + type: 'checkbox' + addTo auto, autoBox + inBefore submit, auto addTo qr, clone addTo d.body, qr diff --git a/4chan_x.js b/4chan_x.js index e2d3b6ef7..d41f6c0cc 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -517,12 +517,14 @@ return remove(div); }; cooldown = function() { - var seconds, submit; + var auto, seconds, submit; submit = $('#qr input[type=submit]'); seconds = parseInt(submit.value); if (seconds === 0) { submit.disabled = false; - return (submit.value = 'Submit'); + submit.value = 'Submit'; + auto = submit.previousSibling.lastChild; + return auto.checked ? $('#qr form').submit() : null; } else { submit.value = seconds - 1; return window.setTimeout(cooldown, 1000); @@ -541,7 +543,7 @@ className: 'error' }); addTo(qr, span); - (typeof (_ref3 = ((_ref2 = $('input[title=autohide]:not(:checked)', qr)))) === "undefined" || _ref3 === null) ? undefined : _ref3.click(); + (typeof (_ref3 = ((_ref2 = $('input[title=autohide]:checked', qr)))) === "undefined" || _ref3 === null) ? undefined : _ref3.click(); } else if (REPLY && getConfig('Persistent QR')) { $('textarea', qr).value = ''; $('input[name=recaptcha_response_field]', qr).value = ''; @@ -585,7 +587,7 @@ return (qr.className = klass); }; quickReply = function(e) { - var _i, _len, _ref2, _ref3, autohideB, clone, closeB, form, input, qr, script, selection, text, textarea, titlebar, xpath; + var _i, _len, _ref2, _ref3, auto, autoBox, autohideB, clone, closeB, form, input, qr, script, selection, text, textarea, titlebar, xpath; if (!(qr = $('#qr'))) { qr = AEOS.makeDialog('qr', 'topleft'); titlebar = n('div', { @@ -625,6 +627,16 @@ value: x(xpath, this).name }); addTo(clone, input); + } else if (getConfig('Persistent QR')) { + submit = $('input[type=submit]', clone); + auto = n('label', { + textContent: 'Auto' + }); + autoBox = n('input', { + type: 'checkbox' + }); + addTo(auto, autoBox); + inBefore(submit, auto); } addTo(qr, clone); addTo(d.body, qr);