From 9fc40c33f26fec7247f23907ac5b7019bda0996c Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Tue, 29 May 2012 13:02:52 +0200 Subject: car2go stuff --- car2go-ptv/ptv.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 car2go-ptv/ptv.js (limited to 'car2go-ptv/ptv.js') diff --git a/car2go-ptv/ptv.js b/car2go-ptv/ptv.js new file mode 100644 index 0000000..3b08523 --- /dev/null +++ b/car2go-ptv/ptv.js @@ -0,0 +1,27 @@ +var btnFilter = document.createElement("button"); +btnFilter.innerHTML = "Nur < 25% anzeigen"; +btnFilter.onclick = function() { + ptvMap.clearVectorLayer(); + var selectedVehicles = []; + + for (var i in ptvMap.data.vehicles) { + var v = ptvMap.data.vehicles[i]; + if (typeof(v.tooltip) === "undefined") + continue; + var tank = v.tooltip.data[3].value.match(/\d+/)[0]; + if (parseInt(tank) < 25) { + selectedVehicles.push(v); + } + } + ptvMap.addVehicles(selectedVehicles); +} +document.getElementById("content").appendChild(btnFilter); + +var btnUnfilter = document.createElement("button"); +btnUnfilter.innerHTML = "Alle Anzeigen"; +btnUnfilter.onclick = function() { + ptvMap.clearVectorLayer(); + ptvMap.addVehicles(ptvMap.data.vehicles); +} +document.getElementById("content").appendChild(btnUnfilter); + -- cgit v1.2.1