|
from fasthtml.common import * |
|
|
|
app = FastHTML() |
|
rt = app.route |
|
|
|
style=""" |
|
#mapid { height: 480px; } |
|
""" |
|
|
|
js = """ |
|
function load() |
|
{ |
|
var map = L.map('mapid').setView([51.505, -0.09], 13); |
|
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { |
|
maxZoom: 19, |
|
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' |
|
}).addTo(map); |
|
//alert('loading...'); |
|
} |
|
setTimeout(load, 1000); |
|
""" |
|
|
|
@rt('/') |
|
def get(): |
|
return Titled("MinorityMap", |
|
Link(rel="stylesheet", href="https://unpkg.com/[email protected]/dist/leaflet.css"), |
|
Style(style), |
|
Script(src="https://unpkg.com/[email protected]/dist/leaflet.js"), |
|
|
|
Div(id='mapid'), |
|
Script(js) |
|
) |
|
|
|
serve() |
|
|