diff --git a/src/@types/index.ts b/src/@types/index.ts index 270ff866..dfd7940c 100644 --- a/src/@types/index.ts +++ b/src/@types/index.ts @@ -103,6 +103,7 @@ export type RequestDataMessage = Prettify< >; export type ContentSendOnlyMessageMappings = { setRememberedVolume: SendDataMessage<"send_data", "content", "setRememberedVolume", { shortsPageVolume?: number; watchPageVolume?: number }>; + pageLoaded: SendDataMessage<"send_data", "content", "pageLoaded", undefined>; }; export type ExtensionSendOnlyMessageMappings = { volumeBoostChange: DataResponseMessage<"volumeBoostChange", { volumeBoostEnabled: boolean; volumeBoostAmount?: number }>; diff --git a/src/features/hideScrollBar/utils.ts b/src/features/hideScrollBar/utils.ts index ed84997d..fcc40d7f 100644 --- a/src/features/hideScrollBar/utils.ts +++ b/src/features/hideScrollBar/utils.ts @@ -5,6 +5,9 @@ export function hideScrollBar() { width: 0px; height: 0px; } + html { + scrollbar-width: none; + } `; style.id = "yte-hide-scroll-bar"; document.head.appendChild(style); diff --git a/src/manifest.ts b/src/manifest.ts index e24d5acd..3a071b20 100755 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -91,7 +91,13 @@ const manifestV2: Manifest.WebExtensionManifest = { "src/pages/content/index.js", "src/pages/inject/index.js", ...availableLocales.map((locale) => `/locales/${locale}.json`) - ] + ], + browser_specific_settings: { + gecko: { + id: "{c49b13b1-5dee-4345-925e-0c793377e3fa}", + strict_min_version: "48.0" + } + } }; export { manifestV3, manifestV2 }; diff --git a/src/pages/content/index.tsx b/src/pages/content/index.tsx index da643e2b..0d89893f 100644 --- a/src/pages/content/index.tsx +++ b/src/pages/content/index.tsx @@ -11,7 +11,7 @@ import adjustVolumeOnScrollWheel from "@/src/features/scrollWheelVolumeControl"; import { promptUserToResumeVideo, setupVideoHistory } from "@/src/features/videoHistory"; import volumeBoost from "@/src/features/volumeBoost"; import eventManager from "@/utils/EventManager"; -import { browserColorLog, formatError, waitForSpecificMessage } from "@/utils/utilities"; +import { browserColorLog, formatError, sendContentOnlyMessage, waitForSpecificMessage } from "@/utils/utilities"; import type { ExtensionSendOnlyMessageMappings, Messages, YouTubePlayerDiv } from "@/src/@types"; import { enableHideScrollBar } from "@/src/features/hideScrollBar"; @@ -275,6 +275,7 @@ window.onload = async function () { } } }); + sendContentOnlyMessage("pageLoaded", undefined); }; window.onbeforeunload = function () { eventManager.removeAllEventListeners(); diff --git a/src/pages/inject/index.tsx b/src/pages/inject/index.tsx index 0c05baa1..1ea20760 100644 --- a/src/pages/inject/index.tsx +++ b/src/pages/inject/index.tsx @@ -31,12 +31,6 @@ document.documentElement.appendChild(script); }); sendExtensionMessage("options", "data_response", { options }); })(); -window.onload = () => { - chrome.storage.onChanged.addListener(storageListeners); -}; -window.onunload = () => { - chrome.storage.onChanged.removeListener(storageListeners); -}; /** * Listens for the "yte-message-from-youtube" event and handles incoming messages from the YouTube page. @@ -126,6 +120,12 @@ document.addEventListener("yte-message-from-youtube", async () => { }); break; } + case "pageLoaded": { + chrome.storage.onChanged.addListener(storageListeners); + window.onunload = () => { + chrome.storage.onChanged.removeListener(storageListeners); + }; + } } }); const storageListeners = async (changes: StorageChanges, areaName: string) => {