From b6f8e3c550e6b24c340b5d46a9a311a7afe25d55 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Sun, 14 Apr 2019 10:05:27 +0000 Subject: [PATCH] Show "no data" when schedule for selected bus/tram is not returned --- map.js | 10 +++++++++- lang_en.js | 1 + index.html | 2 +- map.html | 2 +- lang_pl.js | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 28b25ab..315a798 100644 --- a/index.html +++ b/index.html @@ -134,7 +134,7 @@ </div> </div> <script src="https://polyfill.io/v3/polyfill.min.js?features=Promise,XMLHttpRequest"></script> - <script type="text/javascript" src="lang_pl.js?v7" id="lang_script"></script> + <script type="text/javascript" src="lang_pl.js?v8" id="lang_script"></script> <script type="text/javascript" src="common.js?v8"></script> <script type="text/javascript" src="index.js?v7"></script> </body> diff --git a/lang_en.js b/lang_en.js index d97716f..3a06fa7 100644 --- a/lang_en.js +++ b/lang_en.js @@ -20,6 +20,7 @@ refresh_button: '\u27f3 Refresh', last_refreshed: 'Last refreshed: $time', loading: 'Loading...', + no_data: 'Data unavailable', line_alert_pattern: 'Line $line: $alert', diff --git a/lang_pl.js b/lang_pl.js index 794f6db..ab9a890 100644 --- a/lang_pl.js +++ b/lang_pl.js @@ -20,6 +20,7 @@ refresh_button: '\u27f3 Odśwież', last_refreshed: 'Ostatnio odświeżone $time', loading: 'Ładowanie...', + no_data: 'Brak danych', line_alert_pattern: 'Linia $line: $alert', diff --git a/map.html b/map.html index 24cea68..cfe2a8d 100644 --- a/map.html +++ b/map.html @@ -23,7 +23,7 @@ <div id="panel"></div> <script src="https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.forEach,Array.prototype.includes,Array.prototype.map,Element.prototype.classList,Promise,String.prototype.startsWith,XMLHttpRequest,requestAnimationFrame"></script> <script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v5.3.0/build/ol.js" integrity="sha384-iQkGyyH4ioz3m+maM3s9MX1Oq67mACa4B9Z3ovUv3Sv37LJ96fx3WnZfLoiC3Wfl" crossorigin="anonymous"></script> -<script tyle="text/javascript" src="lang_pl.js?v7" id="lang_script"></script> +<script tyle="text/javascript" src="lang_pl.js?v8" id="lang_script"></script> <script tyle="text/javascript" src="common.js?v8"></script> <script tyle="text/javascript" src="map.js?v20"></script> </body> diff --git a/map.js b/map.js index aefb371..c6e54d2 100644 --- a/map.js +++ b/map.js @@ -389,7 +389,7 @@ + '?tripId=' + encodeURIComponent(feature.get('tripId')) + '&mode=departure' ).done(function(data) { - if(!data.routeName || !data.directionText) { + if(typeof data.old === "undefined" || typeof data.actual === "undefined") { return; } @@ -415,6 +415,14 @@ table.appendChild(tr); } + if(all_departures.length === 0) { + tr = document.createElement('tr'); + table.appendChild(tr); + tr = addCellWithText(tr, lang.no_data); + tr.colSpan = '2'; + tr.className = 'active'; + } + markStops(stopsToMark, ttss_type, true); feature_timer = setTimeout(function() { vehicleTable(feature, table); }, ttss_refresh); -- Gitblit v1.9.1