From 81230deb1ff6ec179cd84ecdeaf9ae891b256d55 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 17 Jun 2020 16:10:39 +0300 Subject: Move map logic to main.js --- bh20simplewebuploader/static/main.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bh20simplewebuploader/static') diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js index 7361a99..0556fb7 100644 --- a/bh20simplewebuploader/static/main.js +++ b/bh20simplewebuploader/static/main.js @@ -13,14 +13,27 @@ function myFunction() { } } +let map = L.map( 'map', { + center: [37.0902, -95.7129], // Default to U.S.A + minZoom: 3, + zoom: 0 +}); +L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap', + subdomains: ['a','b','c'] +}).addTo( map ); + function fetchAPI(apiEndPoint) { fetch(scriptRoot + apiEndPoint) .then(response => { return response.json(); }) .then(data => { + console.log(data); document.getElementById("results").classList.remove("invisible"); document.getElementById("loader").classList.add("invisible"); + // Reload the map + map.invalidateSize(); }); document.getElementById("results").classList.add("invisible"); document.getElementById("loader").classList.remove("invisible"); -- cgit v1.2.3