button state helper
*/
function updateButtons() {
- const buttons = document.querySelectorAll('#btnClear, #btnCreate, #btnSave, #btnUpload, #btnDownload');
+ const enable = function (id) {
+ const btn = document.getElementById(id);
+ if (btn) {
+ btn.removeAttribute('disabled');
+ }
+ };
if (fileSize === 0) {
- if (buttons[1]) buttons[1].removeAttribute('disabled');
- if (buttons[2]) buttons[2].removeAttribute('disabled');
+ enable('btnCreate');
+ enable('btnUpload');
} else {
- if (buttons[0]) buttons[0].removeAttribute('disabled');
- if (buttons[3]) buttons[3].removeAttribute('disabled');
- if (buttons[4]) buttons[4].removeAttribute('disabled');
+ enable('btnDownload');
+ enable('btnClear');
+ enable('btnSave');
}
}
}
if (info) {
setText('domains', info.blocked_domains);
- setText('feeds', info.active_feeds?.join(' '));
+ setText('feeds', info.active_feeds?.join(', '));
setText('backend', info.dns_backend);
setText('ifaces', info.run_ifaces);
setText('run', info.run_information);