refactor: refs #6555 convert jquery index file to js
gitea/worker-time-control/pipeline/pr-test This commit looks good
Details
gitea/worker-time-control/pipeline/pr-test This commit looks good
Details
This commit is contained in:
parent
76411063ba
commit
b2fa1d341b
19
js/index.js
19
js/index.js
|
@ -4,6 +4,7 @@ if ("addEventListener" in document) {
|
||||||
FastClick.attach(document.body);
|
FastClick.attach(document.body);
|
||||||
|
|
||||||
const heartEl = document.querySelector("body > h1 > span");
|
const heartEl = document.querySelector("body > h1 > span");
|
||||||
|
const txtPin = document.querySelector("#txtPin");
|
||||||
refreshDeviceLabel();
|
refreshDeviceLabel();
|
||||||
|
|
||||||
heartEl.addEventListener("click", () => {
|
heartEl.addEventListener("click", () => {
|
||||||
|
@ -22,21 +23,19 @@ if ("addEventListener" in document) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".btnnum").on("click", function () {
|
document.querySelectorAll(".btnnum").forEach((btn) => {
|
||||||
pin += parseInt($(this).children().html());
|
btn.addEventListener("click", (e) => {
|
||||||
$("#txtPin").text(pin);
|
pin += +e.currentTarget.children[0].innerHTML;
|
||||||
|
txtPin.textContent = pin;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".btnCancel").on("click", function () {
|
document.querySelector(".btnCancel").addEventListener("click", () => {
|
||||||
pin = "";
|
pin = "";
|
||||||
$("#txtPin").text("ID USUARIO");
|
txtPin.textContent = "ID USUARIO";
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".btnOk").on("click", function () {
|
document.querySelector(".btnOk").addEventListener("click", () => pin && login());
|
||||||
if (pin) {
|
|
||||||
login();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,6 @@ async function call(url, { method = "GET", body = {}, params = {} }) {
|
||||||
for (let [key, value] of Object.entries(params)) {
|
for (let [key, value] of Object.entries(params)) {
|
||||||
searchParams.append(key, typeof value === "object" ? JSON.stringify(value) : value);
|
searchParams.append(key, typeof value === "object" ? JSON.stringify(value) : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
url += "?" + searchParams.toString();
|
url += "?" + searchParams.toString();
|
||||||
} else if (method === "POST") opts.body = JSON.stringify(body);
|
} else if (method === "POST") opts.body = JSON.stringify(body);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue