fix settings.js for microsoft edge

This commit is contained in:
codl 2017-09-16 09:28:39 +02:00
parent cd30b6b606
commit 583dedf633
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 5 additions and 3 deletions

View File

@ -8,7 +8,8 @@ import Banner from '../components/Banner.html';
let status_timeout = null; let status_timeout = null;
let settings_section = document.querySelector('#settings-section'); let settings_section = document.querySelector('#settings-section');
let form = document.forms.settings; let form = document.querySelector('form[name=settings]');
let inputs = Array.from(form.elements)
let backoff_level = 0; let backoff_level = 0;
let banner_el = document.querySelector('.main-banner'); let banner_el = document.querySelector('.main-banner');
@ -75,7 +76,7 @@ import Banner from '../components/Banner.html';
function get_all_inputs(){ function get_all_inputs(){
let o = Object(); let o = Object();
for(let input of form.elements){ for(let input of inputs){
if(input.type != 'radio' || input.checked){ if(input.type != 'radio' || input.checked){
o[input.name] = input.value; o[input.name] = input.value;
} }
@ -102,13 +103,14 @@ import Banner from '../components/Banner.html';
}); });
} }
for(let input of form.elements){ for(let input of inputs){
input.addEventListener('change', save); input.addEventListener('change', save);
} }
// remove submit button since we're doing live updates // remove submit button since we're doing live updates
let submit = form.querySelector('input[type=submit]'); let submit = form.querySelector('input[type=submit]');
form.removeChild(submit); form.removeChild(submit);
inputs.splice(inputs.indexOf(submit), 1);
let status_display = document.createElement('span'); let status_display = document.createElement('span');
status_display.classList.add('status-display', 'hidden'); status_display.classList.add('status-display', 'hidden');