feat: «глазик» в поле пароля при входе и смена своего пароля (сайт — своя карточка, приложение — «Настройки»); Android 1.11.0
This commit is contained in:
+14
-1
@@ -180,6 +180,19 @@ async function route() {
|
||||
}
|
||||
window.addEventListener("hashchange", route);
|
||||
|
||||
// поле пароля с «глазиком»: показать или скрыть введённое
|
||||
function pwEye(input) {
|
||||
const btn = h("button", { type: "button", class: "pweye", title: "Показать пароль", "aria-label": "Показать пароль" }, "👁");
|
||||
btn.onclick = () => {
|
||||
const show = input.type === "password";
|
||||
input.type = show ? "text" : "password";
|
||||
btn.textContent = show ? "🙈" : "👁";
|
||||
btn.title = show ? "Скрыть пароль" : "Показать пароль";
|
||||
btn.setAttribute("aria-label", btn.title);
|
||||
};
|
||||
return h("div", { class: "pwwrap" }, input, btn);
|
||||
}
|
||||
|
||||
function loginPage() {
|
||||
$top.replaceChildren(); $banner.replaceChildren(); document.getElementById("appfoot")?.replaceChildren();
|
||||
const u = h("input", { autofocus: true, autocomplete: "username" }), p = h("input", { type: "password", autocomplete: "current-password" });
|
||||
@@ -205,7 +218,7 @@ function loginPage() {
|
||||
}).catch(() => {});
|
||||
fetch(API + "/demo/status").then(r => r.json()).then(d => { if (d.active) note.style.display = ""; }).catch(() => {});
|
||||
$app.replaceChildren(h("div", { class: "card login" }, h("h1", {}, "Вход"), note,
|
||||
h("label", {}, "Логин"), u, h("div", { style: "height:10px" }), h("label", {}, "Пароль"), p,
|
||||
h("label", {}, "Логин"), u, h("div", { style: "height:10px" }), h("label", {}, "Пароль"), pwEye(p),
|
||||
h("div", { style: "height:14px" }), h("button", { onclick: go }, "Войти"), h("div", { style: "margin-top:14px" }, apk), docs));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user