1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-10 02:27:29 +00:00
cloudtube/html/static/js/mark-watched.js
2021-01-09 14:09:59 +13:00

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
}