From 41fe0047b13df02984674577a493bcc4b869d1ef Mon Sep 17 00:00:00 2001 From: Ryan Thaut Date: Tue, 15 Oct 2024 09:39:02 -0600 Subject: [PATCH] fix: do not attempt to insert custom controls on pages that do not have a video element --- app/scripts/content/YouTubeCustomControls.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/scripts/content/YouTubeCustomControls.js b/app/scripts/content/YouTubeCustomControls.js index 5c43de5..36f59ab 100644 --- a/app/scripts/content/YouTubeCustomControls.js +++ b/app/scripts/content/YouTubeCustomControls.js @@ -34,9 +34,11 @@ export const InsertControlsAndWatch = async () => { export const InsertControls = async () => { console.group("[YouTubeCustomControls] InsertControls()"); - InsertPopoutEntryIntoContextMenu(); - await InsertPopoutButtonIntoPlayerControls(); - await InsertRotationButtonsIntoPlayerControls(); + if (document.querySelector("video")) { + InsertPopoutEntryIntoContextMenu(); + await InsertPopoutButtonIntoPlayerControls(); + await InsertRotationButtonsIntoPlayerControls(); + } }; /**