diff --git a/js/fara.js b/js/fara.js
index dbaa8d5..9b42af4 100644
--- a/js/fara.js
+++ b/js/fara.js
@@ -35,7 +35,30 @@ export function sliderBg()
*/
export function slideshow()
{
- // Write me...
+ let slideIndex = 0;
+ carousel();
+
+ function carousel() {
+ let i;
+ let slides = document.querySelectorAll(".slide");
+
+ for (i = 0; i < slides.length; i++) {
+ slides[i].classList.add("hide");
+ slides[i].classList.remove("show");
+ }
+ slideIndex++;
+
+ if (slideIndex > slides.length) {
+ slideIndex = 1;
+ }
+
+ //console.log(slides);
+
+ slides[slideIndex-1].classList.remove("hide");
+ slides[slideIndex-1].classList.add("show");
+
+ setTimeout(carousel, 2000); // Change image every 2 seconds
+ }
}
/**
* @todo
@@ -119,21 +142,11 @@ export function mobileNav()
}
}
/**
- * Open / close modal for videos
- * and apply video source
+ * Get video source for given
+ * link and open video page
*/
export function openVideo(a)
{
- /**
- let modal = document.querySelector('#mod-vid');
- let vidLinks = Array.from(document.querySelectorAll('a[href="#open-vid"]'));
-
- * Dynamically change video source
- * Note naming convention...
- if (vidLinks.length) {
- vidLinks.forEach(a => {
- */
-
let aNodes = a.childNodes;
// Hacky??
let title = a.parentElement
@@ -141,10 +154,9 @@ export function openVideo(a)
.firstElementChild
.innerHTML
.trim();
-
- console.log(aNodes);
+
let vStr = '';
-
+
aNodes.forEach(n => {
if (n.src) {
vStr = n.src;
@@ -159,22 +171,6 @@ export function openVideo(a)
* Go to video page
*/
window.location.href = 'video.html';
- /* Close the modal when clicking on the
- modal.classList.add('active');
- document.querySelector('.modal-title').classList.add('roboto');
- document.querySelector('.modal-title').innerHTML = title;
-
- let close = document.querySelectorAll('#mod-vid a[href="#close"]')[1];
-
- close.addEventListener('click', () => {
- modal.classList.remove('active');
- });
-
- * overlay
- overlay.addEventListener('click', () => {
- modal.classList.remove('active');
- })
- */
}
/**
* Activate background on scroll for nav only
@@ -199,4 +195,23 @@ export function navOnScroll()
}
nav.classList.remove('bg-white', 'border');
}
-}
\ No newline at end of file
+}
+/**
+ * Generate anchors in 'itinerario' to
+ * track click position to go back to
+ * when closing video page...
+ */
+export function genAnchors()
+{
+ let sections = document.querySelectorAll('.poi');
+ let count = 0;
+
+ sections.forEach(s => {
+ let a = document.createElement('a');
+ count++;
+
+ a.id = 's' + new String(count);
+
+ s.prepend(a);
+ });
+}
diff --git a/js/ui.js b/js/ui.js
index 5caf2c3..38a3841 100644
--- a/js/ui.js
+++ b/js/ui.js
@@ -26,12 +26,18 @@ if (!window.location.href.includes('video')) {
* @todo What about the interactive map?!?
*/
if (window.location.href.includes('itinerario')) {
- let vidLinks = document.querySelectorAll('a[href="#open-vid"]');
+ let vidLinks = document.querySelectorAll('.open-vid');
vidLinks.forEach(a => {
a.addEventListener('click', () => {
Farapp.openVideo(a);
});
- })
+ });
+ /**
+ * Add anchors to sections
+ */
+ document.addEventListener('readystatechange', () => {
+ Farapp.genAnchors();
+ });
}
/**
* For videos...
@@ -41,13 +47,14 @@ if (window.location.href.includes('video')) {
let vStr = localStorage.getItem('vidURI');
let vidTitle = localStorage.getItem('vidTitle');
- console.log(vStr, vidTitle);
document.querySelector('h1').innerHTML = vidTitle;
let close = document.querySelector('a[title="Close"]');
close.addEventListener('click', () => {
- window.location.href = 'itinerario.html';
+ // If referred from interactive map, shouldn't
+ // just go back...
+ history.back();
});
let source = document.querySelector('source');
@@ -57,4 +64,12 @@ if (window.location.href.includes('video')) {
video.load();
});
+}
+/**
+ * Slideshow in credits page
+ */
+if (window.location.href.includes('credits')) {
+ document.addEventListener('readystatechange', () => {
+ Farapp.slideshow();
+ });
}
\ No newline at end of file
diff --git a/video.html b/video.html
index 0d4a128..6ae33d3 100644
--- a/video.html
+++ b/video.html
@@ -15,7 +15,7 @@