cleanup, minor fixes

This commit is contained in:
ThaUnknown 2021-04-22 18:55:16 +02:00
parent 81c27167cd
commit 9f7efce30e
2 changed files with 2 additions and 26 deletions

View file

@ -65,12 +65,6 @@ function traceAnime (image, type) { // WAIT lookup logic
}
})
}
function searchBox () { // make searchbox behave nicely
search.placeholder = search.value
searchAnime(search.value)
search.value = ''
document.location.hash = '#browse'
}
// events
navNowPlaying.onclick = () => { viewAnime(client.nowPlaying?.media) }
// AL lookup logic
@ -294,24 +288,6 @@ mutation ($id: Int, $status: MediaListStatus, $episode: Int, $repeat: Int) {
}
}
}
let alResponse
async function searchAnime (a) { // search bar functionality
const cards = []
const browse = document.querySelector('.browse')
browse.innerHTML = ''
// browse.appendChild(skeletonCard) // TODO: fix
a ? alResponse = await alRequest({ method: 'SearchName', name: a }) : alResponse = await alRequest({ method: 'Trending' })
try {
alResponse.data.Page.media.forEach(media => {
cards.push(cardCreator({ media: media, onclick: () => viewAnime(media) }))
})
} catch (e) {
console.error(e)
}
browse.innerHTML = ''
browse.append(...cards)
}
// these really shouldnt be global
const detailsfrag = document.createDocumentFragment()
const details = {
@ -687,7 +663,6 @@ async function releasesRss (limit) {
}
let alID // login icon
async function loadAnime () {
// await searchAnime()
if (localStorage.getItem('ALtoken')) {
alRequest({ method: 'Viewer' }).then(result => {
oauth.removeAttribute('href')

View file

@ -185,6 +185,7 @@ async function loadHomePage () {
}
}
function reloadHome () {
home.classList.remove('browsing')
lastRSSDate = undefined
for (const item of homePreviewElements) {
item.textContent = ''
@ -215,7 +216,7 @@ async function loadHomePage () {
searchTimeout = setTimeout(() => {
homeLoadFunctions.search()
searchTimeout = undefined
}, 1000)
}, 500)
}
}