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 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

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