| |
| |
|
|
| |
| export async function loadArtifacts() { |
| try { |
| const response = await fetch('/data/artifacts.json'); |
| if (!response.ok) { |
| throw new Error(`HTTP error! status: ${response.status}`); |
| } |
| const artifacts = await response.json(); |
| |
| |
| window.allArtifacts = artifacts; |
| |
| return artifacts; |
| } catch (error) { |
| console.error('Failed to load artifacts:', error); |
| window.allArtifacts = []; |
| throw error; |
| } |
| } |
|
|
| |
| export function getArtifacts() { |
| return window.allArtifacts || []; |
| } |
|
|
| export function getFeaturedArtifacts() { |
| const artifacts = getArtifacts(); |
| return artifacts |
| .filter(artifact => artifact.featured === true) |
| .sort((a, b) => new Date(b.date) - new Date(a.date)); |
| } |
|
|
| export function getAreasData() { |
| return window.areasData || {}; |
| } |
|
|
| |
| export const app = { |
| getArtifacts, |
| getFeaturedArtifacts, |
| getAreasData, |
| waitForInit: () => Promise.resolve() |
| }; |
|
|
| |
| window.app = app; |
|
|
|
|