Fixed infinite scroll on AMV page
This commit is contained in:
parent
8d50f9583e
commit
bc27dc99a6
@ -2,7 +2,7 @@ component AMV(amv *arn.AMV, user *arn.User)
|
|||||||
.amv.mountable
|
.amv.mountable
|
||||||
.video-container
|
.video-container
|
||||||
video.video.lazy(controls="controls", controlsList="nodownload")
|
video.video.lazy(controls="controls", controlsList="nodownload")
|
||||||
div(data-src="/videos/amvs/" + amv.File, data-type="video/webm")
|
source(data-src="https://notify.moe/videos/amvs/" + amv.File, data-type="video/webm")
|
||||||
|
|
||||||
AMVFooter(amv, user)
|
AMVFooter(amv, user)
|
||||||
|
|
||||||
|
@ -650,20 +650,24 @@ export default class AnimeNotifier {
|
|||||||
// Prevent context menu
|
// Prevent context menu
|
||||||
video.addEventListener("contextmenu", e => e.preventDefault())
|
video.addEventListener("contextmenu", e => e.preventDefault())
|
||||||
|
|
||||||
for(let child of video.children) {
|
let modified = false
|
||||||
let div = child as HTMLDivElement
|
|
||||||
let source = document.createElement("source")
|
|
||||||
source.src = div.dataset.src
|
|
||||||
source.type = div.dataset.type
|
|
||||||
|
|
||||||
Diff.mutations.queue(() => video.replaceChild(source, div))
|
for(let child of video.children) {
|
||||||
|
let element = child as HTMLSourceElement
|
||||||
|
|
||||||
|
if(element.src !== element.dataset.src) {
|
||||||
|
element.src = element.dataset.src
|
||||||
|
modified = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(modified) {
|
||||||
Diff.mutations.queue(() => {
|
Diff.mutations.queue(() => {
|
||||||
video.load()
|
video.load()
|
||||||
video.classList.add("element-found")
|
video.classList.add("element-found")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.visibilityObserver.observe(video)
|
this.visibilityObserver.observe(video)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user