equal
deleted
inserted
replaced
16 }; |
16 }; |
17 |
17 |
18 function init_widgets() { |
18 function init_widgets() { |
19 Object.keys(hmi_widgets).forEach(function(id) { |
19 Object.keys(hmi_widgets).forEach(function(id) { |
20 let widget = hmi_widgets[id]; |
20 let widget = hmi_widgets[id]; |
21 let init = widget.init; |
21 widget.do_init(); |
22 if(typeof(init) == "function"){ |
|
23 try { |
|
24 init.call(widget); |
|
25 } catch(err) { |
|
26 console.log(err); |
|
27 } |
|
28 } |
|
29 if(widget.forced_frequency !== undefined) |
|
30 widget.frequency = widget.forced_frequency; |
|
31 }); |
22 }); |
32 }; |
23 }; |
33 |
24 |
34 // Open WebSocket to relative "/ws" address |
25 // Open WebSocket to relative "/ws" address |
35 var has_watchdog = window.location.hash == "#watchdog"; |
26 var has_watchdog = window.location.hash == "#watchdog"; |
262 apply_hmi_value(langname_local_index, langname); |
253 apply_hmi_value(langname_local_index, langname); |
263 switch_page(); |
254 switch_page(); |
264 } |
255 } |
265 }); |
256 }); |
266 |
257 |
|
258 // returns en_US, fr_FR or en_UK depending on selected language |
|
259 function get_current_lang_code(){ |
|
260 return cache[langcode_local_index]; |
|
261 } |
|
262 |
267 function setup_lang(){ |
263 function setup_lang(){ |
268 let current_lang = cache[lang_local_index]; |
264 let current_lang = cache[lang_local_index]; |
269 let new_lang = switch_langnum(current_lang); |
265 let new_lang = switch_langnum(current_lang); |
270 if(current_lang != new_lang){ |
266 if(current_lang != new_lang){ |
271 apply_hmi_value(lang_local_index, new_lang); |
267 apply_hmi_value(lang_local_index, new_lang); |