diff --git a/test.css b/test.css index 8364c55..f370c0e 100644 --- a/test.css +++ b/test.css @@ -1,4 +1,5 @@ body { + font-family: sans-serif; background: #909090; } diff --git a/test.html b/test.html index f5ba7cc..5814b8e 100644 --- a/test.html +++ b/test.html @@ -14,20 +14,38 @@ + - Map:
- Date Selector: -
- -
- From 07:00 to 09:00. -
+
+

Date Selector:

+
+ Thursday + Friday + Saturday + Sunday +
+
+

+ From 07:00 to 09:00. +

+
+
+
+
+
+
+
+

+ Time limits 5 minutes, 10 minutes, 20 minutes, 30 minutes. +

+
+
0
+
+
+
+
60
+
diff --git a/test.js b/test.js index cee579e..6b5c343 100644 --- a/test.js +++ b/test.js @@ -142,6 +142,10 @@ function max_interval(stops, from, to) { prev = time; }); var last = to - prev; + if (max_int == 0) { + // Handle empty intervals + return to-from; + } return max(max_int, last); } @@ -159,6 +163,18 @@ function get_color(interval) { } } +function format_stops(stops) { + var result = []; + result.push(""); + return result.join(""); +} + var zs = { "#14ff14": 4, "#ffff14": 3, @@ -183,7 +199,18 @@ function update_lines() { var z = zs[color]; if (color != null) { var path = [new google.maps.LatLng(from[1][1], from[1][0]), new google.maps.LatLng(to[1][1], to[1][0])]; - var line = new google.maps.Polyline({map: map, path: path, strokeColor: color}); + var line = new google.maps.Polyline({map: map, path: path, strokeColor: color, zIndex: z}); + var infowindow = null; + google.maps.event.addListener(line, 'click', function(event) { + if (infowindow == null) { + infowindow = new google.maps.InfoWindow({ + content: format_stops(stops), + position: event.latLng, + }); + } + infowindow.setPosition(event.latLng); + infowindow.open(map); + }); lines.push(line); } }); @@ -193,6 +220,12 @@ function selected_url() { return $('input:radio[name=day]:checked').val(); } +function on_click() { + var infowindow = new google.maps.InfoWindow({ + content: contentString + }); +} + function initialize() { var myOptions = { zoom: 16,