aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader
diff options
context:
space:
mode:
authorBonfaceKilz2020-06-17 16:10:39 +0300
committerBonfaceKilz2020-06-17 16:10:39 +0300
commit81230deb1ff6ec179cd84ecdeaf9ae891b256d55 (patch)
treebe406e87b2b3271bda118ccfa372ab7ee7734061 /bh20simplewebuploader
parente8dab2bef5d09f0aee6f1b6e43bcce24ca42ddcb (diff)
downloadbh20-seq-resource-81230deb1ff6ec179cd84ecdeaf9ae891b256d55.tar.gz
bh20-seq-resource-81230deb1ff6ec179cd84ecdeaf9ae891b256d55.tar.lz
bh20-seq-resource-81230deb1ff6ec179cd84ecdeaf9ae891b256d55.zip
Move map logic to main.js
Diffstat (limited to 'bh20simplewebuploader')
-rw-r--r--bh20simplewebuploader/static/main.js13
-rw-r--r--bh20simplewebuploader/templates/demo.html2
2 files changed, 13 insertions, 2 deletions
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: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
+ 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");
diff --git a/bh20simplewebuploader/templates/demo.html b/bh20simplewebuploader/templates/demo.html
index f3d2df5..76c19c4 100644
--- a/bh20simplewebuploader/templates/demo.html
+++ b/bh20simplewebuploader/templates/demo.html
@@ -22,8 +22,6 @@
span.appendChild(txt);
});
});
-
- var mymap = L.map('mapid').setView([51.505, -0.09], 13);
</script>
</body>