Another $.globalEval -> $.global.
This commit is contained in:
parent
cd3097d1fa
commit
04dd179019
@ -103,29 +103,21 @@ Captcha.v2 =
|
|||||||
$.add @nodes.container, [iframe, div]
|
$.add @nodes.container, [iframe, div]
|
||||||
|
|
||||||
setupJS: ->
|
setupJS: ->
|
||||||
$.globalEval '''
|
$.global ->
|
||||||
(function() {
|
render = ->
|
||||||
function render() {
|
container = document.querySelector '#qr .captcha-container'
|
||||||
var container = document.querySelector("#qr .captcha-container");
|
container.dataset.widgetID = window.grecaptcha.render container,
|
||||||
container.dataset.widgetID = window.grecaptcha.render(container, {
|
sitekey: '<%= meta.recaptchaKey %>'
|
||||||
sitekey: '<%= meta.recaptchaKey %>',
|
theme: if document.documentElement.classList.contains('tomorrow') then 'dark' else 'light'
|
||||||
theme: document.documentElement.classList.contains('tomorrow') ? 'dark' : 'light',
|
callback: (response) ->
|
||||||
callback: function(response) {
|
window.dispatchEvent new CustomEvent('captcha:success', {detail: response})
|
||||||
window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));
|
if window.grecaptcha
|
||||||
}
|
render()
|
||||||
});
|
else
|
||||||
}
|
cbNative = window.onRecaptchaLoaded
|
||||||
if (window.grecaptcha) {
|
window.onRecaptchaLoaded = ->
|
||||||
render();
|
render()
|
||||||
} else {
|
cbNative()
|
||||||
var cbNative = window.onRecaptchaLoaded;
|
|
||||||
window.onRecaptchaLoaded = function() {
|
|
||||||
render();
|
|
||||||
cbNative();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
'''
|
|
||||||
|
|
||||||
afterSetup: (mutations) ->
|
afterSetup: (mutations) ->
|
||||||
for mutation in mutations
|
for mutation in mutations
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user