Fixed a few more linter errors

This commit is contained in:
2019-11-17 18:44:30 +09:00
parent 878f1913e3
commit 7e25ee6faf
48 changed files with 69 additions and 59 deletions

View File

@ -310,18 +310,25 @@ export default class AnimeNotifier {
// search.setAttribute("list", titleList.id)
}
async onBeforeUnload(e: BeforeUnloadEvent) {
let message = ""
onBeforeUnload(e: BeforeUnloadEvent) {
if(this.app.currentPath !== "/new/thread") {
return
}
if(!document.activeElement) {
return
}
if(document.activeElement.tagName !== "TEXTAREA") {
return
}
if((document.activeElement as HTMLTextAreaElement).value.length < 20) {
return
}
// Prevent closing tab on new thread page
if(this.app.currentPath === "/new/thread" && document.activeElement && document.activeElement.tagName === "TEXTAREA" && (document.activeElement as HTMLTextAreaElement).value.length > 20) {
message = "You have unsaved changes on the current page. Are you sure you want to leave?"
}
if(message) {
e.returnValue = message
return message
}
e.returnValue = "You have unsaved changes on the current page. Are you sure you want to leave?"
}
prepareTooltips(elements?: IterableIterator<HTMLElement>) {
@ -1156,7 +1163,7 @@ export default class AnimeNotifier {
async diff(url: string) {
if(url === this.app.currentPath) {
return null
return
}
const path = "/_" + url