diff options
Diffstat (limited to 'web/script/player/mod.ts')
-rw-r--r-- | web/script/player/mod.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/web/script/player/mod.ts b/web/script/player/mod.ts index 093f806..97fd605 100644 --- a/web/script/player/mod.ts +++ b/web/script/player/mod.ts @@ -15,6 +15,7 @@ import { Playersync, playersync_controls } from "./sync.ts" globalThis.addEventListener("DOMContentLoaded", () => { if (document.body.classList.contains("player")) { + 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")!; @@ -160,7 +161,7 @@ function initialize_player(el: HTMLElement, node_id: string) { playersync_controls(sync_state, player), e("button", "Launch Native Player", { onclick: () => { - window.location.href = `?kind=nativefullscreen&t=${player.position.value}` + globalThis.location.href = `?kind=nativefullscreen&t=${player.position.value}` } }) )) @@ -255,7 +256,7 @@ function initialize_player(el: HTMLElement, node_id: string) { else if (k.code == "Space") toggle_playing() else if (k.code == "KeyP") toggle_playing() else if (k.code == "KeyF") toggle_fullscreen() - else if (k.code == "KeyQ") window.history.back() + else if (k.code == "KeyQ") globalThis.history.back() else if (k.code == "KeyS") screenshot_video(player.video) else if (k.code == "KeyJ") step_track_kind("subtitles") else if (k.code == "KeyM") toggle_mute() @@ -289,7 +290,7 @@ function screenshot_video(video: HTMLVideoElement) { if (!blob) throw new Error("failed to create blob"); const a = document.createElement("a"); a.download = "screenshot.webp"; - a.href = window.URL.createObjectURL(blob) + a.href = globalThis.URL.createObjectURL(blob) a.click() setTimeout(() => URL.revokeObjectURL(a.href), 0) }, "image/webp", 0.95) |