Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<!-- Navigation Header -->
<header class="navbar">
<div class="navbar-container">
<div class="navbar-brand">
<div id="navbarBrand" class="navbar-brand" role="button" tabindex="0" title="Back to Top">
<div class="brand-icon">
<svg viewBox="0 0 100 100" width="32" height="32" fill="currentColor">
<path d="M50 10 L90 90 L10 90 Z"/>
Expand Down Expand Up @@ -143,7 +143,7 @@ <h2 class="hero-title" id="hero-title">Exploring Islamic History</h2>
<i class="fas fa-play" aria-hidden="true"></i>
<span>Watch Now</span>
</button>
<button id="hero-save" class="btn btn-secondary btn-lg" aria-label="Save Featured Episode for Later">
<button id="hero-save" class="btn btn-secondary btn-lg" aria-label="Save Featured Episode for Later" title="Save for Later (B)">
<i class="fas fa-bookmark" aria-hidden="true"></i>
<span>Save</span>
</button>
Expand Down
110 changes: 19 additions & 91 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,7 @@ const DOM = {
themeMenu: document.getElementById('themeMenu'),
episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'),
episodesSection: document.getElementById('episodesSection'),
episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'),
episodesSection: document.getElementById('episodesSection'),
episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'),
episodesSection: document.getElementById('episodesSection'),
episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'),
episodesSection: document.getElementById('episodesSection'),
episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'),
episodesSection: document.getElementById('episodesSection'),
episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'),
episodesSection: document.getElementById('episodesSection'),
episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'),
episodesSection: document.getElementById('episodesSection'),
episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'),
episodesSection: document.getElementById('episodesSection'),
navbarBrand: document.getElementById('navbarBrand'),
menuToggle: document.getElementById('menuToggleBtn'),
scrollToTop: document.getElementById('scrollToTop'),

Expand Down Expand Up @@ -1013,6 +1000,24 @@ function bindEvents() {
});
}

// Navbar Brand Scroll to Top
if (DOM.navbarBrand) {
const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
if (document.body.classList.contains('mobile-nav-active')) {
document.body.classList.remove('mobile-nav-active');
if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');
}
};
DOM.navbarBrand.addEventListener('click', scrollToTop);
DOM.navbarBrand.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
scrollToTop();
}
});
}

// Search Section Toggle
if (DOM.searchToggle && DOM.searchSection) {
DOM.searchToggle.addEventListener('click', () => {
Expand Down Expand Up @@ -1044,83 +1049,6 @@ function bindEvents() {
});
}

// Navbar Episodes Scroll
if (DOM.episodesNavBtn && DOM.episodesSection) {
DOM.episodesNavBtn.addEventListener('click', () => {
DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });
if (document.body.classList.contains('mobile-nav-active')) {
document.body.classList.remove('mobile-nav-active');
if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');
}
});
}

// Navbar Episodes Scroll
if (DOM.episodesNavBtn && DOM.episodesSection) {
DOM.episodesNavBtn.addEventListener('click', () => {
DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });
if (document.body.classList.contains('mobile-nav-active')) {
document.body.classList.remove('mobile-nav-active');
if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');
}
});
}

// Navbar Episodes Scroll
if (DOM.episodesNavBtn && DOM.episodesSection) {
DOM.episodesNavBtn.addEventListener('click', () => {
DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });
if (document.body.classList.contains('mobile-nav-active')) {
document.body.classList.remove('mobile-nav-active');
if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');
}
});
}

// Navbar Episodes Scroll
if (DOM.episodesNavBtn && DOM.episodesSection) {
DOM.episodesNavBtn.addEventListener('click', () => {
DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });
if (document.body.classList.contains('mobile-nav-active')) {
document.body.classList.remove('mobile-nav-active');
if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');
}
});
}

// Navbar Episodes Scroll
if (DOM.episodesNavBtn && DOM.episodesSection) {
DOM.episodesNavBtn.addEventListener('click', () => {
DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });
if (document.body.classList.contains('mobile-nav-active')) {
document.body.classList.remove('mobile-nav-active');
if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');
}
});
}

// Navbar Episodes Scroll
if (DOM.episodesNavBtn && DOM.episodesSection) {
DOM.episodesNavBtn.addEventListener('click', () => {
DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });
if (document.body.classList.contains('mobile-nav-active')) {
document.body.classList.remove('mobile-nav-active');
if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');
}
});
}

// Navbar Episodes Scroll
if (DOM.episodesNavBtn && DOM.episodesSection) {
DOM.episodesNavBtn.addEventListener('click', () => {
DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });
if (document.body.classList.contains('mobile-nav-active')) {
document.body.classList.remove('mobile-nav-active');
if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');
}
});
}

if (DOM.heroBtn) DOM.heroBtn.addEventListener('click', () => AppState.hero && openVideo(AppState.hero));
if (DOM.heroSave) DOM.heroSave.addEventListener('click', () => AppState.hero && toggleWatchLater(AppState.hero));

Expand Down
Loading