52,186
edits
Marblemadmax (talk | contribs) No edit summary |
Marblemadmax (talk | contribs) No edit summary |
||
Line 13: | Line 13: | ||
const currentTime = now.getHours() * 100 + now.getMinutes(); | const currentTime = now.getHours() * 100 + now.getMinutes(); | ||
const times = critter.times[dayOfWeek]; | const times = critter.times[dayOfWeek]; | ||
if (!times) return false; // Not available today | if (!times) return false; // Not available today | ||
return times.some(timeRange => { | return times.some(timeRange => { | ||
const [start, end] = timeRange | const [start, end] = timeRange.map(time => { | ||
const [hours, minutes] = time.split(':'); | const [hours, minutes] = time.split(':'); | ||
return parseInt(hours, 10) * 100 + parseInt(minutes, 10); | return parseInt(hours, 10) * 100 + parseInt(minutes, 10); | ||
Line 28: | Line 27: | ||
function generateGalleryContent(critters) { | function generateGalleryContent(critters) { | ||
return critters.filter(isCritterAvailable).map(critter => | return critters.filter(isCritterAvailable).map(critter => | ||
` | `{{CollectionGallery|${critter.name.replace(/ /g, '_')}}}` | ||
).join('\n'); | ).join('\n'); | ||
} | } | ||
// | // Insert the gallery content into the page | ||
function | function insertGalleryContent() { | ||
const | const galleryContent = generateGalleryContent(critters); | ||
if ( | // Assuming there's an element with an ID where you want to insert the gallery content | ||
const targetElement = document.getElementById('crittergallery'); | |||
if (targetElement) { | |||
targetElement.innerHTML = galleryContent; | |||
} | } | ||
} | } | ||
// | // Insert the gallery content | ||
insertGalleryContent(); | |||
}); | }); | ||