From 5984211d1f0766f5e6522a23707564362cf98ffe Mon Sep 17 00:00:00 2001 From: Kevin Craine Date: Fri, 4 Jan 2013 08:33:01 -0500 Subject: [PATCH] Added colors that change as the date gets closer --- examples/gcm/js/cnMapFilter.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/examples/gcm/js/cnMapFilter.js b/examples/gcm/js/cnMapFilter.js index ca81075..0c47f89 100644 --- a/examples/gcm/js/cnMapFilter.js +++ b/examples/gcm/js/cnMapFilter.js @@ -209,9 +209,29 @@ MarkerClass.prototype.init = function ( eventObj, gMap ) { this.coordsStr = eventObj.getCoordsStr(); this.eventList = [eventObj.id]; + var pinColor, today = addDay = new Date(); + if (eventObj.dateStart <= addDay.setDate(today.getDate() + 7)) { + pinColor = "FF4040"; + } else if (eventObj.dateStart <= addDay.setDate(today.getDate() + 30)) { + pinColor = "00FF00"; + } else if (eventObj.dateStart <= addDay.setDate(today.getDate() + 60)) { + pinColor = "B0FFB0"; + } else { + pinColor = "FFFFFF"; + } + var pinImage = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + pinColor, + new google.maps.Size(21, 34), + new google.maps.Point(0,0), + new google.maps.Point(10, 34)); + var pinShadow = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_shadow", + new google.maps.Size(40, 37), + new google.maps.Point(0, 0), + new google.maps.Point(12, 35)); this.googleMarker = new google.maps.Marker({ position: new google.maps.LatLng(eventObj.lt, eventObj.lg), - map: gMap + map: gMap, + icon: pinImage, + shadow: pinShadow }); // associate with eventObj