add navigation back
This commit is contained in:
parent
31778f13fe
commit
ad19cff23e
1 changed files with 59 additions and 11 deletions
|
|
@ -43,7 +43,6 @@ function buildPhotoArray() {
|
||||||
currentPhotos = [];
|
currentPhotos = [];
|
||||||
photoItems.forEach(item => {
|
photoItems.forEach(item => {
|
||||||
const image = item.querySelector('img');
|
const image = item.querySelector('img');
|
||||||
// FIX: Use dataset values directly
|
|
||||||
const date = item.dataset.date || '';
|
const date = item.dataset.date || '';
|
||||||
const pubkey = item.dataset.pubkey || '';
|
const pubkey = item.dataset.pubkey || '';
|
||||||
const alt = item.dataset.alt || '';
|
const alt = item.dataset.alt || '';
|
||||||
|
|
@ -77,7 +76,6 @@ function openLightbox(index) {
|
||||||
lightboxImage.alt = photo.alt;
|
lightboxImage.alt = photo.alt;
|
||||||
lightboxCaption.textContent = photo.alt;
|
lightboxCaption.textContent = photo.alt;
|
||||||
|
|
||||||
// FIX: Show date and pubkey in the meta
|
|
||||||
let metaText = '';
|
let metaText = '';
|
||||||
if (photo.date) metaText += `📅 ${photo.date}`;
|
if (photo.date) metaText += `📅 ${photo.date}`;
|
||||||
|
|
||||||
|
|
@ -162,7 +160,6 @@ function renderMusicTracks(tracks, containerId, randomize = false) {
|
||||||
const container = document.getElementById(containerId);
|
const container = document.getElementById(containerId);
|
||||||
if (!container) return;
|
if (!container) return;
|
||||||
|
|
||||||
// Filter tracks by artist
|
|
||||||
const filteredTracks = tracks.filter(track => {
|
const filteredTracks = tracks.filter(track => {
|
||||||
let artist = '';
|
let artist = '';
|
||||||
if (track.tags) {
|
if (track.tags) {
|
||||||
|
|
@ -180,11 +177,9 @@ function renderMusicTracks(tracks, containerId, randomize = false) {
|
||||||
|
|
||||||
let selected;
|
let selected;
|
||||||
if (randomize) {
|
if (randomize) {
|
||||||
// Randomize: shuffle and get first 6
|
|
||||||
const shuffled = shuffleArray(filteredTracks);
|
const shuffled = shuffleArray(filteredTracks);
|
||||||
selected = shuffled.slice(0, 6);
|
selected = shuffled.slice(0, 6);
|
||||||
} else {
|
} else {
|
||||||
// Chronological: sort by created_at (newest first) and get first 6
|
|
||||||
const sorted = [...filteredTracks].sort((a, b) => b.created_at - a.created_at);
|
const sorted = [...filteredTracks].sort((a, b) => b.created_at - a.created_at);
|
||||||
selected = sorted.slice(0, 6);
|
selected = sorted.slice(0, 6);
|
||||||
}
|
}
|
||||||
|
|
@ -270,18 +265,15 @@ function handleLyricsToggle() {
|
||||||
// 4. PICTURES RENDERER
|
// 4. PICTURES RENDERER
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
// Render random pictures (6 max)
|
|
||||||
function renderRandomPictures(picturesData, containerId, randomize = false) {
|
function renderRandomPictures(picturesData, containerId, randomize = false) {
|
||||||
const container = document.getElementById(containerId);
|
const container = document.getElementById(containerId);
|
||||||
if (!container) return;
|
if (!container) return;
|
||||||
|
|
||||||
let selected;
|
let selected;
|
||||||
if (randomize) {
|
if (randomize) {
|
||||||
// Randomize: shuffle and get first 6
|
|
||||||
const shuffled = shuffleArray(picturesData);
|
const shuffled = shuffleArray(picturesData);
|
||||||
selected = shuffled.slice(0, 6);
|
selected = shuffled.slice(0, 6);
|
||||||
} else {
|
} else {
|
||||||
// Chronological: sort by created_at (newest first) and get first 6
|
|
||||||
const sorted = [...picturesData].sort((a, b) => b.created_at - a.created_at);
|
const sorted = [...picturesData].sort((a, b) => b.created_at - a.created_at);
|
||||||
selected = sorted.slice(0, 6);
|
selected = sorted.slice(0, 6);
|
||||||
}
|
}
|
||||||
|
|
@ -337,11 +329,9 @@ function renderRandomVideos(videosData, containerId, randomize = false) {
|
||||||
|
|
||||||
let selected;
|
let selected;
|
||||||
if (randomize) {
|
if (randomize) {
|
||||||
// Randomize: shuffle and get first 2
|
|
||||||
const shuffled = shuffleArray(videosData);
|
const shuffled = shuffleArray(videosData);
|
||||||
selected = shuffled.slice(0, 2);
|
selected = shuffled.slice(0, 2);
|
||||||
} else {
|
} else {
|
||||||
// Chronological: sort by created_at (newest first) and get first 2
|
|
||||||
const sorted = [...videosData].sort((a, b) => b.created_at - a.created_at);
|
const sorted = [...videosData].sort((a, b) => b.created_at - a.created_at);
|
||||||
selected = sorted.slice(0, 2);
|
selected = sorted.slice(0, 2);
|
||||||
}
|
}
|
||||||
|
|
@ -429,7 +419,65 @@ function refreshVideos() {
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// ... sticky nav, read more, smooth scrolling code ...
|
// Sticky Navigation
|
||||||
|
const stickyNav = document.getElementById('stickyNav');
|
||||||
|
const mainHeader = document.querySelector('.main-header');
|
||||||
|
let lastScrollY = window.scrollY;
|
||||||
|
let ticking = false;
|
||||||
|
|
||||||
|
function updateStickyNav() {
|
||||||
|
const scrollY = window.scrollY;
|
||||||
|
const headerHeight = mainHeader ? mainHeader.offsetHeight : 400;
|
||||||
|
if (scrollY > headerHeight - 100) {
|
||||||
|
stickyNav.classList.add('visible');
|
||||||
|
} else {
|
||||||
|
stickyNav.classList.remove('visible');
|
||||||
|
}
|
||||||
|
lastScrollY = scrollY;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('scroll', function() {
|
||||||
|
if (!ticking) {
|
||||||
|
window.requestAnimationFrame(function() {
|
||||||
|
updateStickyNav();
|
||||||
|
ticking = false;
|
||||||
|
});
|
||||||
|
ticking = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(updateStickyNav, 100);
|
||||||
|
|
||||||
|
// Read More toggle for blog posts
|
||||||
|
document.querySelectorAll('.read-more-toggle').forEach(button => {
|
||||||
|
button.addEventListener('click', function() {
|
||||||
|
const content = this.nextElementSibling;
|
||||||
|
if (content.style.display === 'none') {
|
||||||
|
content.style.display = 'block';
|
||||||
|
this.innerHTML = '<span>Read Less</span>';
|
||||||
|
} else {
|
||||||
|
content.style.display = 'none';
|
||||||
|
this.innerHTML = '<span>Read More</span>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Smooth scrolling for navigation links (both main nav and sticky nav)
|
||||||
|
document.querySelectorAll('nav a').forEach(link => {
|
||||||
|
link.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const targetId = this.getAttribute('href');
|
||||||
|
const targetElement = document.querySelector(targetId);
|
||||||
|
if (targetElement) {
|
||||||
|
const navHeight = stickyNav.offsetHeight;
|
||||||
|
const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset - navHeight - 20;
|
||||||
|
window.scrollTo({
|
||||||
|
top: targetPosition,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Initialize Music (chronological, not randomized)
|
// Initialize Music (chronological, not randomized)
|
||||||
if (window.allMusicData && window.allMusicData.length > 0) {
|
if (window.allMusicData && window.allMusicData.length > 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue