function slideshow_init(slideshowId) {
let element = document.getElementById(slideshowId);
if (element === null) {
return;
}
let images = element.getElementsByTagName("img");
let mainImageElement = images[0];
let newElement = '';
images[1].parentElement.insertAdjacentHTML('beforebegin', newElement);
for (let i=1;i slideshow_move(slideshowId, -1);
nextButton.onclick = evt => slideshow_move(slideshowId, +1);
let hiddenElements = element.getElementsByClassName("slideshow_hidden");
for (let i = hiddenElements.length - 1; i >= 0; i--) {
hiddenElements[i].classList.remove("slideshow_hidden");
}
slideshow_show(slideshowId, images[1]);
}
function slideshow_move(slideshowId, step) {
let element = document.getElementById(slideshowId);
let images = element.getElementsByTagName("img");
for (let i=1;i= images.length) {
next -= images.length - 1;
}
slideshow_show(slideshowId, images[next]);
return;
}
}
}
function slideshow_show(slideshowId, imageElement) {
let element = document.getElementById(slideshowId);
let active = element.getElementsByClassName("slideshow_active_image");
if (active[0] === imageElement) {
return;
}
let images = element.getElementsByTagName("img");
images[0].style.opacity = 0;
for (let i=1;i { images[0].style.opacity = 1 }, 0);
}
function hasClass(element, className) {
return (' ' + element.className + ' ').indexOf(' ' + className+ ' ') > -1;
}