2022-06-17 17:51:59 +02:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// DATA
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2022-08-01 16:59:46 +02:00
|
|
|
// IFRAME LOADING ANIMATIONS
|
2022-07-22 17:53:26 +02:00
|
|
|
|
2022-08-01 16:59:46 +02:00
|
|
|
const body = document.querySelector('body');
|
2022-07-22 17:53:26 +02:00
|
|
|
const sidebar = document.querySelector('.sidebar');
|
2022-07-28 18:59:14 +02:00
|
|
|
const sidebarNavLinks = document.querySelectorAll('.sidebar__nav-link--internal');
|
|
|
|
const logoIcon = document.querySelector('.logo__icon');
|
|
|
|
const exhibitionIframe = document.querySelector('.exhibition');
|
2022-07-22 17:53:26 +02:00
|
|
|
|
2022-06-17 17:51:59 +02:00
|
|
|
// ----------------------------------------------------------------------------
|
2022-07-28 18:59:14 +02:00
|
|
|
// LOGIC
|
2022-06-17 17:51:59 +02:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2022-07-28 18:59:14 +02:00
|
|
|
// UTILS
|
|
|
|
|
|
|
|
// Enable CSS :active pseudo-class in Safari Mobile
|
|
|
|
function enableActivePseudoClass() {
|
|
|
|
document.addEventListener("touchstart", function() {},false);
|
|
|
|
}
|
|
|
|
|
2022-06-17 17:51:59 +02:00
|
|
|
// Convert rem to pixels by getting font-size CSS property
|
|
|
|
function convertRemToPixels(rem) {
|
2022-07-07 17:09:48 +02:00
|
|
|
let fontSize = parseFloat(window.getComputedStyle(document.body).getPropertyValue('font-size'));
|
|
|
|
return rem * fontSize;
|
2022-06-17 17:51:59 +02:00
|
|
|
}
|
|
|
|
|
2022-08-01 16:59:46 +02:00
|
|
|
// IFRAME LOADING ANIMATIONS
|
|
|
|
|
|
|
|
function enableLogoIconRotation() {
|
|
|
|
if (logoIcon) {
|
|
|
|
logoIcon.classList.add('logo__icon--rotate-horizontal-bottom');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function disableLogoIconRotation() {
|
|
|
|
if (logoIcon) {
|
|
|
|
logoIcon.classList.remove('logo__icon--rotate-horizontal-bottom');
|
|
|
|
}
|
|
|
|
}
|
2022-07-22 17:53:26 +02:00
|
|
|
|
|
|
|
function slimDownSidebar() {
|
2022-07-28 18:59:14 +02:00
|
|
|
if (sidebar && !sidebar.classList.contains('sidebar--slimmed')) {
|
2022-07-22 17:53:26 +02:00
|
|
|
sidebar.classList.add('sidebar--slimmed');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-01 16:59:46 +02:00
|
|
|
function enableExhibitionIframeVisibility() {
|
|
|
|
if (exhibitionIframe) {
|
|
|
|
exhibitionIframe.classList.add('exhibition--visible');
|
|
|
|
}
|
|
|
|
}
|
2022-07-28 18:59:14 +02:00
|
|
|
|
2022-08-01 16:59:46 +02:00
|
|
|
function disableExhibitionIframeVisibility() {
|
|
|
|
if (exhibitionIframe) {
|
|
|
|
exhibitionIframe.classList.remove('exhibition--visible');
|
2022-07-28 18:59:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-01 16:59:46 +02:00
|
|
|
function editBackgroundColor(sidebarNavLink) {
|
|
|
|
if (body && sidebar) {
|
|
|
|
if (sidebarNavLink.getAttribute('data-background') === 'feldgrau') {
|
|
|
|
body.classList.remove('body--white-background');
|
|
|
|
sidebar.classList.remove('sidebar--white-background');
|
|
|
|
} else if (sidebarNavLink.getAttribute('data-background') === 'white') {
|
|
|
|
body.classList.add('body--white-background');
|
|
|
|
sidebar.classList.add('sidebar--white-background');
|
2022-07-28 18:59:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadExhibitionIframe() {
|
|
|
|
if (sidebarNavLinks.length > 0 && exhibitionIframe) {
|
2022-07-22 17:53:26 +02:00
|
|
|
for (let i = 0; i < sidebarNavLinks.length; i++) {
|
2022-07-28 18:59:14 +02:00
|
|
|
sidebarNavLinks[i].addEventListener('click', function(e) {
|
2022-08-01 16:59:46 +02:00
|
|
|
logoIcon.removeEventListener('animationiteration', disableLogoIconRotation);
|
2022-07-28 18:59:14 +02:00
|
|
|
enableLogoIconRotation();
|
2022-08-01 16:59:46 +02:00
|
|
|
disableExhibitionIframeVisibility();
|
2022-07-28 18:59:14 +02:00
|
|
|
exhibitionIframe.addEventListener('load', function(e) {
|
2022-08-01 16:59:46 +02:00
|
|
|
logoIcon.addEventListener('animationiteration', disableLogoIconRotation);
|
2022-07-28 18:59:14 +02:00
|
|
|
slimDownSidebar();
|
2022-08-01 16:59:46 +02:00
|
|
|
enableExhibitionIframeVisibility();
|
|
|
|
editBackgroundColor(sidebarNavLinks[i]);
|
2022-07-28 18:59:14 +02:00
|
|
|
});
|
|
|
|
});
|
2022-07-22 17:53:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-17 17:51:59 +02:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// PROGRAM
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2022-07-28 18:59:14 +02:00
|
|
|
// UTILS
|
|
|
|
|
|
|
|
enableActivePseudoClass();
|
2022-07-22 17:53:26 +02:00
|
|
|
|
2022-08-01 16:59:46 +02:00
|
|
|
// IFRAME LOADING ANIMATIONS
|
2022-07-22 17:53:26 +02:00
|
|
|
|
2022-07-28 18:59:14 +02:00
|
|
|
loadExhibitionIframe();
|