1- console . log ( '🚀 Events.js loading...' ) ;
2-
31// Simple constants
42const EVENTS_JSON_URL = '/assets/data/events.json' ;
53
64// Simple build function - 2019 style
75const buildEvents = ( events ) => {
8- console . log ( '📋 Building' , events . length , 'events...' ) ;
9-
106 const eventList = document . getElementById ( 'eventList' ) ;
117 if ( ! eventList ) {
12- console . error ( '❌ No eventList found!' ) ;
138 return ;
149 }
1510
@@ -23,8 +18,6 @@ const buildEvents = (events) => {
2318
2419 // Process each event using old template style in Foundation cards
2520 events . forEach ( ( event , _index ) => {
26- console . log ( '📅 Processing:' , event . name ) ;
27-
2821 try {
2922 // Parse date with Luxon
3023 const startDate = luxon . DateTime . fromISO ( event . date . start ) ;
@@ -115,9 +108,7 @@ const buildEvents = (events) => {
115108 ` ;
116109
117110 eventList . appendChild ( eventContainer ) ;
118- console . log ( '✅ Added event:' , event . name ) ;
119111 } catch ( error ) {
120- console . error ( '❌ Error processing event:' , event . name , error ) ;
121112 // Extract event ID for join link even in error case
122113 const urlParts = event . url . split ( '/' ) . filter ( part => part . length > 0 ) ;
123114 const eventId = urlParts [ urlParts . length - 1 ] ;
@@ -155,8 +146,6 @@ const buildEvents = (events) => {
155146 eventList . appendChild ( simpleContainer ) ;
156147 }
157148 } ) ;
158-
159- console . log ( '✅ All events built with Foundation cards!' ) ;
160149} ;
161150
162151// Show last updated timestamp
@@ -166,8 +155,6 @@ const showLastUpdated = (buildTime) => {
166155 const now = luxon . DateTime . now ( ) ;
167156 const hoursSinceUpdate = now . diff ( lastUpdate , 'hours' ) . hours ;
168157
169- console . log ( `📅 Events last updated: ${ lastUpdate . toRelative ( ) } (${ hoursSinceUpdate . toFixed ( 1 ) } hours ago)` ) ;
170-
171158 // Only show visual indicator if data is getting old (more than 12 hours)
172159 if ( hoursSinceUpdate > 12 ) {
173160 const eventList = document . getElementById ( 'eventList' ) ;
@@ -180,7 +167,7 @@ const showLastUpdated = (buildTime) => {
180167 }
181168 }
182169 } catch ( error ) {
183- console . warn ( 'Could not parse build time:' , error ) ;
170+ // Silently fail - no visual indicator needed for build time parsing errors
184171 }
185172} ;
186173
@@ -212,12 +199,10 @@ const showEventsFallback = () => {
212199// Fetch events with enhanced error handling and metadata support
213200const fetchEvents = async ( ) => {
214201 try {
215- console . log ( '📡 Fetching events from' , EVENTS_JSON_URL ) ;
216202 const response = await fetch ( EVENTS_JSON_URL ) ;
217203 if ( ! response . ok ) { throw new Error ( `HTTP ${ response . status } : ${ response . statusText } ` ) ; }
218204
219205 const eventsData = await response . json ( ) ;
220- console . log ( '📦 Raw events data:' , eventsData ) ;
221206
222207 // Handle both old format (array) and new format (object with metadata)
223208 let events , buildTime ;
@@ -226,55 +211,42 @@ const fetchEvents = async () => {
226211 // Old format - just an array of events
227212 events = eventsData ;
228213 buildTime = null ;
229- console . log ( '📦 Got' , events . length , 'events (legacy format)' ) ;
230214 } else {
231215 // New format - object with metadata
232216 events = eventsData . events || [ ] ;
233217 buildTime = eventsData . buildTime ;
234- console . log ( '📦 Got' , events . length , 'events (new format with metadata)' ) ;
235218
236219 if ( buildTime ) {
237- console . log ( '🕒 Events built at:' , buildTime ) ;
238220 showLastUpdated ( buildTime ) ;
239221 }
240222 }
241223
242224 return events ;
243225 } catch ( error ) {
244- console . error ( '💥 Fetch error:' , error ) ;
245226 showEventsFallback ( ) ;
246227 return [ ] ;
247228 }
248229} ;
249230
250231// Main init
251232const init = async ( ) => {
252- console . log ( '🎯 Initializing...' ) ;
253-
254233 // Check Luxon
255234 if ( typeof luxon === 'undefined' ) {
256- console . error ( '💥 Luxon not available!' ) ;
257235 return ;
258236 }
259- console . log ( '✅ Luxon available' ) ;
260237
261238 const events = await fetchEvents ( ) ;
262239 buildEvents ( events ) ;
263240} ;
264241
265242// Start when DOM ready
266243document . addEventListener ( 'DOMContentLoaded' , ( ) => {
267- console . log ( '📄 DOM ready!' ) ;
268-
269244 const eventList = document . getElementById ( 'eventList' ) ;
270245 if ( ! eventList ) {
271- console . error ( '💥 eventList not found!' ) ;
272246 return ;
273247 }
274248
275249 eventList . innerHTML = '<div class="column"><h3>Loading Missing Maps events...</h3></div>' ;
276250
277251 init ( ) ;
278- } ) ;
279-
280- console . log ( '✅ Events.js loaded!' ) ;
252+ } ) ;
0 commit comments