/*

{rizz.name}

{rizz.storyJSON.description}

*/ export default () => { // deno-lint-ignore ban-types const oldOnloadHandler: Function = window.onload ?? (() => {}); window.onload = async () => { oldOnloadHandler(); const historyDiv = document.getElementById("stories"); const readingHistory: string[] = JSON.parse( localStorage.getItem("readingHistory") ?? "[]", ); for (let i = 0; i < readingHistory.length; i++) { // deno-lint-ignore no-explicit-any const story: Record = await (await fetch( document.location.origin + `/api/getStory?id=${readingHistory[i]}`, )).json(); const searchEle = document.createElement("a"); searchEle.className = "story"; searchEle.href = "/story?id=" + story.id + (localStorage.getItem(`${story.id}_progress`) ? `&chapter=${localStorage.getItem(`${story.id}_progress`)}` : ""); const coverEle = document.createElement("img"); coverEle.src = story.storyJSON.cover; const div = document.createElement("div"); const titleEle = document.createElement("h3"); titleEle.textContent = story.name; div.appendChild(titleEle); const descEle = document.createElement("o"); descEle.textContent = story.storyJSON.description; div.appendChild(descEle); searchEle.appendChild(coverEle); searchEle.appendChild(div); historyDiv?.appendChild(searchEle); } }; };