2023-07-05 13:43:09 +01:00
|
|
|
/* Mobile menu burger toggle */
|
|
|
|
(function () {
|
|
|
|
const navigation = document.querySelector('.gh-navigation');
|
|
|
|
const burger = navigation.querySelector('.gh-burger');
|
|
|
|
if (!burger) return;
|
|
|
|
|
|
|
|
burger.addEventListener('click', function () {
|
2023-07-10 08:44:09 +01:00
|
|
|
if (!navigation.classList.contains('is-open')) {
|
|
|
|
navigation.classList.add('is-open');
|
2023-07-05 13:43:09 +01:00
|
|
|
} else {
|
2023-07-10 08:44:09 +01:00
|
|
|
navigation.classList.remove('is-open');
|
2023-07-05 13:43:09 +01:00
|
|
|
}
|
|
|
|
});
|
2023-08-15 02:59:19 +01:00
|
|
|
})();
|
|
|
|
|
|
|
|
/* Add lightbox to gallery images */
|
|
|
|
(function () {
|
|
|
|
lightbox(
|
|
|
|
'.kg-image-card > .kg-image[width][height], .kg-gallery-image > img'
|
|
|
|
);
|
|
|
|
})();
|
|
|
|
|
|
|
|
/* Responsive video in post content */
|
|
|
|
(function () {
|
|
|
|
const sources = [
|
|
|
|
'.gh-content iframe[src*="youtube.com"]',
|
|
|
|
'.gh-content iframe[src*="youtube-nocookie.com"]',
|
|
|
|
'.gh-content iframe[src*="player.vimeo.com"]',
|
|
|
|
'.gh-content iframe[src*="kickstarter.com"][src*="video.html"]',
|
|
|
|
'.gh-content object',
|
|
|
|
'.gh-content embed',
|
|
|
|
];
|
|
|
|
reframe(document.querySelectorAll(sources.join(',')));
|
|
|
|
})();
|
|
|
|
|
|
|
|
/* Turn the main nav into dropdown menu when there are more than 5 menu items */
|
|
|
|
(function () {
|
|
|
|
dropdown();
|
|
|
|
})();
|
|
|
|
|
|
|
|
/* Infinite scroll pagination */
|
|
|
|
(function () {
|
|
|
|
if (document.body.classList.contains('paged')) {
|
|
|
|
pagination();
|
|
|
|
}
|
2023-07-05 13:43:09 +01:00
|
|
|
})();
|