| | |
| | | |
| | | times_timer = setTimeout(function(){ loadTimes(); loadRoute(); }, ttss_refresh); |
| | | }).fail(fail_ajax).always(loading_end); |
| | | return times_xhr; |
| | | } |
| | | |
| | | function loadRoute(tripId, vehicleInfo) { |
| | |
| | | route_table.appendChild(tr); |
| | | } |
| | | }).fail(fail_ajax); |
| | | return route_xhr; |
| | | } |
| | | |
| | | function startTimer(date) { |
| | |
| | | var text_name; |
| | | for(var i = 0; i < elements.length; i++) { |
| | | text_name = elements[i].dataset.translate; |
| | | if(lang[text_name] == undefined) { |
| | | if(typeof lang[text_name] === 'undefined') { |
| | | console.log('Missing translation: ' + text_name); |
| | | continue; |
| | | } |
| | |
| | | for(var i = 0, il = data.length; i < il; i++) { |
| | | var opt = document.createElement('option'); |
| | | opt.value = data[i].id; |
| | | setText(opt, data[i].id.substr(0,1) == 'b' ? lang.select_stop_bus.replace('$stop', data[i].name) : lang.select_stop_tram.replace('$stop', data[i].name)); |
| | | setText(opt, lang.select_stop_type[data[i].id.substr(0,1)].replace('$stop', data[i].name)); |
| | | stop_name_autocomplete.appendChild(opt); |
| | | } |
| | | |
| | | if(!stop_id) setText(refresh_text, lang.select_stop_click_go); |
| | | }).fail(fail_ajax); |
| | | return stop_name_autocomplete_xhr; |
| | | } |
| | | |
| | | function init() { |
| | | if(!window.jQuery) { |
| | | fail(lang.jquery_not_loaded); |
| | | return; |
| | | } |
| | | |
| | | $.ajaxSetup({ |
| | | dataType: 'json', |
| | | timeout: 10000, |
| | | }); |
| | | |
| | | lang_select.addEventListener('input', function(e) { |
| | | change_language(lang_select.value); |
| | | }); |