|
7 | 7 |
|
8 | 8 | from jinja2 import Template |
9 | 9 |
|
| 10 | +_default_js = [ |
| 11 | + ('iso8601', |
| 12 | + 'https://rawcdn.githack.com/nezasa/iso8601-js-period/master/iso8601.min.js'), |
| 13 | + ('leaflet.timedimension.min.js', |
| 14 | + 'https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'), |
| 15 | + ('heatmap.min.js', |
| 16 | + 'https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js'), |
| 17 | + ('leaflet-heatmap.js', |
| 18 | + 'https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/pa7_leaflet_hm.min.js'), |
| 19 | + ] |
| 20 | + |
| 21 | +_default_css = [ |
| 22 | + ('leaflet.timedimension.control.min.css', |
| 23 | + 'https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css') |
| 24 | + ] |
| 25 | + |
10 | 26 |
|
11 | 27 | class HeatMapWithTime(Layer): |
12 | 28 | """ |
@@ -161,26 +177,13 @@ def render(self, **kwargs): |
161 | 177 | assert isinstance(figure, Figure), ('You cannot render this Element ' |
162 | 178 | 'if it is not in a Figure.') |
163 | 179 |
|
164 | | - figure.header.add_child( |
165 | | - JavascriptLink('https://rawcdn.githack.com/nezasa/iso8601-js-period/master/iso8601.min.js'), # noqa |
166 | | - name='iso8601') |
167 | | - |
168 | | - figure.header.add_child( |
169 | | - JavascriptLink('https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'), # noqa |
170 | | - name='leaflet.timedimension.min.js') |
171 | | - |
172 | | - figure.header.add_child( |
173 | | - JavascriptLink( |
174 | | - 'https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js'), # noqa |
175 | | - name='heatmap.min.js') |
| 180 | + # Import Javascripts |
| 181 | + for name, url in _default_js: |
| 182 | + figure.header.add_child(JavascriptLink(url), name=name) |
176 | 183 |
|
177 | | - figure.header.add_child( |
178 | | - JavascriptLink('https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/pa7_leaflet_hm.min.js'), # noqa |
179 | | - name='leaflet-heatmap.js') |
180 | | - |
181 | | - figure.header.add_child( |
182 | | - CssLink('https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css'), # noqa |
183 | | - name='leaflet.timedimension.control.min.css') |
| 184 | + # Import Css |
| 185 | + for name, url in _default_css: |
| 186 | + figure.header.add_child(CssLink(url), name=name) |
184 | 187 |
|
185 | 188 | figure.header.add_child( |
186 | 189 | Element( |
|
0 commit comments