mirror of
https://github.com/sigmasternchen/axowall
synced 2025-03-15 08:38:55 +00:00
add input selector for challenge response output
This commit is contained in:
parent
7c5a5e494c
commit
b50df6c808
2 changed files with 8 additions and 1 deletions
|
@ -5,6 +5,11 @@
|
||||||
<link href="bundle.css" rel="stylesheet">
|
<link href="bundle.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="captcha" data-challenge-url="/challenge.json" data-success-callback="console.log"></div>
|
<div class="captcha"
|
||||||
|
data-challenge-url="/challenge.json"
|
||||||
|
data-success-callback="console.log"
|
||||||
|
data-input-selector=".response"
|
||||||
|
></div>
|
||||||
|
<input type="text" value="" class="response">
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -55,6 +55,7 @@ const prepareCaptcha = async (captcha: Element) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
let successCallback = captcha.getAttribute("data-success-callback");
|
let successCallback = captcha.getAttribute("data-success-callback");
|
||||||
|
let inputSelector = captcha.getAttribute("data-input-selector");
|
||||||
|
|
||||||
const checkbox = initCaptchaContentAndGetCheckbox(captcha);
|
const checkbox = initCaptchaContentAndGetCheckbox(captcha);
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ const prepareCaptcha = async (captcha: Element) => {
|
||||||
|
|
||||||
checkbox.addEventListener("click", prepareChallengeExecution(challenge, response => {
|
checkbox.addEventListener("click", prepareChallengeExecution(challenge, response => {
|
||||||
if (successCallback) eval(successCallback)(response);
|
if (successCallback) eval(successCallback)(response);
|
||||||
|
if (inputSelector) [...document.querySelectorAll(inputSelector)].forEach((input: HTMLInputElement) => input.value = response)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue