diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2012-05-29 13:02:52 +0200 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2012-05-29 13:02:52 +0200 |
commit | 9fc40c33f26fec7247f23907ac5b7019bda0996c (patch) | |
tree | c902f9217bc3c9572a2aea2de2e757cfdb1e16ac /car2go-ptv/ptv.js | |
parent | a920b92e1c367cc5b6b6afc635259c6dbfc4ec5b (diff) | |
download | scripts-9fc40c33f26fec7247f23907ac5b7019bda0996c.tar.gz scripts-9fc40c33f26fec7247f23907ac5b7019bda0996c.zip |
car2go stuff
Diffstat (limited to 'car2go-ptv/ptv.js')
-rw-r--r-- | car2go-ptv/ptv.js | 27 |
1 files changed, 27 insertions, 0 deletions
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); + |