diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-04-23 22:27:13 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-04-23 22:27:13 +0200 |
commit | 6c1cae86f4fa343b4f165f80a4e42eba37fa917c (patch) | |
tree | 273fcc63fd249a766b39855f5dc3f60b4dcecb26 /public/static/js/travelynx-actions.js | |
parent | ffaa0c44a78bb4bab632fcb76b668215da4c0a82 (diff) |
Primitive auto-refresh of current journey status
Todo: Redirect user to destination station upon arrival
Diffstat (limited to 'public/static/js/travelynx-actions.js')
-rw-r--r-- | public/static/js/travelynx-actions.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js index 583c806..b1e4d43 100644 --- a/public/static/js/travelynx-actions.js +++ b/public/static/js/travelynx-actions.js @@ -17,7 +17,16 @@ function tvly_run(link, req, err_callback) { } }); } -$(document).ready(function() { +function tvly_update() { + $.get('/ajax/status_card.html', function(data) { + $('.statuscol').html(data); + tvly_reg_handlers(); + setTimeout(tvly_update, 15000); + }).fail(function() { + setTimeout(tvly_update, 15000); + }); +} +function tvly_reg_handlers() { $('.action-checkin').click(function() { var link = $(this); var req = { @@ -78,4 +87,10 @@ $(document).ready(function() { tvly_run(link, req); } }); +} +$(document).ready(function() { + tvly_reg_handlers(); + if ($('.statuscol .autorefresh').length) { + setTimeout(tvly_update, 15000); + } }); |