From 326ad34b82e744b98d3341f3b70d64406f73ebc9 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Thu, 31 Jan 2019 13:35:54 +0000 Subject: [PATCH] Verify longitude and latitude are present before adding feature --- common.js | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/common.js b/common.js index f4afeef..069a957 100644 --- a/common.js +++ b/common.js @@ -1,13 +1,16 @@ // Special directions var special_directions = { - 'Zajezdnia Nowa Huta' : 'NH', - 'Zajezdnia Podgórze' : 'P', + 'Zajezdnia Nowa Huta' : 'ZH', + 'Zajezdnia Podgórze' : 'ZP', + 'Zjazd do zajezdni' : 'Z', + 'Wyjazd na linię' : 'W', + 'Przejazd techniczny' : 'PT', }; var script_version; var script_version_xhr; -var vehicles_info; +var vehicles_info = {}; // Check for website updates function checkVersion() { @@ -105,10 +108,10 @@ } function tramIdToVehicleId(tramId) { - if(0 <= tramId && tramId <= 999) { - var vehicleId = '0000' + (tramId + 736); - vehicleId = vehicleId.substr(vehicleId.length - 4) - return '635218529567218' + vehicleId; + for(var prop in vehicles_info) { + if(vehicles_info[prop]['num'].substr(2) == tramId) { + return prop; + } } } -- Gitblit v1.9.1