Atom feed for our EEG site

more

Changed files
+114 -11
+114 -11
index.html
···
font-family: 'JetBrains Mono', monospace;
font-size: 0.75rem;
color: var(--text-muted);
-
min-width: 80px;
+
min-width: 32px;
margin-right: 10px;
+
text-align: right;
+
}
+
+
.date-column {
+
position: absolute;
+
left: 0;
+
width: 110px;
+
font-family: 'JetBrains Mono', monospace;
+
color: var(--text-muted);
+
font-size: 0.8rem;
+
text-align: left;
+
padding-left: 15px;
+
}
+
+
.month-year-header {
+
position: sticky;
+
top: var(--header-height);
+
background-color: var(--bg-color);
+
z-index: 10;
+
padding: 8px 0;
+
margin-left: -110px;
+
padding-left: 110px;
+
width: 100%;
+
}
+
+
.month-year-label {
+
font-weight: 600;
+
color: var(--accent-alt);
+
}
+
+
.feed-container {
+
position: relative;
+
padding-left: 110px; /* Make room for date column */
}
.feed-item-author {
···
font-size: 0.95rem;
font-weight: 400;
display: inline;
+
word-break: break-word;
}
.feed-item-title a {
···
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
+
padding-right: 10px;
}
.feed-item-preview {
···
font-family: 'JetBrains Mono', monospace;
font-size: 0.75rem;
color: var(--text-muted);
-
min-width: 80px;
+
min-width: 32px;
margin-right: 15px;
+
text-align: right;
}
.link-item-source {
···
<div class="loading-spinner"></div>
<p class="loading-text">Growing Content...</p>
</div>
-
<div id="feed-items" class="tab-content active" data-tab="posts"></div>
-
<div id="link-items" class="tab-content" data-tab="links"></div>
+
<div id="feed-items" class="tab-content active feed-container" data-tab="posts"></div>
+
<div id="link-items" class="tab-content feed-container" data-tab="links"></div>
<div id="people-items" class="tab-content" data-tab="people">
<h2 class="people-header">EEG Contributors</h2>
<div class="people-container"></div>
···
// Setup a new observer
globalFeedObserver = setupObserver({
root: null,
-
rootMargin: '0px',
-
threshold: 0.3
+
rootMargin: '-80px 0px',
+
threshold: 0.1
});
// Observe all items in the active tab
···
// Create a copy of entriesArray to process strictly by date
const entriesByDate = [...entriesArray];
+
// Track current month/year for date headers
+
let currentYear = null;
+
let currentMonth = null;
+
// Process each entry in date order
for (const entry of entriesByDate) {
// Skip entries already processed
if (processedArticleIds.has(entry.articleId)) continue;
const date = new Date(entry.published);
-
const dateAttr = `data-year="${date.getFullYear()}" data-month="${date.getMonth()}"`;
+
const year = date.getFullYear();
+
const month = date.getMonth();
+
const dateAttr = `data-year="${year}" data-month="${month}"`;
+
+
// Check if we need to add a new month/year header
+
if (currentYear !== year || currentMonth !== month) {
+
currentYear = year;
+
currentMonth = month;
+
+
entriesHTML += `
+
<div class="month-year-header" ${dateAttr}>
+
<div class="date-column">
+
<div class="month-year-label">${monthNames[month]} ${year}</div>
+
</div>
+
</div>`;
+
}
+
+
// Function to get day with ordinal suffix
+
function getDayWithOrdinal(date) {
+
const day = date.getDate();
+
let suffix = "th";
+
if (day % 10 === 1 && day !== 11) {
+
suffix = "st";
+
} else if (day % 10 === 2 && day !== 12) {
+
suffix = "nd";
+
} else if (day % 10 === 3 && day !== 13) {
+
suffix = "rd";
+
}
+
return day + suffix;
+
}
// Add entry
entriesHTML += `
<article id="${entry.articleId}" class="feed-item" ${dateAttr}>
<div class="feed-item-row">
-
<div class="feed-item-date">${formatDate(entry.published)}</div>
+
<div class="feed-item-date">${getDayWithOrdinal(date)}</div>
<div class="feed-item-author">${entry.author}</div>
<div class="feed-item-content-wrapper">
<div class="feed-item-title"><a href="${entry.link}" target="_blank">${entry.title}</a></div><div class="feed-item-preview">${entry.textPreview}</div>
···
// Set up scroll observer to highlight timeline items
const observerOptions = {
root: null,
-
rootMargin: '0px',
-
threshold: 0.3
+
rootMargin: '-80px 0px',
+
threshold: 0.1
};
// Skip adding data attributes - we've already done this during HTML generation
···
// Generate HTML for links view
let linksHTML = '';
+
+
// Track current month/year for date headers in links view
+
let currentLinkYear = null;
+
let currentLinkMonth = null;
+
dedupedLinks.forEach(link => {
const date = link.date;
+
const year = date.getFullYear();
+
const month = date.getMonth();
const dateFormatted = formatDate(date);
const url = new URL(link.url);
let displayText = url.hostname.replace('www.', '');
let iconPath = '';
+
+
// Check if we need to add a new month/year header
+
if (currentLinkYear !== year || currentLinkMonth !== month) {
+
currentLinkYear = year;
+
currentLinkMonth = month;
+
+
linksHTML += `
+
<div class="month-year-header" data-year="${year}" data-month="${month}">
+
<div class="date-column">
+
<div class="month-year-label">${monthNames[month]} ${year}</div>
+
</div>
+
</div>`;
+
}
// Platform-specific display logic (same as in the main feed)
if (url.hostname === 'github.com' || url.hostname === 'gist.github.com') {
···
+
// Function to get day with ordinal suffix (reused)
+
function getLinkDayWithOrdinal(date) {
+
const day = date.getDate();
+
let suffix = "th";
+
if (day % 10 === 1 && day !== 11) {
+
suffix = "st";
+
} else if (day % 10 === 2 && day !== 12) {
+
suffix = "nd";
+
} else if (day % 10 === 3 && day !== 13) {
+
suffix = "rd";
+
}
+
return day + suffix;
+
}
+
// Create link item HTML
linksHTML += `
<div class="link-item" data-year="${date.getFullYear()}" data-month="${date.getMonth()}">
-
<div class="link-item-date">${dateFormatted}</div>
+
<div class="link-item-date">${getLinkDayWithOrdinal(date)}</div>
<div class="link-item-source" title="From: ${link.sourceTitle}">
<a href="${link.sourceLink}" target="_blank" style="color: inherit; text-decoration: none;">
${link.source}