| | |
| | | var stop_name_form = stop_name.form; |
| | | var stop_name_autocomplete = document.getElementById('stop-name-autocomplete'); |
| | | var stop_name_autocomplete_xhr; |
| | | var stop_name_autocomplete_timer; |
| | | |
| | | var times_xhr; |
| | | var times_timer; |
| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | }); |
| | | |
| | | stop_name.addEventListener('input', function(e) { |
| | | if(!stop_name.value) return; |
| | | function stop_autocomplete() { |
| | | if(stop_name_autocomplete_xhr) stop_name_autocomplete_xhr.abort(); |
| | | |
| | | stop_name_autocomplete_xhr = $.get( |
| | |
| | | |
| | | if(!stop_id) setText(refresh_text, lang.select_stop_click_go); |
| | | }).fail(fail_ajax); |
| | | } |
| | | |
| | | 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); |
| | | }); |
| | | |
| | | stop_name.addEventListener('input', function(e) { |
| | | if(!stop_name.value) return; |
| | | if(stop_name_autocomplete_timer) clearTimeout(stop_name_autocomplete_timer); |
| | | |
| | | stop_name_autocomplete_timer = setTimeout(stop_autocomplete, 100); |
| | | }); |
| | | |
| | | setText(refresh_text, lang.enter_stop_name_to_begin); |