mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2026-01-29 13:50:50 +03:00
Don’t throw an exception if there’s no videoRoot
Suggested change by @ajayyy Co-authored-by: Ajay Ramachandran <dev@ajay.app>
This commit is contained in:
@@ -1532,7 +1532,7 @@ function addHotkeyListener(): boolean {
|
||||
if (onInvidious) videoRoot = (document.getElementById("player-container") ?? document.getElementById("player")) as HTMLDivElement;
|
||||
if (video.baseURI.startsWith("https://www.youtube.com/tv#/")) videoRoot = document.querySelector("ytlr-watch-page") as HTMLDivElement;
|
||||
|
||||
if (!videoRootsWithEventListeners.includes(videoRoot)) {
|
||||
if (videoRoot && !videoRootsWithEventListeners.includes(videoRoot)) {
|
||||
videoRoot.addEventListener("keydown", hotkeyListener);
|
||||
videoRootsWithEventListeners.push(videoRoot);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user