Improved www.ttss.krakow.pl
Jacek Kowalski
2019-04-14 3dd66f8955393dfd5a6f8cd1dd86f8281b517b40
Switching between tram and bus stops in timetables (limited)

Search results with both tram and bus stops must be loaded
2 files modified
23 ■■■■■ changed files
index.html 2 ●●● patch | view | raw | blame | history
index.js 21 ●●●●● patch | view | raw | blame | history
index.html
@@ -129,7 +129,7 @@
                    
                    <p class="small" data-translate="help_text">Względne czasy (np. 3 min) są podawane na podstawie faktycznej lokalizacji pojazdów. Czasy bezwzględne (np. 8:01) to odjazdy rozkładowe, pokazywane gdy pojazd nie może być zlokalizowany. "?" oznacza nieznane opóźnienie.</p>
                    
                    <p class="small">&copy; 2016-2017 Jacek Kowalski - <a href="https://github.com/jacekkow/mpk-ttss" data-translate="help_source">Źródło</a> - <a href="https://raw.githubusercontent.com/jacekkow/mpk-ttss/master/LICENSE" data-translate="help_license">Licencja</a></p>
                    <p class="small">&copy; 2016-2019 Jacek Kowalski - <a href="https://github.com/jacekkow/mpk-ttss" data-translate="help_source">Źródło</a> - <a href="https://raw.githubusercontent.com/jacekkow/mpk-ttss/master/LICENSE" data-translate="help_license">Licencja</a></p>
                </div>
            </div>
        </div>
index.js
@@ -99,6 +99,16 @@
    window.location.hash = '#!' + language + stopId;
    refresh_button.removeAttribute('disabled');
    
    var alternative_stop = null;
    var candidate = null;
    for(var i = 0; i < stop_name_autocomplete.options.length; i++) {
        candidate = stop_name_autocomplete.options[i].value;
        if(candidate.substr(0, 1) != prefix && candidate.substr(1) == stop) {
            alternative_stop = candidate;
            break;
        }
    }
    times_xhr = $.get(
        url + '/services/passageInfo/stopPassages/stop'
            + '?stop=' + encodeURIComponent(stop)
@@ -111,6 +121,17 @@
        deleteChildren(times_table);
        //deleteChildren(times_lines);
        
        if(alternative_stop !== null) {
            var a = addParaWithText(times_alerts, '');
            a = addElementWithText(a, 'a', (prefix == 'b' ? lang.departures_for_trams : lang.departures_for_buses));
            a.href = '';
            a.onclick = function(e) {
                e.preventDefault();
                loadTimes(alternative_stop);
            };
        }
        for(var i = 0, il = data.generalAlerts.length; i < il; i++) {
            addParaWithText(times_alerts, data.generalAlerts[i].title);
        }