You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
892 B
29 lines
892 B
window.onload = () => {
|
|
let favoriteSearches = document.getElementById("favorite-searches");
|
|
let favoriteStories = document.getElementById("favorite-stories");
|
|
|
|
let savedSearches = JSON.parse(
|
|
localStorage.getItem("savedSearches") ?? "[]"
|
|
);
|
|
let savedStories = JSON.parse(localStorage.getItem("savedStories") ?? "[]");
|
|
|
|
// Broke: JSX
|
|
// Woke:
|
|
for (const search of savedSearches) {
|
|
favoriteSearches.innerHTML += `<a class="favorite-search" href="/search?${new URLSearchParams(
|
|
search
|
|
)}">${search.query} (${search.type} search, sorted by ${
|
|
search.sort
|
|
})</a>`;
|
|
}
|
|
|
|
for (const story of savedStories) {
|
|
// prettier-ignore
|
|
favoriteStories.innerHTML +=
|
|
`<a class="favorite-story" href="/story?id=${story.id}">
|
|
<img src=${story.coverURL}/>
|
|
<h3>${story.name}</h3>
|
|
</a>`
|
|
}
|
|
};
|