add auto in qr

This commit is contained in:
James Campos 2010-10-29 16:08:24 -07:00
parent bd5a3f8e0f
commit 942ea09cdf
2 changed files with 29 additions and 5 deletions

View File

@ -459,6 +459,10 @@ cooldown = ->
if seconds == 0 if seconds == 0
submit.disabled = false submit.disabled = false
submit.value = 'Submit' submit.value = 'Submit'
auto = submit.previousSibling.lastChild
if auto.checked
$('#qr form').submit()
#submit.click() doesn't work
else else
submit.value = seconds - 1 submit.value = seconds - 1
window.setTimeout cooldown, 1000 window.setTimeout cooldown, 1000
@ -474,7 +478,7 @@ iframeLoad = ->
textContent: error textContent: error
className: 'error' className: 'error'
addTo qr, span addTo qr, span
$('input[title=autohide]:not(:checked)', qr)?.click() $('input[title=autohide]:checked', qr)?.click()
else if REPLY and getConfig 'Persistent QR' else if REPLY and getConfig 'Persistent QR'
$('textarea', qr).value = '' $('textarea', qr).value = ''
$('input[name=recaptcha_response_field]', qr).value = '' $('input[name=recaptcha_response_field]', qr).value = ''
@ -554,6 +558,14 @@ quickReply = (e) ->
name: 'resto' name: 'resto'
value: x(xpath, this).name value: x(xpath, this).name
addTo clone, input 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 qr, clone
addTo d.body, qr addTo d.body, qr

View File

@ -517,12 +517,14 @@
return remove(div); return remove(div);
}; };
cooldown = function() { cooldown = function() {
var seconds, submit; var auto, seconds, submit;
submit = $('#qr input[type=submit]'); submit = $('#qr input[type=submit]');
seconds = parseInt(submit.value); seconds = parseInt(submit.value);
if (seconds === 0) { if (seconds === 0) {
submit.disabled = false; submit.disabled = false;
return (submit.value = 'Submit'); submit.value = 'Submit';
auto = submit.previousSibling.lastChild;
return auto.checked ? $('#qr form').submit() : null;
} else { } else {
submit.value = seconds - 1; submit.value = seconds - 1;
return window.setTimeout(cooldown, 1000); return window.setTimeout(cooldown, 1000);
@ -541,7 +543,7 @@
className: 'error' className: 'error'
}); });
addTo(qr, span); 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')) { } else if (REPLY && getConfig('Persistent QR')) {
$('textarea', qr).value = ''; $('textarea', qr).value = '';
$('input[name=recaptcha_response_field]', qr).value = ''; $('input[name=recaptcha_response_field]', qr).value = '';
@ -585,7 +587,7 @@
return (qr.className = klass); return (qr.className = klass);
}; };
quickReply = function(e) { 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'))) { if (!(qr = $('#qr'))) {
qr = AEOS.makeDialog('qr', 'topleft'); qr = AEOS.makeDialog('qr', 'topleft');
titlebar = n('div', { titlebar = n('div', {
@ -625,6 +627,16 @@
value: x(xpath, this).name value: x(xpath, this).name
}); });
addTo(clone, input); 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(qr, clone);
addTo(d.body, qr); addTo(d.body, qr);