mirror of
https://github.com/openwrt/luci.git
synced 2025-12-26 11:16:38 +04:00
Replaced L.bind with arrow functions, used Array.from for array conversion, applied concise method syntax, and switched to block-scoped declarations. Signed-off-by: Eamon Xiong <eamonxiong@gmail.com>
39 lines
740 B
JavaScript
39 lines
740 B
JavaScript
'use strict';
|
|
'require ui';
|
|
'require view';
|
|
|
|
return view.extend({
|
|
render() {
|
|
const form = document.querySelector('form');
|
|
const btn = document.querySelector('button');
|
|
|
|
const dlg = ui.showModal(
|
|
_('Authorization Required'),
|
|
Array.from(document.querySelectorAll('section > *')),
|
|
'login'
|
|
);
|
|
|
|
form.addEventListener('keypress', (ev) => {
|
|
if (ev.key === 'Enter')
|
|
btn.click();
|
|
});
|
|
|
|
btn.addEventListener('click', () => {
|
|
dlg.querySelectorAll('*').forEach((node) => {
|
|
node.style.display = 'none';
|
|
});
|
|
dlg.appendChild(E('div', {
|
|
class: 'spinning'
|
|
}, _('Logging in…')));
|
|
|
|
form.submit();
|
|
});
|
|
|
|
document.querySelector('input[type="password"]').focus();
|
|
|
|
return '';
|
|
},
|
|
|
|
addFooter() {},
|
|
|
|
}); |