Improved www.ttss.krakow.pl
Jacek Kowalski
2018-12-17 439d60588132d1a97150c431692f661a5c8d5fc1
Fix display of schedules for unknown vehicles
3 files modified
21 ■■■■ changed files
INSTALL.md 1 ●●●● patch | view | raw | blame | history
common.js 1 ●●●● patch | view | raw | blame | history
map.js 19 ●●●● patch | view | raw | blame | history
INSTALL.md
@@ -4,6 +4,7 @@
Webserver with PHP 5.4+ (PHP 7+ recommended) and modules:
- iconv,
- mbstring,
- PDO,
- PDO SQLite.
common.js
@@ -80,7 +80,6 @@
function parseVehicle(vehicleId) {
    if(!vehicleId) return false;
    if(vehicleId.substr(0, 15) != '635218529567218') {
        console.log('Unknown vehicle, vehicleId=' + vehicleId);
        return false;
    }
    
map.js
@@ -422,14 +422,12 @@
        case 'v':
            type = lang.type_vehicle;
            
            if(!feature.get('vehicle_type')) {
                break;
            }
            var span = displayVehicle(feature.get('vehicle_type'));
            
            additional = document.createElement('p');
            setText(additional, span.title);
            if(span.title) {
                setText(additional, span.title);
            }
            additional.insertBefore(span, additional.firstChild);
            
            addElementWithText(thead, 'th', lang.header_time);
@@ -529,11 +527,11 @@
        tramId = parseInt(window.location.hash.substr(3));
    } else if(window.location.hash.match(/^#![A-Za-z]{2}[0-9]{3}$/)) {
        tramId = parseInt(window.location.hash.substr(4));
    } else if(window.location.hash.match(/^#!v[0-9]+$/)) {
    } else if(window.location.hash.match(/^#!v-?[0-9]+$/)) {
        vehicleId = window.location.hash.substr(3);
    } else if(window.location.hash.match(/^#!s[0-9]+$/)) {
    } else if(window.location.hash.match(/^#!s-?[0-9]+$/)) {
        stopId = window.location.hash.substr(3);
    } else if(window.location.hash.match(/^#!p[0-9]+$/)) {
    } else if(window.location.hash.match(/^#!p-?[0-9]+$/)) {
        stopPointId = window.location.hash.substr(3);
    }
    
@@ -670,7 +668,10 @@
                var type = '';
                switch(feature.getId().substr(0, 1)) {
                    case 'v':
                        type = lang.type_vehicle + ' ' + feature.get('vehicle_type').num;
                        type = lang.type_vehicle;
                        if(feature.get('vehicle_type').num) {
                            type += ' ' + feature.get('vehicle_type').num;
                        }
                    break;
                    case 's':
                        type = lang.type_stop;