Some fixes
This commit is contained in:
@ -68,6 +68,10 @@ export class AnimeNotifier {
|
||||
}
|
||||
|
||||
init() {
|
||||
// App init
|
||||
this.app.init()
|
||||
|
||||
// Event listeners
|
||||
document.addEventListener("readystatechange", this.onReadyStateChange.bind(this))
|
||||
document.addEventListener("DOMContentLoaded", this.onContentLoaded.bind(this))
|
||||
document.addEventListener("keydown", this.onKeyDown.bind(this), false)
|
||||
@ -573,7 +577,6 @@ export class AnimeNotifier {
|
||||
return delay(300).then(() => {
|
||||
return request
|
||||
.then(html => this.app.setContent(html, true))
|
||||
.then(() => this.app.markActiveLinks())
|
||||
.then(() => this.app.emit("DOMContentLoaded"))
|
||||
.then(() => this.loading(false))
|
||||
.catch(console.error)
|
||||
|
@ -23,9 +23,14 @@ export class Application {
|
||||
this.fadeOutClass = "fade-out"
|
||||
}
|
||||
|
||||
init() {
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
this.ajaxify()
|
||||
this.markActiveLinks()
|
||||
})
|
||||
}
|
||||
|
||||
run() {
|
||||
this.ajaxify()
|
||||
this.markActiveLinks()
|
||||
this.loading.classList.add(this.fadeOutClass)
|
||||
}
|
||||
|
||||
@ -118,9 +123,6 @@ export class Application {
|
||||
} else {
|
||||
this.content.innerHTML = html
|
||||
}
|
||||
|
||||
this.ajaxify(this.content)
|
||||
this.markActiveLinks(this.content)
|
||||
}
|
||||
|
||||
markActiveLinks(element?: HTMLElement) {
|
||||
|
@ -26,12 +26,19 @@ export class StatusMessage {
|
||||
})
|
||||
}
|
||||
|
||||
clearStyle() {
|
||||
this.container.classList.remove("info-message")
|
||||
this.container.classList.remove("error-message")
|
||||
}
|
||||
|
||||
showError(message: string, duration?: number) {
|
||||
this.clearStyle()
|
||||
this.show(message, duration || 4000)
|
||||
this.container.classList.add("error-message")
|
||||
}
|
||||
|
||||
showInfo(message: string, duration?: number) {
|
||||
this.clearStyle()
|
||||
this.show(message, duration || 2000)
|
||||
this.container.classList.add("info-message")
|
||||
}
|
||||
|
Reference in New Issue
Block a user