Add load function
Browse files
main.py
CHANGED
@@ -8,11 +8,15 @@ style="""
|
|
8 |
"""
|
9 |
|
10 |
js = """
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
"""
|
17 |
|
18 |
@rt('/')
|
@@ -20,7 +24,8 @@ def get():
|
|
20 |
return Titled("MinorityMap",
|
21 |
Link(rel="stylesheet", href="https://unpkg.com/[email protected]/dist/leaflet.css"),
|
22 |
Style(style),
|
23 |
-
Script(src="https://unpkg.com/[email protected]/dist/leaflet.js"),
|
|
|
24 |
Script(js)
|
25 |
)
|
26 |
|
|
|
8 |
"""
|
9 |
|
10 |
js = """
|
11 |
+
function load()
|
12 |
+
{
|
13 |
+
var map = L.map('mapid').setView([51.505, -0.09], 13);
|
14 |
+
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
15 |
+
maxZoom: 19,
|
16 |
+
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
17 |
+
}).addTo(map);
|
18 |
+
}
|
19 |
+
window.onload = load;
|
20 |
"""
|
21 |
|
22 |
@rt('/')
|
|
|
24 |
return Titled("MinorityMap",
|
25 |
Link(rel="stylesheet", href="https://unpkg.com/[email protected]/dist/leaflet.css"),
|
26 |
Style(style),
|
27 |
+
Script(src="https://unpkg.com/[email protected]/dist/leaflet.js"),
|
28 |
+
Div(id='mapid'),
|
29 |
Script(js)
|
30 |
)
|
31 |
|