From 46b8c41db7609f835a2ddfa24cc62f5e85e525bb Mon Sep 17 00:00:00 2001 From: Ajay Date: Thu, 28 Nov 2024 10:20:42 -0500 Subject: [PATCH] Wait for skip button control bar to be setup before using it --- src/content.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/content.ts b/src/content.ts index 2cb5f6a28..9636af59c 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1766,11 +1766,13 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u if (!autoSkip && skippingSegments.length === 1 && skippingSegments[0].actionType === ActionType.Poi) { - skipButtonControlBar.enable(skippingSegments[0]); - if (isOnMobileYouTube() || Config.config.skipKeybind == null) skipButtonControlBar.setShowKeybindHint(false); - - activeSkipKeybindElement?.setShowKeybindHint(false); - activeSkipKeybindElement = skipButtonControlBar; + waitFor(() => skipButtonControlBar).then(() => { + skipButtonControlBar.enable(skippingSegments[0]); + if (isOnMobileYouTube() || Config.config.skipKeybind == null) skipButtonControlBar.setShowKeybindHint(false); + + activeSkipKeybindElement?.setShowKeybindHint(false); + activeSkipKeybindElement = skipButtonControlBar; + }) } else { if (openNotice) { //send out the message saying that a sponsor message was skipped