mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
lazy init edit submit btn and update demo link
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
<. } .>
|
||||
<. let level = levels.len() + 1; .>
|
||||
<. include!("../add/add-level.html"); .>
|
||||
<button data-sitekey="<.= key .>" class="sitekey-form__submit" type="submit">
|
||||
<button data-sitekey="<.= key .>"
|
||||
id="sitekey-form__submit" class="sitekey-form__submit" type="submit">
|
||||
Submit
|
||||
</button>
|
||||
<. include!("../view/__form-bottom.html"); .>
|
||||
|
||||
@@ -27,10 +27,12 @@ import {LEVELS} from '../add/ts/levels';
|
||||
import getFormUrl from '../../../utils/getFormUrl';
|
||||
import genJsonPayload from '../../../utils/genJsonPayload';
|
||||
import createError from '../../../components/error';
|
||||
import LazyElement from '../../../utils/lazyElement';
|
||||
|
||||
import VIEWS from '../../../views/v1/routes';
|
||||
|
||||
const BTN_CLASS = document.querySelector('sitekey-form__submit');
|
||||
const BTN_ID = 'sitekey-form__submit';
|
||||
const BTN = new LazyElement(BTN_ID);
|
||||
|
||||
const submit = async (e: Event) => {
|
||||
e.preventDefault();
|
||||
@@ -43,8 +45,7 @@ const submit = async (e: Event) => {
|
||||
const levels = LEVELS.getLevels();
|
||||
console.debug(`[form submition]: levels: ${levels}`);
|
||||
|
||||
const btn = <HTMLElement>document.querySelector(`${BTN_CLASS}`);
|
||||
const key = btn.dataset.sitekey;
|
||||
const key = BTN.get().dataset.sitekey;
|
||||
|
||||
const payload = {
|
||||
levels,
|
||||
|
||||
Reference in New Issue
Block a user