mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 09:26:03 +00:00
A form sent to the server showed nothing until the answer came: its button stayed as it was and took a second click, though creating a volume or starting a pool can take seconds. The button that sent it now turns a spinner and takes no second click meanwhile, and a page's reload or a job's result waits (submit_busy.js on every page, poll.js pageInUse). It is as before when the page stays: its leaving asked about unsaved work, or the browser's history brings it back. A form a script sends itself is left alone. The please-wait dialog of the VM start and the XML create, and the sign-in forms' own spinner, go: they show the same as every other form.
22 lines
1.1 KiB
JavaScript
22 lines
1.1 KiB
JavaScript
// The sign-in forms (login, OTP login): the eye button shows or hides the
|
|
// password, and a line says when Caps Lock is on. While the form is sent, its
|
|
// button shows it as every form's does (submit_busy.js).
|
|
document.getElementById("btn-toggle-pwd").addEventListener("click", function () {
|
|
var password = document.getElementById("id_password");
|
|
var shown = password.type === "password";
|
|
password.type = shown ? "text" : "password";
|
|
var icon = document.getElementById("toggle-icon");
|
|
icon.classList.toggle("bi-eye", !shown);
|
|
icon.classList.toggle("bi-eye-slash", shown);
|
|
});
|
|
|
|
["keydown", "keyup"].forEach(function (type) {
|
|
document.getElementById("id_password").addEventListener(type, function (event) {
|
|
var on = event.getModifierState && event.getModifierState("CapsLock");
|
|
document.getElementById("caps-lock").classList.toggle("d-none", !on);
|
|
});
|
|
});
|
|
// Caps Lock may change elsewhere: the line waits for the next key here
|
|
document.getElementById("id_password").addEventListener("blur", function () {
|
|
document.getElementById("caps-lock").classList.add("d-none");
|
|
});
|