feat: PIN lock - logout left of zero, erase and logout in a muted red
This commit is contained in:
1 parent
fc488717d3
commit
fd382d6313
2 files changed
+10
-9
No files matched your search
@@ -46,9 +46,9 @@
|
||||
box.setAttribute('aria-modal', 'true');
|
||||
box.setAttribute('aria-label', 'Ввод PIN-кода');
|
||||
var keys = '';
|
||||
['1', '2', '3', '4', '5', '6', '7', '8', '9', '', '0', 'back'].forEach(function (k) {
|
||||
if (!k) { keys += '<span></span>'; return; }
|
||||
keys += '<button type="button" data-k="' + k + '"' + (k === 'back' ? ' aria-label="Стереть">' + BACK : '>' + k) + '</button>';
|
||||
['1', '2', '3', '4', '5', '6', '7', '8', '9', 'out', '0', 'back'].forEach(function (k) {
|
||||
var label = k === 'back' ? ' aria-label="Стереть">' + BACK : k === 'out' ? ' title="Выйти из панели">Выйти' : '>' + k;
|
||||
keys += '<button type="button" data-k="' + k + '"' + label + '</button>';
|
||||
});
|
||||
box.innerHTML =
|
||||
'<div class="pin-card">' +
|
||||
@@ -57,7 +57,7 @@
|
||||
'<div class="pin-dots"><i></i><i></i><i></i><i></i></div>' +
|
||||
'<div class="pin-msg" aria-live="polite"></div>' +
|
||||
'<div class="pin-pad">' + keys + '</div>' +
|
||||
'<form method="post" action="/logout" class="pin-out"><button type="submit">Выйти</button></form>' +
|
||||
'<form method="post" action="/logout" class="pin-out" hidden></form>' +
|
||||
'</div>';
|
||||
document.body.appendChild(box);
|
||||
requestAnimationFrame(function () { box.classList.add('on'); });
|
||||
@@ -67,6 +67,7 @@
|
||||
for (var i = 0; i < 4; i++) dots[i].classList.toggle('on', i < code.length);
|
||||
}
|
||||
function press(k) {
|
||||
if (k === 'out') { box.querySelector('.pin-out').submit(); return; }
|
||||
if (busy) return;
|
||||
if (k === 'back') { code = code.slice(0, -1); show(); return; }
|
||||
if (code.length >= 4) return;
|
||||
|
||||
Reference in new issue
Block a user