Make gallery selectable by URL

This commit is contained in:
Henri Bergius 2018-12-26 21:16:21 +01:00
parent 5b6e323a90
commit 61e11ba94b

View file

@ -85,7 +85,11 @@
next.setAttribute('src', image); next.setAttribute('src', image);
} }
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
fetch('http://c-flo.cbrp3.c-base.org/pictures/space') let gallery = 'space';
if (window.location.search) {
gallery = decodeURIComponent(window.location.search.substr(1));
}
fetch(`http://c-flo.cbrp3.c-base.org/pictures/${gallery}`)
.then(res => res.json()) .then(res => res.json())
.then((pictures) => { .then((pictures) => {
const withUrl = pictures.map(p => 'http://c-flo.cbrp3.c-base.org' + p); const withUrl = pictures.map(p => 'http://c-flo.cbrp3.c-base.org' + p);