mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 17:04:35 +04:00
luci-theme-bootstrap: use ES6 syntax
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>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
return baseclass.extend({
|
||||
__init__() {
|
||||
ui.menu.load().then(L.bind(this.render, this));
|
||||
ui.menu.load().then((tree) => this.render(tree));
|
||||
},
|
||||
|
||||
render(tree) {
|
||||
|
||||
@@ -3,26 +3,30 @@
|
||||
'require view';
|
||||
|
||||
return view.extend({
|
||||
render: function() {
|
||||
var form = document.querySelector('form'),
|
||||
btn = document.querySelector('button');
|
||||
render() {
|
||||
const form = document.querySelector('form');
|
||||
const btn = document.querySelector('button');
|
||||
|
||||
var dlg = ui.showModal(
|
||||
const dlg = ui.showModal(
|
||||
_('Authorization Required'),
|
||||
[].slice.call(document.querySelectorAll('section > *')),
|
||||
Array.from(document.querySelectorAll('section > *')),
|
||||
'login'
|
||||
);
|
||||
|
||||
form.addEventListener('keypress', function(ev) {
|
||||
if (ev.key == 'Enter')
|
||||
form.addEventListener('keypress', (ev) => {
|
||||
if (ev.key === 'Enter')
|
||||
btn.click();
|
||||
});
|
||||
|
||||
btn.addEventListener('click', function() {
|
||||
dlg.querySelectorAll('*').forEach(function(node) { node.style.display = 'none' });
|
||||
dlg.appendChild(E('div', { 'class': 'spinning' }, _('Logging in…')));
|
||||
btn.addEventListener('click', () => {
|
||||
dlg.querySelectorAll('*').forEach((node) => {
|
||||
node.style.display = 'none';
|
||||
});
|
||||
dlg.appendChild(E('div', {
|
||||
class: 'spinning'
|
||||
}, _('Logging in…')));
|
||||
|
||||
form.submit()
|
||||
form.submit();
|
||||
});
|
||||
|
||||
document.querySelector('input[type="password"]').focus();
|
||||
@@ -30,5 +34,6 @@ return view.extend({
|
||||
return '';
|
||||
},
|
||||
|
||||
addFooter: function() {}
|
||||
});
|
||||
addFooter() {},
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user