diff --git a/assets/js/main.js b/assets/js/main.js index 84e07cb..3191c00 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -46,65 +46,67 @@ document.addEventListener("DOMContentLoaded", function () { - // Swiper Init - const heroSwiper = new Swiper(".heroSwiper", { - slidesPerView: 1, - loop: true, - pagination: { - el: ".swiper-pagination", - dynamicBullets: true, - }, - }); + // Swiper Init (the library is only loaded on pages that have a carousel) + if (typeof Swiper !== "undefined") { + const heroSwiper = new Swiper(".heroSwiper", { + slidesPerView: 1, + loop: true, + pagination: { + el: ".swiper-pagination", + dynamicBullets: true, + }, + }); - const newsSwiper = new Swiper(".newsSwiper", { - slidesPerView: 1, - spaceBetween: 10, - pagination: { - el: ".swiper-pagination", - dynamicBullets: true, - }, - navigation: { - nextEl: ".swiper-button-next", - prevEl: ".swiper-button-prev", - }, - breakpoints: { - 576: { - slidesPerView: 2, - spaceBetween: 20, + const newsSwiper = new Swiper(".newsSwiper", { + slidesPerView: 1, + spaceBetween: 10, + pagination: { + el: ".swiper-pagination", + dynamicBullets: true, }, - 768: { - slidesPerView: 3, - spaceBetween: 20, - } - }, - }); + navigation: { + nextEl: ".swiper-button-next", + prevEl: ".swiper-button-prev", + }, + breakpoints: { + 576: { + slidesPerView: 2, + spaceBetween: 20, + }, + 768: { + slidesPerView: 3, + spaceBetween: 20, + } + }, + }); - const eventsSwiper = new Swiper(".eventsSwiper", { - slidesPerView: 1, - spaceBetween: 10, - pagination: { - el: ".swiper-pagination", - dynamicBullets: true, - }, - navigation: { - nextEl: ".swiper-button-next", - prevEl: ".swiper-button-prev", - }, - breakpoints: { - 576: { - slidesPerView: 2, - spaceBetween: 30, + const eventsSwiper = new Swiper(".eventsSwiper", { + slidesPerView: 1, + spaceBetween: 10, + pagination: { + el: ".swiper-pagination", + dynamicBullets: true, }, - 768: { - slidesPerView: 3, - spaceBetween: 30, + navigation: { + nextEl: ".swiper-button-next", + prevEl: ".swiper-button-prev", }, - 1200: { - slidesPerView: 3, - spaceBetween: 40 - } - }, - }); + breakpoints: { + 576: { + slidesPerView: 2, + spaceBetween: 30, + }, + 768: { + slidesPerView: 3, + spaceBetween: 30, + }, + 1200: { + slidesPerView: 3, + spaceBetween: 40 + } + }, + }); + } // PageFind Init window.addEventListener('DOMContentLoaded', (event) => { @@ -219,85 +221,89 @@ document.addEventListener("DOMContentLoaded", function () { // Show More Team Members // Current Team - showMoreButton.addEventListener("click", function () { - const nextCount = visibleCount + increment; - for (let i = visibleCount; i < nextCount && i < teamMembers.length; i++) { - if (teamMembers[i]) { - teamMembers[i].classList.remove("d-none"); + if (showMoreButton && showLessButton) { + showMoreButton.addEventListener("click", function () { + const nextCount = visibleCount + increment; + for (let i = visibleCount; i < nextCount && i < teamMembers.length; i++) { + if (teamMembers[i]) { + teamMembers[i].classList.remove("d-none"); + } } - } - visibleCount = nextCount; + visibleCount = nextCount; - if (visibleCount > 8) { - showLessButton.classList.remove("d-none"); - } + if (visibleCount > 8) { + showLessButton.classList.remove("d-none"); + } - if (visibleCount >= teamMembers.length) { - showMoreButton.classList.add("d-none"); - } - }); + if (visibleCount >= teamMembers.length) { + showMoreButton.classList.add("d-none"); + } + }); - showLessButton.addEventListener("click", function () { - // Calculate the next set of members to hide - const nextCount = visibleCount - increment; - for (let i = visibleCount - 1; i >= nextCount && i >= 8; i--) { - if (teamMembers[i]) { - teamMembers[i].classList.add("d-none"); + showLessButton.addEventListener("click", function () { + // Calculate the next set of members to hide + const nextCount = visibleCount - increment; + for (let i = visibleCount - 1; i >= nextCount && i >= 8; i--) { + if (teamMembers[i]) { + teamMembers[i].classList.add("d-none"); + } } - } - visibleCount = nextCount; + visibleCount = nextCount; - // Hide the "Show Less" button if only 8 members are visible - if (visibleCount <= 8) { - showLessButton.classList.add("d-none"); - } + // Hide the "Show Less" button if only 8 members are visible + if (visibleCount <= 8) { + showLessButton.classList.add("d-none"); + } - // Show the "Show More" button if not all members are visible - if (visibleCount < teamMembers.length) { - showMoreButton.classList.remove("d-none"); - } - }); + // Show the "Show More" button if not all members are visible + if (visibleCount < teamMembers.length) { + showMoreButton.classList.remove("d-none"); + } + }); + } // Tech Team - showMoreButtonTech.addEventListener("click", function () { - // Calculate the next set of members to show - const nextCountTech = visibleCountTech + incrementTech; - for (let i = visibleCountTech; i < nextCountTech && i < teamMembersTech.length; i++) { - if (teamMembersTech[i]) { - teamMembersTech[i].classList.remove("d-none"); + if (showMoreButtonTech && showLessButtonTech) { + showMoreButtonTech.addEventListener("click", function () { + // Calculate the next set of members to show + const nextCountTech = visibleCountTech + incrementTech; + for (let i = visibleCountTech; i < nextCountTech && i < teamMembersTech.length; i++) { + if (teamMembersTech[i]) { + teamMembersTech[i].classList.remove("d-none"); + } } - } - visibleCountTech = nextCountTech; + visibleCountTech = nextCountTech; - // Show the "Show Less" button if more than 8 members are visible - if (visibleCountTech > 8) { - showLessButtonTech.classList.remove("d-none"); - } + // Show the "Show Less" button if more than 8 members are visible + if (visibleCountTech > 8) { + showLessButtonTech.classList.remove("d-none"); + } - // Hide the "Show More" button if all members are visible - if (visibleCountTech >= teamMembersTech.length) { - showMoreButtonTech.classList.add("d-none"); - } - }); + // Hide the "Show More" button if all members are visible + if (visibleCountTech >= teamMembersTech.length) { + showMoreButtonTech.classList.add("d-none"); + } + }); - showLessButtonTech.addEventListener("click", function () { - // Calculate the next set of members to hide - const nextCountTech = visibleCountTech - incrementTech; - for (let i = visibleCountTech - 1; i >= nextCountTech && i >= 8; i--) { - if (teamMembersTech[i]) { - teamMembersTech[i].classList.add("d-none"); + showLessButtonTech.addEventListener("click", function () { + // Calculate the next set of members to hide + const nextCountTech = visibleCountTech - incrementTech; + for (let i = visibleCountTech - 1; i >= nextCountTech && i >= 8; i--) { + if (teamMembersTech[i]) { + teamMembersTech[i].classList.add("d-none"); + } } - } - visibleCountTech = nextCountTech; + visibleCountTech = nextCountTech; - // Hide the "Show Less" button if only 8 members are visible - if (visibleCountTech <= 8) { - showLessButtonTech.classList.add("d-none"); - } + // Hide the "Show Less" button if only 8 members are visible + if (visibleCountTech <= 8) { + showLessButtonTech.classList.add("d-none"); + } - // Show the "Show More" button if not all members are visible - if (visibleCountTech < teamMembersTech.length) { - showMoreButtonTech.classList.remove("d-none"); - } - }); + // Show the "Show More" button if not all members are visible + if (visibleCountTech < teamMembersTech.length) { + showMoreButtonTech.classList.remove("d-none"); + } + }); + } }); diff --git a/layouts/events/list.html b/layouts/events/list.html index 94b076c..c6af991 100644 --- a/layouts/events/list.html +++ b/layouts/events/list.html @@ -47,7 +47,7 @@
- + {{ .Date.Format "January 2, 2006" }} {{ if .Params.endDate }} {{ $startDate := .Date.Format "2006-01-02" }} @@ -59,13 +59,13 @@
- + {{ . }}
{{ end }} {{ with .Params.eventType }}- + {{ . }}
{{ end }} @@ -95,7 +95,7 @@- + {{ .Date.Format "January 2, 2006" }} {{ if .Params.endDate }} {{ $startDate := .Date.Format "2006-01-02" }} @@ -107,13 +107,13 @@
- + {{ . }}
{{ end }} {{ with .Params.eventType }}- + {{ . }}
{{ end }} diff --git a/layouts/events/single.html b/layouts/events/single.html index 5768684..d1d9eda 100644 --- a/layouts/events/single.html +++ b/layouts/events/single.html @@ -24,7 +24,7 @@{{ . | time.Format "January 02, 2006" }} @@ -41,7 +41,7 @@
{{ . }}
{{ . }}
- + {{ .Date.Format "January 2, 2006" }} {{ if .Params.endDate }} {{ $startDate := .Date.Format "2006-01-02" }} @@ -92,7 +92,7 @@
- + {{ . }}
- + {{ . }}