From a8b2480e898e269e7e0d41dbd46d9a18c7d1e4ba Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 20 Dec 2023 16:11:59 +0100 Subject: put that thing everywhere again --- web/script/playerconf-copy-url.js | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 web/script/playerconf-copy-url.js (limited to 'web/script/playerconf-copy-url.js') 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) - }) -} -- cgit v1.2.3-70-g09d2