2021-04-25 12:02:59 +00:00
|
|
|
import {q, ejs, ElemJS} from "/static/js/elemjs/elemjs.js"
|
|
|
|
|
|
|
|
const video = q("#video")
|
|
|
|
|
|
|
|
console.log
|
|
|
|
|
|
|
|
video.addEventListener("ended", () => {
|
|
|
|
if (data.continuous) {
|
2021-04-25 12:22:14 +00:00
|
|
|
const first = q("#continuous-first")
|
|
|
|
const url = first.querySelector(".title-link").href
|
|
|
|
location.assign(url)
|
2021-04-25 12:02:59 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
class ContinuousControls extends ElemJS {
|
|
|
|
constructor() {
|
|
|
|
super(q("#continuous-controls"))
|
|
|
|
this.button = ejs(q("#continuous-stop"))
|
|
|
|
this.button.on("click", this.onClick.bind(this))
|
|
|
|
}
|
|
|
|
|
|
|
|
onClick(event) {
|
|
|
|
event.preventDefault()
|
|
|
|
this.element.style.display = "none"
|
|
|
|
data.continuous = false
|
|
|
|
q("#continuous-related-videos").remove()
|
|
|
|
q("#standard-related-videos").style.display = ""
|
|
|
|
const url = new URL(location)
|
|
|
|
url.searchParams.delete("continuous")
|
|
|
|
url.searchParams.delete("session-watched")
|
|
|
|
history.replaceState(null, "", url.toString())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
new ContinuousControls(q("#continuous-stop"))
|