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 @@

Up

{{ .Title }}

- + {{ .Date.Format "January 2, 2006" }} {{ if .Params.endDate }} {{ $startDate := .Date.Format "2006-01-02" }} @@ -59,13 +59,13 @@

{{ with .Params.location }}

- + {{ . }}

{{ end }} {{ with .Params.eventType }}

- + {{ . }}

{{ end }} @@ -95,7 +95,7 @@

Pr

{{ .Title }}

- + {{ .Date.Format "January 2, 2006" }} {{ if .Params.endDate }} {{ $startDate := .Date.Format "2006-01-02" }} @@ -107,13 +107,13 @@

{{ with .Params.location }}

- + {{ . }}

{{ 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 @@

{{ .Title | markdownify {{ with .Date }} diff --git a/layouts/faq/single.html b/layouts/faq/single.html index a8c8bbb..2e7d2a6 100644 --- a/layouts/faq/single.html +++ b/layouts/faq/single.html @@ -14,7 +14,7 @@

{{ .Title | markdownify
- Back to FAQ + Back to FAQ diff --git a/layouts/partials/essentials/head.html b/layouts/partials/essentials/head.html index 21fdfc4..427f36e 100644 --- a/layouts/partials/essentials/head.html +++ b/layouts/partials/essentials/head.html @@ -9,29 +9,18 @@ {{/* Bootstrap Icons */}} -{{/* Font Awesome */}} - - {{/* Swiper JS */}} +{{ if .IsHome }}{{/* only the home page has carousels */}} +{{ end }} {{/* Favicon */}} {{/* Styles */}} -{{ $plugin := slice }} -{{ $plugin := $plugin | append (resources.Get "scss/plugins.scss" | resources.ExecuteAsTemplate "plugins.scss" . | toCSS) }} -{{ $plugin := $plugin | resources.Concat "/css/plugins.css" }} - -{{ if hugo.IsProduction }} - {{ $plugin = $plugin | fingerprint "sha256" }} - {{ $plugin = $plugin | resources.PostProcess }} -{{ end }} - - {{ $styles := dict "transpiler" "libsass" "targetPath" "css/styles.css" }} {{ with resources.Get "css/style.css" | minify | fingerprint }} diff --git a/layouts/partials/essentials/script-footer.html b/layouts/partials/essentials/script-footer.html index 2b295a4..cf23655 100644 --- a/layouts/partials/essentials/script-footer.html +++ b/layouts/partials/essentials/script-footer.html @@ -1,5 +1,7 @@ -{{/* Swiper JS */}} +{{/* Swiper JS (only the home page has carousels) */}} +{{ if .IsHome }} +{{ end }} {{/* Scripts */}} {{ with resources.Get "js/plugins.js" }} diff --git a/layouts/supporting-nwb/list.html b/layouts/supporting-nwb/list.html index 7797168..1611cef 100644 --- a/layouts/supporting-nwb/list.html +++ b/layouts/supporting-nwb/list.html @@ -35,7 +35,7 @@

{{ .title | markdownify }}

- +

{{ .title | markdownify }}

@@ -137,7 +137,7 @@

{{ .title | markdownify }}

{{ .name }} {{ else }}
- +
{{ end }} {{ .name | markdownify }}