Commit e581a5ba2b488b779d26788fde980df823b79747
- Diff rendering mode:
- inline
- side by side
mouchak/static/js/leaflet.js
(11 / 5)
  | |||
18 | 18 | return; | |
19 | 19 | } | |
20 | 20 | ||
21 | |||
21 | 22 | function getColor(d){ | |
22 | return d > 3 ? "#fecc5c" : | ||
23 | d > 2 ? "#f03b20" : | ||
24 | "#b10026"; | ||
23 | return d > 9 ? "#5E4FA2" : | ||
24 | d > 8 ? "#3288BD" : | ||
25 | d > 7 ? "#66C2A5" : | ||
26 | d > 6 ? "#ABDDA4" : | ||
27 | d > 5 ? "#E6F598" : | ||
28 | d > 4 ? "#FEE08B" : | ||
29 | d > 2 ? "#D53E4F" : | ||
30 | "#9E0142"; | ||
25 | 31 | ||
26 | 32 | } | |
27 | 33 | var india_map = L.tileLayer('http://{s}.tile.cloudmade.com/157f9082094e402f89d242e9b9144483/997/256/{z}/{x}/{y}.png', { | |
… | … | ||
52 | 52 | // info.policyExplain(props.rating) + '</small></p>' | |
53 | 53 | new L.Popup() | |
54 | 54 | .setLatLng(e.latlng) | |
55 | .setContent("<div style='height:250px;overflow-y:scroll;'><b>"+e.target.feature.properties.name+"</b></br><span class='yellow'>"+M.filterTags(['rating'], e.target.feature.properties.id)[0].attributes.data +"</span>/<span class='red'>5</span><small>>> "+info.policyExplain(e.target.feature.properties.rating)+"</small></br>Pros:"+e.target.feature.properties.pros+"</br>Cons:"+e.target.feature.properties.cons+"</br><a href='#/funding'>Funding</a><br/><a href='#/policies/"+e.target.feature.id+"'>Read more...</a></br></div>") | ||
55 | .setContent("<div style='height:250px;overflow-y:scroll;'><b>"+e.target.feature.properties.name+"</b></br><span class='yellow'>Rating:"+M.filterTags(['rating'], e.target.feature.id)[0].attributes.data.match(/Rating: (\d+)/)[1] +"</span>/<span class='red'>5</span><small>>> "+info.policyExplain(M.filterTags(['rating'], e.target.feature.id)[0].attributes.data.match(/Rating: (\d+)/)[1])+"</small></br>Pros:"+M.filterTags(["pros"], e.target.feature.id)[0].attributes.data+"</br>Cons:"+M.filterTags(["cons"], e.target.feature.id)[0].attributes.data +"</br><a href='#/funding'>Funding</a><br/><a href='#/policies/"+e.target.feature.id+"'>Read more...</a></br></div>") | ||
56 | 56 | .openOn(map); | |
57 | 57 | ||
58 | 58 | // info.update(layer.feature.properties); | |
… | … | ||
86 | 86 | function(feature){ | |
87 | 87 | return{ | |
88 | 88 | weight:1, | |
89 | fillColor: getColor(feature.properties.rating), | ||
89 | fillColor: getColor(M.filterTags(['rating'], feature.id)[0].attributes.data.match(/Rating: (\d+)/)[1]), | ||
90 | 90 | opacity:0, | |
91 | 91 | //color:'white', | |
92 | 92 | dashArray:'3', |