Introduced length limits

This commit is contained in:
2019-08-31 16:52:42 +09:00
parent 9338f7bdeb
commit 3ef41b1cdd
21 changed files with 110 additions and 80 deletions

View File

@ -34,9 +34,6 @@ const fetchOptions: RequestInit = {
credentials: "same-origin"
}
// Error message
const searchErrorMessage = "Looks like the website is offline, please retry later."
// Speech recognition
let recognition: SpeechRecognition
@ -122,7 +119,7 @@ export async function search(arn: AnimeNotifier, search: HTMLInputElement, evt?:
// Start searching anime
fetch("/_/anime-search/" + term, fetchOptions)
.then(showResponseInElement(arn, url, "anime", results["anime"]))
.catch(_ => arn.statusMessage.showError(searchErrorMessage))
.catch(err => arn.statusMessage.showError(err))
requestIdleCallback(() => {
// Check that the term hasn't changed in the meantime
@ -138,7 +135,7 @@ export async function search(arn: AnimeNotifier, search: HTMLInputElement, evt?:
fetch(`/_/${key}-search/` + term, fetchOptions)
.then(showResponseInElement(arn, url, key, results[key]))
.catch(_ => arn.statusMessage.showError(searchErrorMessage))
.catch(err => arn.statusMessage.showError(err))
}
})
} catch(err) {