All checks were successful
Publish static bundles / publish (push) Successful in 3m16s
71 lines
2.6 KiB
JavaScript
71 lines
2.6 KiB
JavaScript
(function () {
|
|
"use strict";
|
|
|
|
function ready() {
|
|
document.body.classList.remove("tribe-no-js");
|
|
document.body.classList.add("tribe-js");
|
|
|
|
var navigation = document.getElementById("access");
|
|
var navigationToggle = document.getElementById("nav-toggle");
|
|
|
|
if (navigation && navigationToggle) {
|
|
navigationToggle.setAttribute("aria-controls", "access");
|
|
navigationToggle.setAttribute("aria-expanded", "false");
|
|
|
|
navigationToggle.addEventListener("click", function (event) {
|
|
event.preventDefault();
|
|
var open = navigation.classList.toggle("is-open");
|
|
navigationToggle.setAttribute("aria-expanded", String(open));
|
|
});
|
|
|
|
navigation.querySelectorAll(".menu-item-has-children > a").forEach(function (link) {
|
|
link.setAttribute("aria-haspopup", "true");
|
|
link.setAttribute("aria-expanded", "false");
|
|
|
|
link.addEventListener("click", function (event) {
|
|
if (!window.matchMedia("(max-width: 650px)").matches) return;
|
|
|
|
var expanded = link.getAttribute("aria-expanded") === "true";
|
|
if (!expanded) {
|
|
event.preventDefault();
|
|
link.setAttribute("aria-expanded", "true");
|
|
link.parentElement.classList.add("submenu-open");
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
var backToTop = document.getElementById("toTop");
|
|
if (backToTop) {
|
|
var updateBackToTop = function () {
|
|
backToTop.classList.toggle("is-visible", window.scrollY > 160);
|
|
};
|
|
|
|
backToTop.addEventListener("click", function () {
|
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
});
|
|
window.addEventListener("scroll", updateBackToTop, { passive: true });
|
|
updateBackToTop();
|
|
}
|
|
|
|
document.querySelectorAll('.entry-content iframe[src*="youtube.com"], .entry-content iframe[src*="youtube-nocookie.com"], .entry-content iframe[src*="player.vimeo.com"]').forEach(function (video) {
|
|
if (video.parentElement && video.parentElement.classList.contains("fluid-width-video-wrapper")) return;
|
|
|
|
var width = Number(video.getAttribute("width")) || 16;
|
|
var height = Number(video.getAttribute("height")) || 9;
|
|
var wrapper = document.createElement("div");
|
|
wrapper.className = "fluid-width-video-wrapper";
|
|
wrapper.style.setProperty("--video-aspect", String(width / height));
|
|
video.parentNode.insertBefore(wrapper, video);
|
|
wrapper.appendChild(video);
|
|
video.removeAttribute("width");
|
|
video.removeAttribute("height");
|
|
});
|
|
}
|
|
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", ready, { once: true });
|
|
} else {
|
|
ready();
|
|
}
|
|
})();
|