Can edit anime list items now

This commit is contained in:
2017-06-21 14:00:52 +02:00
parent 5c900c9738
commit cc09017b36
8 changed files with 131 additions and 48 deletions

View File

@ -30,11 +30,8 @@ export class AnimeNotifier {
this.app.loading.classList.add(this.app.fadeOutClass)
}
}
onContentLoaded() {
this.updateMountables()
this.updateAvatars()
updateActions() {
for(let element of findAll(".action")) {
let actionName = element.dataset.action
@ -46,31 +43,6 @@ export class AnimeNotifier {
}
}
onPopState(e: PopStateEvent) {
if(e.state) {
this.app.load(e.state, {
addToHistory: false
})
} else if(this.app.currentPath !== this.app.originalPath) {
this.app.load(this.app.originalPath, {
addToHistory: false
})
}
}
onKeyDown(e: KeyboardEvent) {
// Ctrl + Q = Search
if(e.ctrlKey && e.keyCode == 81) {
let search = this.app.find("search") as HTMLInputElement
search.focus()
search.select()
e.preventDefault()
e.stopPropagation()
}
}
updateAvatars() {
for(let element of findAll(".user-image")) {
let img = element as HTMLImageElement
@ -108,6 +80,38 @@ export class AnimeNotifier {
}
}
onContentLoaded() {
// Update each of these asynchronously
Promise.resolve().then(() => this.updateMountables())
Promise.resolve().then(() => this.updateAvatars())
Promise.resolve().then(() => this.updateActions())
}
onPopState(e: PopStateEvent) {
if(e.state) {
this.app.load(e.state, {
addToHistory: false
})
} else if(this.app.currentPath !== this.app.originalPath) {
this.app.load(this.app.originalPath, {
addToHistory: false
})
}
}
onKeyDown(e: KeyboardEvent) {
// Ctrl + Q = Search
if(e.ctrlKey && e.keyCode == 81) {
let search = this.app.find("search") as HTMLInputElement
search.focus()
search.select()
e.preventDefault()
e.stopPropagation()
}
}
// onResize(e: UIEvent) {
// let hasScrollbar = this.app.content.clientHeight === this.app.content.scrollHeight