Archived
1
0
Fork 0

Optimise reCaptcha for multiple reCaptcha page

This commit is contained in:
Ethanell 2020-08-25 13:56:11 +02:00
parent 0edafd6be2
commit 4cc884d03b
3 changed files with 13 additions and 13 deletions

View file

@ -21,3 +21,14 @@ dark.addEventListener("click", () => {
else
contact.classList.add("hide");
});
function cb(token) {
document.querySelectorAll("div.recaptcha.recaptcha-cb").forEach(el => {
el.classList.remove("recaptcha-cb");
let input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "g-recaptcha-response");
input.setAttribute("value", token);
el.appendChild(input);
});
}

View file

@ -91,3 +91,5 @@ html
+submit(value=__("layout.send"))
script(src="/javascripts/layout.js")
if !test
p !{captcha}

View file

@ -1,16 +1,3 @@
mixin submit(value)
div.recaptcha.recaptcha-cb
input(type="submit" value!=value)
if !test
p !{captcha}
script.
function cb(token) {
document.querySelectorAll("div.recaptcha.recaptcha-cb").forEach(el => {
el.classList.remove("recaptcha-cb");
let input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "g-recaptcha-response");
input.setAttribute("value", token);
el.appendChild(input);
});
}