diff --git a/examples/archive.html b/examples/archive.html
index de037b455..aa870dce9 100644
--- a/examples/archive.html
+++ b/examples/archive.html
@@ -26,7 +26,7 @@
@@ -50,10 +50,12 @@ Welcome to MapKnitter Lite
+
@@ -72,6 +74,8 @@ Images
let input = document.getElementById('input');
let responseText = document.getElementById('response');
let imageContainer = document.getElementById('imgContainer');
+ let modalToggle = document.getElementById('modalToggle')
+ let mapToggle = document.getElementById('mapToggle')
const setupMap = () => {
map = L.map('map').setView([51.505, -0.09], 13);
@@ -113,25 +117,7 @@ Images
fetchedFrom.appendChild(fetchedFromUrl)
placeButton.classList.add('btn', 'btn-sm', 'btn-outline-secondary', 'place-button');
- placeButton.innerHTML = 'Place on map ';
-
- placeButton.addEventListener('click', (event) => {
- if(!placeButton.getElementsByClassName('fa-spinner')[0]){
- const spinner = document.createElement('i')
- spinner.setAttribute('class', "fa fa-spinner fa-spin")
- spinner.setAttribute('font-family', 'font awesome')
-
- placeButton.appendChild(spinner)
-
- let imageURL = event.target.previousElementSibling.src;
- let image = L.distortableImageOverlay(imageURL);
- map.imgGroup.addLayer(image)
-
- image.addEventListener('load', () => {
- placeButton.removeChild(spinner)
- })
- }
- })
+ placeButton.innerHTML = 'Place on map';
image.src = `${url.replace('metadata', 'download')}/${file.name}`;
@@ -156,8 +142,29 @@ Images
});
welcomeModal.addEventListener('hidden.bs.modal', (event) => {
- new bootstrap.Offcanvas(sidebar).show();
+ new bootstrap.Offcanvas(sidebar).show();
});
+
+ map.addEventListener('click', (event)=>{
+ sidebar.classList.remove('show')
+ })
+
+ mapToggle.addEventListener('click', (event)=>{
+ new bootstrap.Offcanvas(sidebar).show();
+ })
+ modalToggle.addEventListener('click', (event)=>{
+ if(sidebar.classList.contains('show')){
+ sidebar.classList.remove('show')
+ }
+ })
+
+ document.addEventListener("click", (event) => {
+ if (event.target.classList.contains('place-button')) {
+ let imageURL = event.target.previousElementSibling.src;
+ let image = L.distortableImageOverlay(imageURL);
+ map.imgGroup.addLayer(image);
+ }
+ });
-