From 3fed3b425e63b8d17c1a7ab097591fd7a2de5f60 Mon Sep 17 00:00:00 2001 From: Josh Patra <30350506+SoPat712@users.noreply.github.com> Date: Fri, 18 Jul 2025 18:00:06 -0400 Subject: [PATCH] add feature in popup to force search for videos, on websites that it doesn't show up on --- inject.js | 25 +++++++++++++++++++++++++ manifest.json | 2 +- popup.html | 4 +++- popup.js | 31 ++++++++++++++++++++++++++++--- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/inject.js b/inject.js index 14563b2..65f0eb1 100644 --- a/inject.js +++ b/inject.js @@ -137,6 +137,31 @@ chrome.storage.sync.get(tc.settings, function (storage) { predefined: true }); } + // Add a listener for messages from the popup. + // We use a global flag to ensure the listener is only attached once. + if (!window.vscMessageListener) { + chrome.runtime.onMessage.addListener( + function (request, sender, sendResponse) { + // Check if the message is a request to re-scan the page. + if (request.action === "rescan_page") { + log("Re-scan command received from popup.", 4); + + // Call the main initialization function. It's designed to be safe + // to run multiple times and will pick up any new videos. + initializeWhenReady(document); + + // Send a response to the popup to confirm completion. + sendResponse({ status: "complete" }); + } + + // Required to allow for asynchronous responses. + return true; + } + ); + + // Set the flag to prevent adding the listener again. + window.vscMessageListener = true; + } initializeWhenReady(document); }); diff --git a/manifest.json b/manifest.json index d4f2f70..06ff858 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Video Speed Controller", "short_name": "videospeed", - "version": "1.4.5", + "version": "1.5.1", "manifest_version": 2, "description": "Speed up, slow down, advance and rewind HTML5 audio/video with shortcuts", "homepage_url": "https://github.com/SoPat712/videospeed", diff --git a/popup.html b/popup.html index 28354b9..41c5958 100644 --- a/popup.html +++ b/popup.html @@ -1,4 +1,4 @@ - +