From 6973bdb093bbab85c0d7a98b563007d8a114981c Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Mon, 6 Apr 2020 00:19:43 +0200 Subject: [PATCH] fix chrome incompatibility --- index.html | 12 ++++------ index.js | 67 ++++++++++++++++++++++++++++++------------------------ 2 files changed, 42 insertions(+), 37 deletions(-) diff --git a/index.html b/index.html index 542b823..21f91d5 100644 --- a/index.html +++ b/index.html @@ -5,8 +5,11 @@ OpenWrt Firmware Selector + + + - +
@@ -16,7 +19,7 @@ Logo
- @@ -81,10 +84,5 @@
- - - - - diff --git a/index.js b/index.js index cdd4d6f..eb0a469 100644 --- a/index.js +++ b/index.js @@ -346,40 +346,47 @@ function updateImages(version, code, date, model, url, mobj, is_custom) { } } -setupSelectList($('versions'), Object.keys(config.versions), version => { - fetch(config.versions[version]).then(data => { - data.json().then(obj => { - setupAutocompleteList($('models'), Object.keys(obj['models']), model => { - if (model in obj['models']) { - var url = obj.url; - var code = obj.version_code; - var date = obj.build_data || 'unknown'; - var mobj = obj['models'][model]; - updateImages(version, code, date, model, url, mobj, false); - current_model = mobj; - } else { - updateImages(); - current_model = {}; - } - }); +function init() { + setupSelectList($('versions'), Object.keys(config.versions), version => { + fetch(config.versions[version]).then(data => { + data.json().then(obj => { + setupAutocompleteList($('models'), Object.keys(obj['models']), model => { + if (model in obj['models']) { + var url = obj.url; + var code = obj.version_code; + var date = obj.build_data || 'unknown'; + var mobj = obj['models'][model]; + updateImages(version, code, date, model, url, mobj, false); + current_model = mobj; + } else { + updateImages(); + current_model = {}; + } + }); - // trigger model update when selected version changes - $('models').onfocus(); + // trigger model update when selected version changes + $('models').onfocus(); + }); }); }); -}); -if (config.asu_url) { - show('custom'); -} + if (config.asu_url) { + show('custom'); + } -// hide fields -updateImages(); + // hide fields + updateImages(); -var user_lang = (navigator.language || navigator.userLanguage).split('-')[0]; -if (user_lang in translations) { - config.language = user_lang; - $('language-selection').value = user_lang; -} + var user_lang = (navigator.language || navigator.userLanguage).split('-')[0]; + if (user_lang in translations) { + config.language = user_lang; + $('language-selection').value = user_lang; + } + + translate(); -translate(); + $('language-selection').onclick = function() { + config.language = this.children[this.selectedIndex].value; + translate(); + } +} -- 2.30.2