debisoft commited on
Commit
3a5876b
·
1 Parent(s): 70fd8f1

Add load function

Browse files
Files changed (1) hide show
  1. main.py +11 -6
main.py CHANGED
@@ -8,11 +8,15 @@ style="""
8
  """
9
 
10
  js = """
11
- var map = L.map('mapid').setView([51.505, -0.09], 13);
12
- L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
13
- maxZoom: 19,
14
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
15
- }).addTo(map);
 
 
 
 
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"), Div(id='mapid'),
 
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: '&copy; <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