354bb4255d
Main changes: Replaced [scripts/facebook-events-import.php](/Users/tyemeclifford/Documents/GH/MyKeyser/scripts/facebook-events-import.php) with a Graph API client. It now supports --page-id, --pages-file, --event-id, --events-file, and optional area discovery via --discover-pages --center=LAT,LNG --query=.... Uses FACEBOOK_GRAPH_ACCESS_TOKEN or --access-token. Pulls Graph fields for title, description, start/end time, place/location, ticket URI, and cover.source for the main photo. Keeps the existing staged review/import workflow in /admin/event_imports.php. - Implemented event detail pages and clickable event cards. What changed: Added [event.php](/Users/tyemeclifford/Documents/GH/MyKeyser/event.php) for individual event pages. Made event cards clickable from [events.php](/Users/tyemeclifford/Documents/GH/MyKeyser/events.php), [index.php](/Users/tyemeclifford/Documents/GH/MyKeyser/index.php), and legacy [2index.php](/Users/tyemeclifford/Documents/GH/MyKeyser/2index.php). Added large event photo display plus lightbox enlargement in [assets/css/style.css](/Users/tyemeclifford/Documents/GH/MyKeyser/assets/css/style.css) and [assets/js/app.js](/Users/tyemeclifford/Documents/GH/MyKeyser/assets/js/app.js). Added eventUrl() and externalHref() helpers in [includes/functions.php](/Users/tyemeclifford/Documents/GH/MyKeyser/includes/functions.php). Added copy-event-link support on event detail pages. Updated README to list the new route.
71 lines
2.6 KiB
JavaScript
71 lines
2.6 KiB
JavaScript
// Nav hamburger
|
|
const ham=document.getElementById('ham'),navLinks=document.getElementById('navLinks');
|
|
ham?.addEventListener('click',()=>navLinks?.classList.toggle('open'));
|
|
document.addEventListener('click',e=>{if(!e.target.closest('.navbar'))navLinks?.classList.remove('open')});
|
|
|
|
// User dropdown
|
|
const uBtn=document.getElementById('userBtn'),uDd=document.getElementById('userDd');
|
|
uBtn?.addEventListener('click',e=>{e.stopPropagation();uDd?.classList.toggle('open')});
|
|
document.addEventListener('click',()=>uDd?.classList.remove('open'));
|
|
|
|
// Flash auto-dismiss after 4.5s
|
|
setTimeout(()=>{
|
|
document.querySelectorAll('.flash').forEach(el=>{
|
|
el.style.transition='opacity .5s';
|
|
el.style.opacity='0';
|
|
setTimeout(()=>el.remove(),500);
|
|
});
|
|
},4500);
|
|
|
|
// Confirm dialogs
|
|
document.querySelectorAll('[data-confirm]').forEach(el=>{
|
|
el.addEventListener('click',e=>{if(!confirm(el.dataset.confirm))e.preventDefault();});
|
|
});
|
|
|
|
// Admin sidebar active link
|
|
document.querySelectorAll('.asl').forEach(l=>{
|
|
const href=l.getAttribute('href');
|
|
if(href&&(location.pathname===href||location.pathname.startsWith(href.replace(/\/[^/]+$/,'/')+'/')&&href!='/admin/'))
|
|
l.classList.add('on');
|
|
if(location.pathname===href)l.classList.add('on');
|
|
});
|
|
|
|
// Event photo lightbox
|
|
const lightboxTriggers=document.querySelectorAll('[data-lightbox-src]');
|
|
let lightbox;
|
|
const closeLightbox=()=>{
|
|
lightbox?.classList.remove('open');
|
|
document.body.style.overflow='';
|
|
};
|
|
if(lightboxTriggers.length){
|
|
lightbox=document.createElement('div');
|
|
lightbox.className='lightbox';
|
|
lightbox.innerHTML='<button type="button" class="lightbox-close" aria-label="Close image">×</button><img alt="">';
|
|
document.body.appendChild(lightbox);
|
|
const img=lightbox.querySelector('img');
|
|
lightboxTriggers.forEach(btn=>{
|
|
btn.addEventListener('click',()=>{
|
|
img.src=btn.dataset.lightboxSrc;
|
|
img.alt=btn.dataset.lightboxAlt||'Event photo';
|
|
lightbox.classList.add('open');
|
|
document.body.style.overflow='hidden';
|
|
});
|
|
});
|
|
lightbox.addEventListener('click',e=>{if(e.target===lightbox||e.target.closest('.lightbox-close'))closeLightbox();});
|
|
document.addEventListener('keydown',e=>{if(e.key==='Escape')closeLightbox();});
|
|
}
|
|
|
|
// Copy share links
|
|
document.querySelectorAll('[data-copy-url]').forEach(btn=>{
|
|
btn.addEventListener('click',async()=>{
|
|
const label=btn.textContent;
|
|
try{
|
|
await navigator.clipboard.writeText(btn.dataset.copyUrl);
|
|
btn.textContent='Copied';
|
|
setTimeout(()=>btn.textContent=label,1400);
|
|
}catch{
|
|
prompt('Copy this link:',btn.dataset.copyUrl);
|
|
}
|
|
});
|
|
});
|