diff --git a/init-server.py b/init-server.py index 0d09274..1e25fd0 100755 --- a/init-server.py +++ b/init-server.py @@ -40,7 +40,7 @@ def prepare_venv(c): permissions='755', owner='ofm', ) - sudo_cmd(c, f'cd {OFM_DIR} && source prepare-virtualenv.sh', user='ofm') + sudo_cmd(c, f'cd {OFM_DIR} && source prepare-virtualenv.sh') def prepare_tile_gen(c): diff --git a/website/assets/map_howto.js b/website/assets/map_howto.js index 2bbe269..904dec6 100644 --- a/website/assets/map_howto.js +++ b/website/assets/map_howto.js @@ -1,22 +1,30 @@ -const map = new maplibregl.Map({ - style: 'https://tiles.openfreemap.org/styles/liberty', - center: [-0.114, 51.506], - zoom: 14.2, - bearing: 55.2, - pitch: 60, - container: 'map', - boxZoom: false, - doubleClickZoom: false, - scrollZoom: false, -}) +function initMap(div) { + const map = new maplibregl.Map({ + style: 'https://tiles.openfreemap.org/styles/liberty', + center: [-0.114, 51.506], + zoom: 14.2, + bearing: 55.2, + pitch: 60, + container: div, + // boxZoom: false, + // doubleClickZoom: false, + // scrollZoom: false, + }) + window.map = map -let nav = new maplibregl.NavigationControl({ showCompass: false }) -map.addControl(nav, 'top-right') + let nav = new maplibregl.NavigationControl({ showCompass: false }) + map.addControl(nav, 'top-right') -let scale = new maplibregl.ScaleControl() -map.addControl(scale) + let scale = new maplibregl.ScaleControl() + map.addControl(scale) -new maplibregl.Marker().setLngLat([-0.119, 51.507]).addTo(map) + new maplibregl.Marker().setLngLat([-0.119, 51.507]).addTo(map) +} + +const mapDiv = document.getElementById('map') +mapDiv.onclick = function () { + initMap(mapDiv) +} function selectStyle(style) { const styleUrl = 'https://tiles.openfreemap.org/styles/' + style diff --git a/website/assets/mapbg.jpg b/website/assets/mapbg.jpg new file mode 100644 index 0000000..4616d57 Binary files /dev/null and b/website/assets/mapbg.jpg differ diff --git a/website/assets/style.css b/website/assets/style.css index 8973c7e..47d3e7c 100644 --- a/website/assets/style.css +++ b/website/assets/style.css @@ -162,6 +162,14 @@ code { margin-bottom: 2em; } +#map:not(.maplibregl-map) { + background-image: url('mapbg.jpg'); + background-size: cover; + background-position: center; + background-repeat: no-repeat; + cursor: pointer; +} + button { border: 0; border-radius: 0.25rem; diff --git a/website/generate.py b/website/generate.py index 5664db9..19dd35f 100755 --- a/website/generate.py +++ b/website/generate.py @@ -43,6 +43,7 @@ def copy_assets(): 'favicon.ico', 'github.svg', 'x.svg', + 'mapbg.jpg', ]: shutil.copyfile(ASSETS_DIR / file, OUT_DIR / file) diff --git a/website/subscribe.html b/website/subscribe.html index 66e42a4..87c550e 100644 --- a/website/subscribe.html +++ b/website/subscribe.html @@ -6,7 +6,6 @@ OpenFreeMap subscribe -