Fixed a few more linter errors

This commit is contained in:
Eduard Urbach 2019-11-17 18:44:30 +09:00
parent 878f1913e3
commit 7e25ee6faf
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
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

View File

@ -7,7 +7,9 @@
"strict": false,
"strictFunctionTypes": false,
"strictNullChecks": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true
"noUnusedParameters": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@ -11,7 +11,8 @@
"arrow-parens": false,
"trailing-comma": false,
"prefer-const": true,
"no-var-keyword": true
"no-var-keyword": true,
"eofline": true
},
"rulesDirectory": []
}