aboutsummaryrefslogtreecommitdiff
path: root/web/script/playerconf-copy-url.js
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-12-20 16:11:59 +0100
committermetamuffin <metamuffin@disroot.org>2023-12-20 16:11:59 +0100
commita8b2480e898e269e7e0d41dbd46d9a18c7d1e4ba (patch)
treed07feab55c6a4549b604b289833cf53a075f32c5 /web/script/playerconf-copy-url.js
parentddb719feebdf0bfd49fd109ca82ad8c592f63ac5 (diff)
downloadjellything-a8b2480e898e269e7e0d41dbd46d9a18c7d1e4ba.tar
jellything-a8b2480e898e269e7e0d41dbd46d9a18c7d1e4ba.tar.bz2
jellything-a8b2480e898e269e7e0d41dbd46d9a18c7d1e4ba.tar.zst
put that thing everywhere again
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)
- })
-}