auto hide, persist

This commit is contained in:
James Campos 2011-09-02 20:01:19 -07:00
parent 4ec8ca541e
commit 574b2fe2fb
2 changed files with 20 additions and 15 deletions

View File

@ -1239,9 +1239,15 @@
$('#recaptcha_response_field').id = '';
holder = $('#recaptcha_challenge_field_holder');
$.bind(holder, 'DOMNodeInserted', QR.captchaNode);
return QR.captchaNode({
QR.captchaNode({
target: holder.firstChild
});
if (conf['Persistent QR']) {
qr.dialog();
if (conf['Auto Hide QR']) {
return $('#autohide', QR.el).checked = true;
}
}
},
captchaNode: function(e) {
var c;
@ -1354,7 +1360,9 @@
if (data) {
return $.extend($('a.error', QR.el), JSON.parse(data));
} else {
QR.close();
if (!conf['Persistent QR']) {
QR.close();
}
if (conf['Cooldown']) {
cooldown = Date.now() + 30 * SECOND;
$.set("cooldown/" + g.BOARD, cooldown);
@ -1375,7 +1383,10 @@
}
challenge = captcha.challenge, response = captcha.response;
$('#challenge', QR.el).value = challenge;
return $('#response', QR.el).value = response;
$('#response', QR.el).value = response;
if (conf['Auto Hide QR']) {
return $('#autohide', QR.el).checked = true;
}
},
sys: function() {
return $.globalEval(function() {
@ -3065,12 +3076,6 @@
if (conf['Image Preloading']) {
imgPreloading.init();
}
if (conf['Quick Reply'] && conf['Persistent QR'] && canPost) {
qr.dialog();
if (conf['Auto Hide QR']) {
$('#autohide', qr.el).checked = true;
}
}
if (conf['Post in Title']) {
titlePost.init();
}

View File

@ -974,6 +974,10 @@ QR =
holder = $ '#recaptcha_challenge_field_holder'
$.bind holder, 'DOMNodeInserted', QR.captchaNode
QR.captchaNode target: holder.firstChild
if conf['Persistent QR']
qr.dialog()
if conf['Auto Hide QR']
$('#autohide', QR.el).checked = true
captchaNode: (e) ->
c = e.target.value
$('img', QR.el).src = "http://www.google.com/recaptcha/api/image?c=#{c}"
@ -1066,7 +1070,7 @@ QR =
if data
$.extend $('a.error', QR.el), JSON.parse data
else
QR.close()
QR.close() unless conf['Persistent QR']
if conf['Cooldown']
cooldown = Date.now() + 30*SECOND
$.set "cooldown/#{g.BOARD}", cooldown
@ -1082,6 +1086,7 @@ QR =
{challenge, response} = captcha
$('#challenge', QR.el).value = challenge
$('#response', QR.el).value = response
$('#autohide', QR.el).checked = true if conf['Auto Hide QR']
sys: ->
$.globalEval ->
if node = document.querySelector('table font b')?.firstChild
@ -2420,11 +2425,6 @@ main =
if conf['Image Preloading']
imgPreloading.init()
if conf['Quick Reply'] and conf['Persistent QR'] and canPost
qr.dialog()
if conf['Auto Hide QR']
$('#autohide', qr.el).checked = true
if conf['Post in Title']
titlePost.init()