Use getElementsByClassName
This commit is contained in:
parent
cc09017b36
commit
9bd5e71205
@ -32,7 +32,7 @@ export class AnimeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateActions() {
|
updateActions() {
|
||||||
for(let element of findAll(".action")) {
|
for(let element of findAll("action")) {
|
||||||
let actionName = element.dataset.action
|
let actionName = element.dataset.action
|
||||||
|
|
||||||
element.addEventListener(element.dataset.trigger, e => {
|
element.addEventListener(element.dataset.trigger, e => {
|
||||||
@ -44,7 +44,7 @@ export class AnimeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateAvatars() {
|
updateAvatars() {
|
||||||
for(let element of findAll(".user-image")) {
|
for(let element of findAll("user-image")) {
|
||||||
let img = element as HTMLImageElement
|
let img = element as HTMLImageElement
|
||||||
|
|
||||||
if(img.naturalWidth === 0) {
|
if(img.naturalWidth === 0) {
|
||||||
@ -67,7 +67,7 @@ export class AnimeNotifier {
|
|||||||
|
|
||||||
let time = 0
|
let time = 0
|
||||||
|
|
||||||
for(let element of findAll(".mountable")) {
|
for(let element of findAll("mountable")) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.requestAnimationFrame(() => element.classList.add("mounted"))
|
window.requestAnimationFrame(() => element.classList.add("mounted"))
|
||||||
}, time)
|
}, time)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export function* findAll(query: string) {
|
export function* findAll(className: string) {
|
||||||
let elements = document.querySelectorAll(query)
|
let elements = document.getElementsByClassName(className)
|
||||||
|
|
||||||
for(let i = 0; i < elements.length; ++i) {
|
for(let i = 0; i < elements.length; ++i) {
|
||||||
yield elements[i] as HTMLElement
|
yield elements[i] as HTMLElement
|
||||||
|
Loading…
Reference in New Issue
Block a user