Add configurable skip delay (0-30s) for Skip Intro and Skip Credits
This commit is contained in:
+26
-3
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user