aboutsummaryrefslogtreecommitdiff
path: root/web/script/playerconf-copy-url.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/script/playerconf-copy-url.js')
-rw-r--r--web/script/playerconf-copy-url.js32
1 files changed, 0 insertions, 32 deletions
diff --git a/web/script/playerconf-copy-url.js b/web/script/playerconf-copy-url.js
deleted file mode 100644
index 49f27fd..0000000
--- a/web/script/playerconf-copy-url.js
+++ /dev/null
@@ -1,32 +0,0 @@
-
-globalThis.addEventListener("load", () => {
- for (const e of document.getElementsByClassName("playerconf"))
- patch_playerconf(e)
-})
-
-function patch_playerconf(form) {
- const submit = form.lastChild
-
- const copyurl = document.createElement("button")
- const d = document.createElement("div")
- form.removeChild(submit)
- d.appendChild(submit)
- d.appendChild(copyurl)
- form.append(d)
-
- copyurl.textContent = "Copy Stream URL"
- d.style.gridArea = "b"
- d.style.width = "100%"
- copyurl.style.width = "5em"
-
- copyurl.addEventListener("click", ev => {
- const session = document.cookie.split(";").map(e => e.trim().split("=")).find(e => e[0] == "session")[1]
- ev.preventDefault()
- const fd = new FormData(form)
- const sp = ["v", "a", "s"].map(k => fd.get(k)).filter(k => k != "").flat()
- const url = `${window.location.protocol}//${window.location.host}/n/${window.location.pathname.split("/")[2]}/stream?tracks=${sp}&session=${session}`
- navigator.clipboard.writeText(url)
- copyurl.textContent = "Copied"
- setTimeout(() => copyurl.textContent = "Copy Stream URL", 1000)
- })
-}