window.onload = async () => {
    let pages_data = await fetch("/index.json")
    let pages = await pages_data.json()
    let q = document.getElementsByClassName("random_page")
    if (q.length > 0) {
        q.item(0).addEventListener("click", async (ev) => {
            let i = Math.floor(Math.random() * pages.length)
            console.log(i, pages[i])
            window.location.href = `/${pages[i].id}.html`
        })
    }
}