aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/style/playerconf-copy-url.js
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-10-01 10:14:20 +0200
committermetamuffin <metamuffin@disroot.org>2023-10-01 10:14:20 +0200
commit3fa55dba1b0ca408a10e7456a6d4308dd114c2f6 (patch)
treef1f378662406a5f091816ca97c3f1ccfb5210eef /server/src/routes/ui/style/playerconf-copy-url.js
parentd857684dd6358fb5ff979ca09ac78b5649b0f411 (diff)
downloadjellything-3fa55dba1b0ca408a10e7456a6d4308dd114c2f6.tar
jellything-3fa55dba1b0ca408a10e7456a6d4308dd114c2f6.tar.bz2
jellything-3fa55dba1b0ca408a10e7456a6d4308dd114c2f6.tar.zst
move stylesheets and refactor js bundler
Diffstat (limited to 'server/src/routes/ui/style/playerconf-copy-url.js')
-rw-r--r--server/src/routes/ui/style/playerconf-copy-url.js32
1 files changed, 0 insertions, 32 deletions
diff --git a/server/src/routes/ui/style/playerconf-copy-url.js b/server/src/routes/ui/style/playerconf-copy-url.js
deleted file mode 100644
index 49f27fd..0000000
--- a/server/src/routes/ui/style/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)
- })
-}