Fort Wayne Dance Collective uses ClassBug to handle scheduling and processing.
Sign in, or join us for free!
(() => {
const sectionOrder = [
"Program Bundles",
"Drop-In",
"Class Packs",
"Semester",
"Other Offerings"
];
const renameHeaders = {
"Single Classes": "Drop-In",
"Class Series": "Semester"
};
const normalize = text =>
text.trim().replace(/\s+/g, " ").toLowerCase();
// Find a section heading
function findHeading(name) {
return [...document.querySelectorAll("h1,h2,h3,h4,h5,h6")]
.find(el => normalize(el.textContent) === normalize(name));
}
// Find the containing section for a heading
function getSection(heading) {
if (!heading) return null;
return heading.closest(
'section, article, li, [class*="offering"], [class*="category"], [class*="section"]'
) || heading.parentElement;
}
// Rename section headings
function updateHeaders() {
document.querySelectorAll("h1,h2,h3,h4,h5,h6")
.forEach(heading => {
const oldName = Object.keys(renameHeaders).find(
name => normalize(heading.textContent) === normalize(name)
);
if (oldName) {
heading.textContent = renameHeaders[oldName];
}
});
}
// Reorder sections
function reorderSections() {
const sections = sectionOrder.map(name => {
const heading = findHeading(name);
return heading ? getSection(heading) : null;
});
// Only reorder when all sections share the same parent.
if (sections.some(section => !section)) return;
const parent = sections[0].parentElement;
if (!sections.every(section =>
section.parentElement === parent
)) return;
// Place sections in the requested order.
sections.forEach((section, index) => {
if (index === 0) return;
const previous = sections[index - 1];
if (previous.nextElementSibling !== section) {
parent.insertBefore(section, previous.nextElementSibling);
}
});
}
// Add navigation buttons underneath the ClassBug logo
function addNavigation() {
if (document.getElementById("fwdc-navigation")) return;
const logo = [...document.querySelectorAll("img")]
.find(img =>
/cb-logo-2020-sm/i.test(
(img.src || "") + " " + (img.alt || "")
)
);
if (!logo) return;
const nav = document.createElement("nav");
nav.id = "fwdc-navigation";
nav.setAttribute("aria-label", "Class categories");
const buttons = [
{ label: "Drop-In", target: "Drop-In" },
{ label: "Class Packs", target: "Class Packs" },
{ label: "Semester", target: "Semester" },
{ label: "Other Offering", target: "Other Offerings" }
];
buttons.forEach(item => {
const button = document.createElement("button");
button.type = "button";
button.textContent = item.label;
button.addEventListener("click", () => {
const heading = findHeading(item.target);
const section = getSection(heading);
if (section) {
section.scrollIntoView({
behavior: "smooth",
block: "start"
});
}
});
nav.appendChild(button);
});
const logoContainer = logo.closest("a") || logo.parentElement;
logoContainer.insertAdjacentElement("afterend", nav);
}
// Add custom styling
function addStyles() {
if (document.getElementById("fwdc-custom-styles")) return;
const style = document.createElement("style");
style.id = "fwdc-custom-styles";
style.textContent = `
#fwdc-navigation {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin: 20px auto 30px;
padding: 0 12px;
width: 100%;
box-sizing: border-box;
}
#fwdc-navigation button {
background-color: #2563EB;
color: #ffffff;
border: none;
border-radius: 8px;
padding: 12px 24px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: background-color 0.2s ease,
transform 0.2s ease;
}
#fwdc-navigation button:hover {
background-color: #1746A2;
transform: translateY(-2px);
}
#fwdc-navigation button:focus-visible {
outline: 3px solid #F59E0B;
outline-offset: 3px;
}
html {
scroll-behavior: smooth;
scroll-padding-top: 25px;
}
@media (max-width: 600px) {
#fwdc-navigation {
gap: 8px;
}
#fwdc-navigation button {
flex: 1 1 40%;
padding: 12px 8px;
font-size: 14px;
}
}
`;
document.head.appendChild(style);
}
// Run all customizations
function customizePage() {
updateHeaders();
reorderSections();
addNavigation();
addStyles();
}
// Initial setup
customizePage();
// ClassBug may load sections dynamically
const observer = new MutationObserver(() => {
customizePage();
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();