Update offline version for local video use; remove news
This commit is contained in:
86
js/fara.js
86
js/fara.js
@@ -123,7 +123,7 @@ export function menuKeys()
|
||||
let menuK = {
|
||||
'1' : 'itinerario.html',
|
||||
'2' : 'progetto.html',
|
||||
'3' : 'news.html',
|
||||
|
||||
'4': 'credits.html',
|
||||
};
|
||||
|
||||
@@ -176,63 +176,33 @@ export function mobileNav()
|
||||
* Get video source for given
|
||||
* link and open video page
|
||||
*/
|
||||
export function openVideo(a)
|
||||
{
|
||||
let aNodes = a.childNodes;
|
||||
// Hacky??
|
||||
let title = a.parentElement
|
||||
.nextElementSibling
|
||||
.firstElementChild
|
||||
.innerHTML
|
||||
.trim();
|
||||
|
||||
let vStr = '';
|
||||
let vimeoVids = {
|
||||
'thumb_prologo' : '478632535',
|
||||
'thumb_viaggiatore' : '562518107',
|
||||
'thumb_faresi' : '562529310',
|
||||
'thumb_piazza' : '443587380',
|
||||
'thumb_antonio' : '606341398',
|
||||
'thumb_francesco' : '471773781',
|
||||
'thumb_nobili' : '562534835',
|
||||
'thumb_rocco' : '606346781',
|
||||
'thumb_alberto' : '606372910',
|
||||
'thumb_disputa' : '471537982',
|
||||
'thumb_duomo' : '606343917',
|
||||
'thumb_loredana' : '513080769',
|
||||
'thumb_pietro' : '455576197',
|
||||
'thumb_castello' : '562536148',
|
||||
'thumb_sabini' : '542321131',
|
||||
'thumb_monumento' : '606362546',
|
||||
'thumb_eva' : '606352547',
|
||||
'thumb_toto' : '606348670',
|
||||
'thumb_fuori' : '606358668',
|
||||
'thumb_carro' : '562262086',
|
||||
};
|
||||
|
||||
let vimeoLink = 'https://player.vimeo.com/video/';
|
||||
|
||||
aNodes.forEach(n => {
|
||||
if (n.src) {
|
||||
vStr = n.src;
|
||||
vStr = vStr.substr(vStr.lastIndexOf('/')+1, vStr.length)
|
||||
.replace(/thumb_(.*)\.\w+$/, 'vid_$1.mp4');
|
||||
|
||||
vimeoLink += vimeoVids[n.src.substr(n.src.lastIndexOf('/')+1, n.src.length)
|
||||
.replace(/\.(png|jpg)/, '')];
|
||||
|
||||
vimeoLink += '?autoplay=1';
|
||||
}
|
||||
});
|
||||
|
||||
localStorage.setItem('vidURI', vStr);
|
||||
localStorage.setItem('vimeo', vimeoLink);
|
||||
localStorage.setItem('vidTitle', title);
|
||||
/**
|
||||
* Go to video page
|
||||
*/
|
||||
window.location.href = 'video.html';
|
||||
}
|
||||
export function openVideo(a)
|
||||
{
|
||||
let aNodes = a.childNodes;
|
||||
// Hacky??
|
||||
let title = a.parentElement
|
||||
.nextElementSibling
|
||||
.firstElementChild
|
||||
.innerHTML
|
||||
.trim();
|
||||
|
||||
let vStr = '';
|
||||
|
||||
aNodes.forEach(n => {
|
||||
if (n.src) {
|
||||
vStr = n.src;
|
||||
vStr = vStr.substr(vStr.lastIndexOf('/')+1, vStr.length)
|
||||
.replace(/thumb_(.*)\.\w+$/, 'vid_$1.mp4');
|
||||
}
|
||||
});
|
||||
|
||||
localStorage.setItem('vidURI', vStr);
|
||||
localStorage.setItem('vidTitle', title);
|
||||
/**
|
||||
* Go to video page
|
||||
*/
|
||||
window.location.href = 'video.html';
|
||||
}
|
||||
/**
|
||||
* Activate background on scroll for nav only
|
||||
* if not small screen
|
||||
|
||||
13
js/ui.js
13
js/ui.js
@@ -23,7 +23,6 @@ if (!window.location.href.includes('video')) {
|
||||
}
|
||||
/**
|
||||
* For itinerario.html...
|
||||
* @todo What about the interactive map?!?
|
||||
*/
|
||||
if (window.location.href.includes('itinerario')) {
|
||||
let vidLinks = document.querySelectorAll('.open-vid');
|
||||
@@ -42,9 +41,9 @@ if (window.location.href.includes('itinerario')) {
|
||||
/**
|
||||
* For videos...
|
||||
*/
|
||||
if (window.location.href.includes('video')) {
|
||||
if (window.location.href.includes('video')) {
|
||||
document.addEventListener('readystatechange', () => {
|
||||
let vimeoLink = localStorage.getItem('vimeo');
|
||||
let vStr = localStorage.getItem('vidURI');
|
||||
let vidTitle = localStorage.getItem('vidTitle');
|
||||
|
||||
document.querySelector('h1').innerHTML = vidTitle;
|
||||
@@ -57,12 +56,12 @@ if (window.location.href.includes('video')) {
|
||||
window.history.go(-1);
|
||||
});
|
||||
|
||||
let iframe = document.querySelector('iframe');
|
||||
//let video = source.parentNode;
|
||||
let source = document.querySelector('source');
|
||||
let video = source.parentNode;
|
||||
|
||||
iframe.src = vimeoLink;
|
||||
source.src = `assets/video/${vStr}`;
|
||||
|
||||
//video.load();
|
||||
video.load();
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user