cz scores tab open

This commit is contained in:
esef committed 2026-07-15 13:20:05 +03:00
1 parent 7214e7c0f3
commit bd2b0cd864
9 files changed
+58 -43

No files matched your search

-3
View File
@@ -66,7 +66,4 @@ document.addEventListener('DOMContentLoaded', () => {
// Load your original Gallery
loadGallery('gallery-container', 'gallery', 50);
// Load your new Ahmet Museum (adjust the number 20 to however many photos you have)
loadGallery('ahmet-container', 'ahmet', 20);
});
+29 -11
View File
@@ -3,11 +3,14 @@ document.addEventListener('DOMContentLoaded', () => {
const tabs = document.querySelectorAll('.tab-content');
const mainVideo = document.getElementById('background-video');
const calVideo = document.getElementById('calendar-background-video');
const czVideo = document.getElementById('czscores-background-video');
// ── Map URL path → tab id ──────────────────────────────
function pathToTab(path) {
const slug = path.replace(/^\/+|\/+$/g, '') || 'about';
const valid = ['about', 'gallery', 'ahmet', 'yuukabot', 'calendar'];
const valid = ['about', 'gallery', 'czscores', 'yuukabot', 'calendar'];
// backward compat: old /ahmet links
if (slug === 'ahmet') return 'czscores';
return valid.includes(slug) ? slug : 'about';
}
@@ -18,17 +21,32 @@ document.addEventListener('DOMContentLoaded', () => {
// ── Swap background videos + top-bar theme ────────────
const topLine = document.getElementById('top-line');
// map tab id → its dedicated video element (null = use main)
const tabVideos = {
calendar: calVideo,
czscores: czVideo
};
function setBgForTab(tabId) {
if (tabId === 'calendar') {
// Switch to calendar background
if (mainVideo) { mainVideo.style.display = 'none'; mainVideo.pause(); }
if (calVideo) { calVideo.style.display = 'block'; calVideo.play().catch(() => {}); }
if (topLine) topLine.classList.add('cal-theme');
} else {
// Switch back to main background
if (calVideo) { calVideo.style.display = 'none'; calVideo.pause(); }
if (mainVideo) { mainVideo.style.display = 'block'; if (mainVideo.paused) mainVideo.play().catch(() => {}); }
if (topLine) topLine.classList.remove('cal-theme');
// Hide + pause ALL videos first
[mainVideo, calVideo, czVideo].forEach(v => {
if (v) { v.style.display = 'none'; v.pause(); }
});
// Show the right one
const target = tabVideos[tabId];
if (target) {
target.style.display = 'block';
target.play().catch(() => {});
} else if (mainVideo) {
mainVideo.style.display = 'block';
if (mainVideo.paused) mainVideo.play().catch(() => {});
}
// Top-bar theme toggle
if (topLine) {
topLine.classList.toggle('cal-theme', tabId === 'calendar');
topLine.classList.toggle('czscores-theme', tabId === 'czscores');
}
}