diff --git a/index.html b/index.html
index b52641e..b0f327a 100644
--- a/index.html
+++ b/index.html
@@ -5,6 +5,7 @@
+
Carta Archeologica di Capri
diff --git a/js/package.json b/js/package.json
index 125484c..ad7209f 100644
--- a/js/package.json
+++ b/js/package.json
@@ -7,7 +7,8 @@
"dependencies": {
"bulma": "^1.0.1",
"fontawesome-free": "^1.0.4",
- "leaflet": "^1.9.4"
+ "leaflet": "^1.9.4",
+ "spotlight.js": "^0.7.8"
},
"devDependencies": {}
}
diff --git a/js/ui.js b/js/ui.js
index cf66150..1d77500 100644
--- a/js/ui.js
+++ b/js/ui.js
@@ -1,5 +1,7 @@
'use strict';
+import Spotlight from './vendor/spotlight.js/src/js/spotlight.js';
+
/**
* @namespace UI
*/
@@ -67,6 +69,7 @@ UI.toggleMenu = function (triggerId) {
}
/**
* Open a modal with DB data
+ * @todo Refactor! Web components??
* @param {object} data The data retrieved from the DB to display as modal content
*/
UI.openModal = async function (data) {
@@ -105,33 +108,32 @@ UI.openModal = async function (data) {
}
if (data.surveys.length) {
table += `Elaborazioni CNR da rilievi |
`;
- for (const img of data.surveys) {
- table += `
-
-
-
-
- ${img.didascalia}
-
- |
-
- `;
- }
+ table += `
+
+
+ Cliccare sull'immagine per aprire la gallery
+
+
+ ${data.surveys[0].didascalia}
+
+ |
+
+ `;
}
if (data.photos.length) {
table += `Fotografie |
`;
- for (const img of data.photos) {
- table += `
-
-
-
-
- ${img.didascalia}
-
- |
-
- `;
- }
+ table += `
+
+
+ Cliccare sull'immagine per aprire la gallery
+
+
+ ${data.photos[0].didascalia}
+
+ |
+
+ `;
+ // Open gallery when image is clicked
}
table += '';
@@ -147,6 +149,9 @@ UI.openModal = async function (data) {
modalBg.addEventListener('click', () => {
closeModal();
});
+
+ this.imageGallery('gallery-1', data.surveys);
+ this.imageGallery('gallery-2', data.photos);
}
/**
* @param {string} menuListSel Menu list selector
@@ -170,5 +175,24 @@ UI.sitesMenu = function (menuListSel, map, sites) {
}
});
}
+/**
+ * Open Spotlight gallery
+ * @param {string} galleryId The id of the trigger element
+ * @param {Array