diff options
Diffstat (limited to 'web/script/player/mod.ts')
-rw-r--r-- | web/script/player/mod.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/web/script/player/mod.ts b/web/script/player/mod.ts index 15c37da..53f13bd 100644 --- a/web/script/player/mod.ts +++ b/web/script/player/mod.ts @@ -18,10 +18,10 @@ globalThis.addEventListener("DOMContentLoaded", () => { if (globalThis.location.search.search("nojsp") != -1) return if (!globalThis.MediaSource) return alert("Media Source Extension API required") const node_id = globalThis.location.pathname.split("/")[2]; - const main = document.getElementById("main")!; - document.getElementsByTagName("footer")[0].remove() + document.getElementById("player")?.remove(); + document.getElementsByClassName("playerconf").item(0)?.remove() globalThis.dispatchEvent(new Event("navigationrequiresreload")) - initialize_player(main, node_id) + document.getElementById("main")!.prepend(initialize_player(node_id)) } }) @@ -37,9 +37,7 @@ function toggle_fullscreen() { } -function initialize_player(el: HTMLElement, node_id: string) { - el.innerHTML = "" // clear the body - +function initialize_player(node_id: string): HTMLElement { const logger = new Logger<string>(s => e("p", s)) const player = new Player(node_id, logger) const show_stats = new OVar(false); @@ -238,7 +236,6 @@ function initialize_player(el: HTMLElement, node_id: string) { popups, controls, ) - el.append(pel) controls.onmouseenter = () => idle_inhibit.value = true controls.onmouseleave = () => idle_inhibit.value = false @@ -281,6 +278,8 @@ function initialize_player(el: HTMLElement, node_id: string) { k.preventDefault() }) send_player_progress(node_id, player) + + return pel } function screenshot_video(video: HTMLVideoElement) { |