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);
|
||||
|
||||
const heartEl = document.querySelector("body > h1 > span");
|
||||
const txtPin = document.querySelector("#txtPin");
|
||||
refreshDeviceLabel();
|
||||
|
||||
heartEl.addEventListener("click", () => {
|
||||
|
@ -22,21 +23,19 @@ if ("addEventListener" in document) {
|
|||
});
|
||||
});
|
||||
|
||||
$(".btnnum").on("click", function () {
|
||||
pin += parseInt($(this).children().html());
|
||||
$("#txtPin").text(pin);
|
||||
document.querySelectorAll(".btnnum").forEach((btn) => {
|
||||
btn.addEventListener("click", (e) => {
|
||||
pin += +e.currentTarget.children[0].innerHTML;
|
||||
txtPin.textContent = pin;
|
||||
});
|
||||
});
|
||||
|
||||
$(".btnCancel").on("click", function () {
|
||||
document.querySelector(".btnCancel").addEventListener("click", () => {
|
||||
pin = "";
|
||||
$("#txtPin").text("ID USUARIO");
|
||||
txtPin.textContent = "ID USUARIO";
|
||||
});
|
||||
|
||||
$(".btnOk").on("click", function () {
|
||||
if (pin) {
|
||||
login();
|
||||
}
|
||||
});
|
||||
document.querySelector(".btnOk").addEventListener("click", () => pin && login());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ async function call(url, { method = "GET", body = {}, params = {} }) {
|
|||
for (let [key, value] of Object.entries(params)) {
|
||||
searchParams.append(key, typeof value === "object" ? JSON.stringify(value) : value);
|
||||
}
|
||||
|
||||
url += "?" + searchParams.toString();
|
||||
} else if (method === "POST") opts.body = JSON.stringify(body);
|
||||
|
||||
|
|
Loading…
Reference in New Issue