2018-03-16 16:11:55 +00:00
|
|
|
// Variables
|
|
|
|
let acc = document.getElementsByClassName("accordion");
|
|
|
|
|
|
|
|
// Set up accordion
|
|
|
|
for (let i = 0; i < acc.length; i++) {
|
|
|
|
acc[i].addEventListener("click", accordionClick);
|
|
|
|
}
|
|
|
|
|
|
|
|
function accordionClick() {
|
|
|
|
let active = false
|
|
|
|
let activeElements = document.getElementsByClassName("active")
|
|
|
|
while (activeElements[0]) {
|
|
|
|
let activeElement = activeElements[0]
|
|
|
|
activeElement.classList.remove("active");
|
|
|
|
activeElement.nextElementSibling.style.maxHeight = null;
|
|
|
|
if (activeElement == this)
|
|
|
|
active = true
|
|
|
|
}
|
|
|
|
|
|
|
|
if (active) return
|
|
|
|
|
|
|
|
this.classList.add("active")
|
|
|
|
let panel = this.nextElementSibling;
|
|
|
|
panel.style.maxHeight = panel.scrollHeight + "px";
|
|
|
|
}
|
|
|
|
|
2017-10-25 00:32:48 +00:00
|
|
|
// Set up fullscreen buttons (used on pages with embedded games)
|
|
|
|
function fullscreen() {
|
|
|
|
// check if fullscreen mode is available
|
|
|
|
if (document.fullscreenEnabled ||
|
|
|
|
document.webkitFullscreenEnabled ||
|
|
|
|
document.mozFullScreenEnabled ||
|
|
|
|
document.msFullscreenEnabled) {
|
2018-03-16 16:11:55 +00:00
|
|
|
|
2017-10-25 00:32:48 +00:00
|
|
|
// which element will be fullscreen
|
2018-03-16 16:11:55 +00:00
|
|
|
var iframe = document.getElementById('embed');
|
2017-10-25 00:32:48 +00:00
|
|
|
// Do fullscreen
|
|
|
|
if (iframe.requestFullscreen) {
|
|
|
|
iframe.requestFullscreen();
|
|
|
|
} else if (iframe.webkitRequestFullscreen) {
|
|
|
|
iframe.webkitRequestFullscreen();
|
|
|
|
} else if (iframe.mozRequestFullScreen) {
|
|
|
|
iframe.mozRequestFullScreen();
|
|
|
|
} else if (iframe.msRequestFullscreen) {
|
|
|
|
iframe.msRequestFullscreen();
|
|
|
|
}
|
2017-10-25 22:46:05 +00:00
|
|
|
iframe.contentWindow.focus();
|
2017-10-25 00:32:48 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
console.log('Your browser is not supported');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let btn = document.getElementById('fullscreenBtn')
|
|
|
|
if (btn) btn.addEventListener('click', fullscreen)
|
2019-10-31 06:07:46 +00:00
|
|
|
|
|
|
|
var carousel = document.getElementById('carousel');
|
|
|
|
let slides = carousel.querySelectorAll('.slide');
|
|
|
|
let indicators = carousel.querySelectorAll('.indicator');
|
|
|
|
|
|
|
|
function setSlide(slide) {
|
|
|
|
return function() {
|
|
|
|
// Reset all slides
|
|
|
|
for (let i = 0; i < indicators.length; i++) {
|
|
|
|
slides[i].classList.remove("active-slide");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set defined slide as active
|
|
|
|
slides[slide].classList.add("active-slide");
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
for (let i = 0; i < indicators.length; i++) {
|
|
|
|
indicators[i].addEventListener("click", setSlide(i));
|
|
|
|
}
|