mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-12-22 13:07:00 +00:00
25 lines
547 B
JavaScript
25 lines
547 B
JavaScript
import {ElemJS} from "/static/js/elemjs/elemjs.js"
|
|
|
|
class MarkWatchedButton extends ElemJS {
|
|
constructor(element) {
|
|
super(element)
|
|
this.on("click", this.onClick.bind(this))
|
|
}
|
|
|
|
onClick(event) {
|
|
event.preventDefault()
|
|
let video = this.element
|
|
while (!video.classList.contains("subscriptions-video")) {
|
|
video = video.parentElement
|
|
}
|
|
video.classList.add("video-list-item--watched")
|
|
const form = this.element.parentElement
|
|
fetch(form.getAttribute("action"), {method: "POST"})
|
|
form.remove()
|
|
}
|
|
}
|
|
|
|
export {
|
|
MarkWatchedButton
|
|
}
|