less qr.cb
This commit is contained in:
parent
066a3d8ba5
commit
d330cbe8c9
@ -1230,13 +1230,13 @@
|
||||
qr = {
|
||||
init: function() {
|
||||
var iframe;
|
||||
g.callbacks.push(qr.cb.node);
|
||||
g.callbacks.push(qr.node);
|
||||
iframe = $.el('iframe', {
|
||||
name: 'iframe',
|
||||
hidden: true
|
||||
});
|
||||
$.append(d.body, iframe);
|
||||
$.bind(window, 'message', qr.cb.message);
|
||||
$.bind(window, 'message', qr.message);
|
||||
$('#recaptcha_response_field').id = '';
|
||||
return qr.captcha = [];
|
||||
},
|
||||
@ -1250,6 +1250,44 @@
|
||||
return (_ref = $('#autohide:checked', qr.el)) != null ? _ref.click() : void 0;
|
||||
}
|
||||
},
|
||||
message: function(e) {
|
||||
var data, duration, file, oldFile;
|
||||
Recaptcha.reload();
|
||||
$('iframe[name=iframe]').src = 'about:blank';
|
||||
data = e.data;
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
$.extend($('#error', qr.el), data);
|
||||
$('input[name=recaptcha_response_field]', qr.el).value = '';
|
||||
qr.autohide.unset();
|
||||
if (data.textContent === 'You seem to have mistyped the verification.') {
|
||||
qr.auto();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (qr.el) {
|
||||
file = $('#files input', qr.el);
|
||||
if (g.REPLY && (conf['Persistent QR'] || file)) {
|
||||
qr.refresh();
|
||||
if (file) {
|
||||
oldFile = $('#qr_form input[type=file]', qr.el);
|
||||
$.replace(oldFile, file);
|
||||
}
|
||||
} else {
|
||||
qr.close();
|
||||
}
|
||||
}
|
||||
if (conf['Cooldown']) {
|
||||
duration = qr.sage ? 60 : 30;
|
||||
$.setValue(g.BOARD + '/cooldown', Date.now() + duration * 1000);
|
||||
return cooldown.start();
|
||||
}
|
||||
},
|
||||
node: function(root) {
|
||||
var quote;
|
||||
quote = $('a.quotejs:not(:first-child)', root);
|
||||
return $.bind(quote, 'click', qr.cb.quote);
|
||||
},
|
||||
cb: {
|
||||
autohide: function(e) {
|
||||
if (this.checked) {
|
||||
@ -1258,44 +1296,6 @@
|
||||
return $.removeClass(qr.el, 'auto');
|
||||
}
|
||||
},
|
||||
message: function(e) {
|
||||
var data, duration, file, oldFile;
|
||||
Recaptcha.reload();
|
||||
$('iframe[name=iframe]').src = 'about:blank';
|
||||
data = e.data;
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
$.extend($('#error', qr.el), data);
|
||||
$('input[name=recaptcha_response_field]', qr.el).value = '';
|
||||
qr.autohide.unset();
|
||||
if (data.textContent === 'You seem to have mistyped the verification.') {
|
||||
qr.auto();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (qr.el) {
|
||||
file = $('#files input', qr.el);
|
||||
if (g.REPLY && (conf['Persistent QR'] || file)) {
|
||||
qr.refresh();
|
||||
if (file) {
|
||||
oldFile = $('#qr_form input[type=file]', qr.el);
|
||||
$.replace(oldFile, file);
|
||||
}
|
||||
} else {
|
||||
qr.close();
|
||||
}
|
||||
}
|
||||
if (conf['Cooldown']) {
|
||||
duration = qr.sage ? 60 : 30;
|
||||
$.setValue(g.BOARD + '/cooldown', Date.now() + duration * 1000);
|
||||
return cooldown.start();
|
||||
}
|
||||
},
|
||||
node: function(root) {
|
||||
var quote;
|
||||
quote = $('a.quotejs:not(:first-child)', root);
|
||||
return $.bind(quote, 'click', qr.cb.quote);
|
||||
},
|
||||
quote: function(e) {
|
||||
e.preventDefault();
|
||||
return qr.quote(this);
|
||||
|
||||
@ -967,12 +967,12 @@ cooldown =
|
||||
|
||||
qr =
|
||||
init: ->
|
||||
g.callbacks.push qr.cb.node
|
||||
g.callbacks.push qr.node
|
||||
iframe = $.el 'iframe',
|
||||
name: 'iframe'
|
||||
hidden: true
|
||||
$.append d.body, iframe
|
||||
$.bind window, 'message', qr.cb.message
|
||||
$.bind window, 'message', qr.message
|
||||
|
||||
#hack - nuke id so it doesn't grab focus when reloading
|
||||
$('#recaptcha_response_field').id = ''
|
||||
@ -984,6 +984,38 @@ qr =
|
||||
unset: ->
|
||||
$('#autohide:checked', qr.el)?.click()
|
||||
|
||||
message: (e) ->
|
||||
Recaptcha.reload()
|
||||
$('iframe[name=iframe]').src = 'about:blank'
|
||||
|
||||
{data} = e
|
||||
if data # error message
|
||||
data = JSON.parse data
|
||||
$.extend $('#error', qr.el), data
|
||||
$('input[name=recaptcha_response_field]', qr.el).value = ''
|
||||
qr.autohide.unset()
|
||||
if data.textContent is 'You seem to have mistyped the verification.'
|
||||
qr.auto()
|
||||
return
|
||||
|
||||
if qr.el
|
||||
file = $ '#files input', qr.el
|
||||
if g.REPLY and (conf['Persistent QR'] or file)
|
||||
qr.refresh()
|
||||
if file
|
||||
oldFile = $ '#qr_form input[type=file]', qr.el
|
||||
$.replace oldFile, file
|
||||
else
|
||||
qr.close()
|
||||
if conf['Cooldown']
|
||||
duration = if qr.sage then 60 else 30
|
||||
$.setValue g.BOARD+'/cooldown', Date.now() + duration * 1000
|
||||
cooldown.start()
|
||||
|
||||
node: (root) ->
|
||||
quote = $ 'a.quotejs:not(:first-child)', root
|
||||
$.bind quote, 'click', qr.cb.quote
|
||||
|
||||
cb:
|
||||
autohide: (e) ->
|
||||
if @checked
|
||||
@ -991,38 +1023,6 @@ qr =
|
||||
else
|
||||
$.removeClass qr.el, 'auto'
|
||||
|
||||
message: (e) ->
|
||||
Recaptcha.reload()
|
||||
$('iframe[name=iframe]').src = 'about:blank'
|
||||
|
||||
{data} = e
|
||||
if data # error message
|
||||
data = JSON.parse data
|
||||
$.extend $('#error', qr.el), data
|
||||
$('input[name=recaptcha_response_field]', qr.el).value = ''
|
||||
qr.autohide.unset()
|
||||
if data.textContent is 'You seem to have mistyped the verification.'
|
||||
qr.auto()
|
||||
return
|
||||
|
||||
if qr.el
|
||||
file = $ '#files input', qr.el
|
||||
if g.REPLY and (conf['Persistent QR'] or file)
|
||||
qr.refresh()
|
||||
if file
|
||||
oldFile = $ '#qr_form input[type=file]', qr.el
|
||||
$.replace oldFile, file
|
||||
else
|
||||
qr.close()
|
||||
if conf['Cooldown']
|
||||
duration = if qr.sage then 60 else 30
|
||||
$.setValue g.BOARD+'/cooldown', Date.now() + duration * 1000
|
||||
cooldown.start()
|
||||
|
||||
node: (root) ->
|
||||
quote = $ 'a.quotejs:not(:first-child)', root
|
||||
$.bind quote, 'click', qr.cb.quote
|
||||
|
||||
quote: (e) ->
|
||||
e.preventDefault()
|
||||
qr.quote @
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user