From 2b645413fc163863d000bddde5bc27a836321422 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Sat, 13 Apr 2019 23:06:48 +0000 Subject: [PATCH] Get rid of jQuery dependency - use XHR and Promise --- index.js | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 3000b78..e59ca07 100644 --- a/index.js +++ b/index.js @@ -176,6 +176,7 @@ times_timer = setTimeout(function(){ loadTimes(); loadRoute(); }, ttss_refresh); }).fail(fail_ajax).always(loading_end); + return times_xhr; } function loadRoute(tripId, vehicleInfo) { @@ -239,6 +240,7 @@ route_table.appendChild(tr); } }).fail(fail_ajax); + return route_xhr; } function startTimer(date) { @@ -375,19 +377,10 @@ 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); }); -- Gitblit v1.9.1