Skip to content
Merged
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
24 changes: 14 additions & 10 deletions nicar-2026-sw.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const CACHE_NAME = 'nicar-2026-v1';
// IMPORTANT: Bump this version number whenever nicar-2026.html or this file changes
const CACHE_NAME = 'nicar-2026-v4';
const SCHEDULE_URL = 'https://ire-nicar-conference-schedules.s3.us-east-2.amazonaws.com/nicar-2026/nicar-2026-schedule.json';
const ASSETS_TO_CACHE = [
'nicar-2026.html',
Expand Down Expand Up @@ -73,9 +74,13 @@ self.addEventListener('fetch', event => {
}

// Cache-first for same-origin assets (the HTML page itself)
// GitHub Pages serves pretty URLs: /nicar-2026 returns nicar-2026.html
// so we need to try both the exact URL and the .html variant as cache keys
if (url.origin === self.location.origin) {
event.respondWith(
caches.match(event.request).then(cached => {
(async () => {
const cached = await caches.match(event.request)
|| await caches.match(event.request.url + '.html');
if (cached) {
// Background update
fetch(event.request).then(response => {
Expand All @@ -85,14 +90,13 @@ self.addEventListener('fetch', event => {
}).catch(() => {});
return cached;
}
return fetch(event.request).then(response => {
if (response.ok) {
const clone = response.clone();
caches.open(CACHE_NAME).then(cache => cache.put(event.request, clone));
}
return response;
});
})
const response = await fetch(event.request);
if (response.ok) {
const clone = response.clone();
caches.open(CACHE_NAME).then(cache => cache.put(event.request, clone));
}
return response;
})()
);
return;
}
Expand Down
24 changes: 21 additions & 3 deletions nicar-2026.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- IMPORTANT: When changing this file or nicar-2026-sw.js, bump the CACHE_NAME version in nicar-2026-sw.js -->
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -893,7 +894,7 @@ <h1>NICAR 2026</h1>

const isStarred = starredIds.has(session.session_id);

return `<div class="session-card${canceledClass}">
return `<div class="session-card${canceledClass}" id="session-${session.session_id}">
<div class="session-header">
<div class="session-badges">
<span class="session-time">${timeRange}</span>
Expand Down Expand Up @@ -963,12 +964,12 @@ <h3 class="session-title" style="flex:1">${session.session_title}</h3>
const isStarred = starredIds.has(session.session_id);
const liveClass = isLive ? ' is-live' : '';
const liveDot = isLive ? '<span class="nn-live-dot"></span>' : '';
return `<div class="now-next-card${liveClass}">
return `<div class="now-next-card${liveClass}" onclick="jumpToSession(${session.session_id})" style="cursor:pointer">
<div class="nn-info">
<div class="nn-title">${liveDot}${session.session_title}</div>
<div class="nn-meta">${formatTime(session.start_time)} · ${session.room || 'TBD'}${session.session_type ? ' · ' + session.session_type : ''}</div>
</div>
<button class="star-btn${isStarred ? ' starred' : ''}" onclick="toggleStar(${session.session_id})" aria-label="${isStarred ? 'Unstar' : 'Star'} this session">${isStarred ? '★' : '☆'}</button>
<button class="star-btn${isStarred ? ' starred' : ''}" onclick="event.stopPropagation();toggleStar(${session.session_id})" aria-label="${isStarred ? 'Unstar' : 'Star'} this session">${isStarred ? '★' : '☆'}</button>
</div>`;
}

Expand Down Expand Up @@ -1062,6 +1063,23 @@ <h3 class="session-title" style="flex:1">${session.session_title}</h3>
}
}

function jumpToSession(sessionId) {
// Find the session's day and switch to that tab
const session = allSessions.find(s => s.session_id === sessionId);
if (session) {
const dateStr = toConferenceDate(session.start_time);
const tab = document.querySelector(`.day-tab[data-day="${dateStr}"]`);
if (tab) showDay(dateStr, tab);
}
const el = document.getElementById(`session-${sessionId}`);
if (el) {
el.scrollIntoView({ behavior: 'smooth', block: 'center' });
el.style.transition = 'box-shadow 0.3s';
el.style.boxShadow = '0 0 0 3px #1a237e';
setTimeout(() => { el.style.boxShadow = ''; }, 2000);
}
}

function downloadICS() {
if (!conferenceData) return;

Expand Down
Loading