1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-27 01:47:30 +00:00
cloudtube/html/static/js/mark-watched.js

25 lines
547 B
JavaScript
Raw Normal View History

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
}