Implemented adding and removing anime
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
import { Application } from "./Application"
|
||||
import { findAll } from "./utils"
|
||||
import * as actions from "./actions"
|
||||
|
||||
export class AnimeNotifier {
|
||||
app: Application
|
||||
@ -21,15 +23,29 @@ export class AnimeNotifier {
|
||||
this.app.run()
|
||||
}
|
||||
|
||||
loading(isLoading: boolean) {
|
||||
if(isLoading) {
|
||||
this.app.loading.classList.remove(this.app.fadeOutClass)
|
||||
} else {
|
||||
this.app.loading.classList.add(this.app.fadeOutClass)
|
||||
}
|
||||
}
|
||||
|
||||
onContentLoaded() {
|
||||
this.updateAvatars()
|
||||
|
||||
for(let element of findAll(".action")) {
|
||||
let actionName = element.dataset.action
|
||||
|
||||
element.onclick = () => {
|
||||
actions[actionName](this, element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateAvatars() {
|
||||
let images = document.querySelectorAll('.user-image')
|
||||
|
||||
for(let i = 0; i < images.length; ++i) {
|
||||
let img = images[i] as HTMLImageElement
|
||||
for(let element of findAll(".user-image")) {
|
||||
let img = element as HTMLImageElement
|
||||
|
||||
if(img.naturalWidth === 0) {
|
||||
img.onload = function() {
|
||||
|
Reference in New Issue
Block a user