Add configurable skip delay (0-30s) for Skip Intro and Skip Credits

This commit is contained in:
Justin Oro
2026-09-02 16:50:04 -07:00
parent 0f1f2a309e
commit b2082d0624
9 changed files with 333 additions and 21 deletions
+26 -3
View File
@@ -10,7 +10,13 @@ function loadContentScript({ url, html, settings }) {
const window = dom.window;
const storedSettings = Object.assign(
{ plexUrl: "https://app.plex.tv", skipIntro: true, skipCredits: true },
{
plexUrl: "https://app.plex.tv",
skipIntro: true,
skipCredits: true,
introDelaySeconds: 0,
creditsDelaySeconds: 0
},
settings || {}
);
const changeListeners = [];
@@ -57,7 +63,13 @@ function loadPopupScript({ initialSettings } = {}) {
const dom = new JSDOM(html, { url: "chrome-extension://fake/popup.html", runScripts: "dangerously" });
const window = dom.window;
const storedSettings = Object.assign(
{ plexUrl: "https://app.plex.tv", skipIntro: true, skipCredits: true },
{
plexUrl: "https://app.plex.tv",
skipIntro: true,
skipCredits: true,
introDelaySeconds: 0,
creditsDelaySeconds: 0
},
initialSettings || {}
);
const savedCalls = [];
@@ -82,8 +94,19 @@ function loadPopupScript({ initialSettings } = {}) {
return { dom, window, savedCalls, storedSettings };
}
function loadUtils() {
const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>", {
url: "https://example.com",
runScripts: "dangerously"
});
const window = dom.window;
const utilsCode = fs.readFileSync(path.join(__dirname, "..", "utils.js"), "utf8");
window.eval(utilsCode);
return window;
}
function wait(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
module.exports = { loadContentScript, loadPopupScript, wait };
module.exports = { loadContentScript, loadPopupScript, loadUtils, wait };