From 439d60588132d1a97150c431692f661a5c8d5fc1 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Mon, 17 Dec 2018 09:50:55 +0000
Subject: [PATCH] Fix display of schedules for unknown vehicles
---
map.js | 19 ++++++++++---------
common.js | 1 -
INSTALL.md | 1 +
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/INSTALL.md b/INSTALL.md
index 06a6bdb..7565fcb 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -4,6 +4,7 @@
Webserver with PHP 5.4+ (PHP 7+ recommended) and modules:
- iconv,
+- mbstring,
- PDO,
- PDO SQLite.
diff --git a/common.js b/common.js
index 6a18a8c..a22a086 100644
--- a/common.js
+++ b/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;
}
diff --git a/map.js b/map.js
index 0c553fb..ee37cd9 100644
--- a/map.js
+++ b/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;
--
Gitblit v1.9.1