<meta charset="utf-8"/>
<title>OpenWrt Firmware Selector</title>
<link rel="stylesheet" href="index.css" />
+ <script src="i18n.js"></script>
+ <script src="config.js"></script>
+ <script src="index.js"></script>
</head>
-<body>
+<body onload="init()">
<header>
<div>
<img src="logo.png" alt="Logo">
<div style="flex-grow: 1;"></div>
- <select id="language-selection" onchange="config.language=this.children[this.selectedIndex].value; translate();" size="1">
+ <select id="language-selection" size="1">
<option value="en">English</option>
<option value="es">EspaƱol</option>
<option value="de">Deutsch</option>
</div>
</div>
</div>
-
-<script src="i18n.js"></script>
-<script src="config.js"></script>
-<script src="index.js"></script>
-
</body>
</html>
}
}
-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();
+ }
+}