Improved www.ttss.krakow.pl
Jacek Kowalski
2019-04-14 b6f8e3c550e6b24c340b5d46a9a311a7afe25d55
Show "no data" when schedule for selected bus/tram is not returned
5 files modified
16 ■■■■ changed files
index.html 2 ●●● patch | view | raw | blame | history
lang_en.js 1 ●●●● patch | view | raw | blame | history
lang_pl.js 1 ●●●● patch | view | raw | blame | history
map.html 2 ●●● patch | view | raw | blame | history
map.js 10 ●●●●● patch | view | raw | blame | history
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>
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',
    
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',
    
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>
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);