mirror of
https://github.com/SoPat712/Speeder.git
synced 2026-08-21 20:32:07 -04:00
Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc45d02541
|
||
|
|
f61f1fdd97
|
||
|
|
de6598dfde
|
||
|
|
7e1678ec4b | ||
|
|
113c3b2896 | ||
|
|
d6f9a03946
|
||
|
|
014e05998d
|
||
|
|
1a7dc3097e
|
||
|
|
c626aca89c
|
||
|
|
05b8456e94
|
||
|
|
0cbfac4b82
|
||
|
|
b3707c0803
|
||
|
|
fb25c56230
|
||
|
|
4efc3e0acc
|
||
|
|
7c0a188cd3
|
||
|
|
d7ce1fd000
|
||
|
|
313832015b
|
@@ -159,8 +159,8 @@ var tc = {
|
||||
lastInteractedMedia: null
|
||||
};
|
||||
|
||||
var MIN_SPEED = Number(keyBindingUtils.MIN_SPEED) || 0.01;
|
||||
var MAX_SPEED = Number(keyBindingUtils.MAX_SPEED) || 100;
|
||||
var MIN_SPEED = Number(keyBindingUtils.MIN_SPEED) || 0.1;
|
||||
var MAX_SPEED = Number(keyBindingUtils.MAX_SPEED) || 16;
|
||||
var YT_NATIVE_MIN = 0.25;
|
||||
var YT_NATIVE_MAX = 2.0;
|
||||
var YT_NATIVE_STEP = 0.05;
|
||||
@@ -3757,7 +3757,7 @@ function defineVideoController() {
|
||||
// Only hide if the video is not paused
|
||||
// (Many players keep controls visible while paused)
|
||||
// However, the user said "Reveal on every mouse and keyboard input"
|
||||
// and "auto-hidden after timespan".
|
||||
// and "auto-hidden after timespan".
|
||||
// We'll follow the timer strictly.
|
||||
wrapper.classList.add("vsc-idle-hidden");
|
||||
log("Generic hide: controller hidden due to inactivity", 5);
|
||||
@@ -4314,7 +4314,11 @@ function clearPendingInitialization(doc) {
|
||||
|
||||
function tryInitializeDocument(doc, forceReinit) {
|
||||
if (!doc) return false;
|
||||
if ((!forceReinit && vscInitializedDocuments.has(doc)) || !doc.body) {
|
||||
if (
|
||||
!tc.runtimeSettingsHydrated ||
|
||||
(!forceReinit && vscInitializedDocuments.has(doc)) ||
|
||||
!doc.body
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Speeder",
|
||||
"short_name": "Speeder",
|
||||
"version": "6.0.3",
|
||||
"version": "6.0.5",
|
||||
"manifest_version": 2,
|
||||
"description": "Speed up, slow down, advance and rewind HTML5 audio/video with shortcuts (New and improved version of \"Video Speed Controller\")",
|
||||
"homepage_url": "https://github.com/SoPat712/speeder",
|
||||
|
||||
@@ -322,7 +322,7 @@ label em {
|
||||
|
||||
.shortcut-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 120px 120px;
|
||||
grid-template-columns: minmax(0, 1fr) 120px 120px 38px;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
padding: 10px 0;
|
||||
@@ -334,10 +334,6 @@ label em {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.shortcut-row.customs {
|
||||
grid-template-columns: minmax(0, 1fr) 120px 120px 38px;
|
||||
}
|
||||
|
||||
.shortcut-label {
|
||||
color: var(--text);
|
||||
font-weight: 500;
|
||||
@@ -1061,6 +1057,20 @@ button.lucide-result-tile.lucide-picked {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
#status:not(:empty) {
|
||||
position: fixed;
|
||||
right: 20px;
|
||||
bottom: 20px;
|
||||
z-index: 1000;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: 999px;
|
||||
background: var(--panel);
|
||||
box-shadow: 0 8px 24px rgba(17, 24, 39, 0.16);
|
||||
}
|
||||
|
||||
#status:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@
|
||||
</div>
|
||||
<div class="site-rule-option site-rule-option-field">
|
||||
<label
|
||||
>Preferred speed (0.01–100):<br /><em
|
||||
>Preferred speed (0.1–16):<br /><em
|
||||
>Overrides the Preferred speed action for matching
|
||||
URLs. It does not force every video to start at this
|
||||
speed.</em
|
||||
|
||||
@@ -165,6 +165,7 @@ function createDefaultBinding(action, code, value) {
|
||||
var tcDefaults = vscGetSettingsDefaults();
|
||||
var optionsSyncSettingsLoaded = false;
|
||||
var autoSaveTimer = null;
|
||||
var saveStatusTimer = null;
|
||||
|
||||
function scheduleAutoSave() {
|
||||
if (!optionsSyncSettingsLoaded) return;
|
||||
@@ -179,7 +180,7 @@ function scheduleAutoSave() {
|
||||
return;
|
||||
}
|
||||
autoSaveTimer = null;
|
||||
save_options();
|
||||
save_options(true);
|
||||
}, 300);
|
||||
autoSaveTimer = scheduledTimer;
|
||||
}
|
||||
@@ -807,8 +808,9 @@ function validate() {
|
||||
return valid;
|
||||
}
|
||||
|
||||
function save_options() {
|
||||
function save_options(isAutoSave) {
|
||||
clearTimeout(autoSaveTimer);
|
||||
clearTimeout(saveStatusTimer);
|
||||
autoSaveTimer = null;
|
||||
var status = document.getElementById("status");
|
||||
if (!optionsSyncSettingsLoaded) {
|
||||
@@ -1121,8 +1123,8 @@ function save_options() {
|
||||
status.textContent = "Error: Unable to save options - " + error.message;
|
||||
return;
|
||||
}
|
||||
status.textContent = "Options saved";
|
||||
setTimeout(function () {
|
||||
status.textContent = isAutoSave === true ? "Auto-saved" : "Options saved";
|
||||
saveStatusTimer = setTimeout(function () {
|
||||
status.textContent = "";
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
root.SpeederShared = root.SpeederShared || {};
|
||||
root.SpeederShared.keyBindings = exports;
|
||||
})(typeof globalThis !== "undefined" ? globalThis : this, function() {
|
||||
var MIN_SPEED = 0.01;
|
||||
var MAX_SPEED = 100;
|
||||
var MIN_SPEED = 0.1;
|
||||
var MAX_SPEED = 16;
|
||||
|
||||
function normalizeBindingKey(key) {
|
||||
if (typeof key !== "string" || key.length === 0) return null;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
var LEGACY_SITE_RULES_DIFF_FORMAT = "defaults-diff-v1";
|
||||
var SITE_RULES_DIFF_FORMAT = "defaults-diff-v2";
|
||||
var REMOVED_DEFAULT_RULE_KEYS_META = "removedDefaultRuleKeys";
|
||||
var MIN_SPEED = 0.01;
|
||||
var MAX_SPEED = 100;
|
||||
var MIN_SPEED = 0.1;
|
||||
var MAX_SPEED = 16;
|
||||
var DEFAULT_BUTTONS = ["rewind", "slower", "faster", "advance", "display"];
|
||||
var LEGACY_SYNC_KEYS = [
|
||||
"resetSpeed",
|
||||
|
||||
@@ -394,6 +394,44 @@ describe("inject.js media/controller lifecycle regressions", () => {
|
||||
expect(video.currentTime).toBe(63);
|
||||
});
|
||||
|
||||
it("finishes a forced SPA initialization after settings hydration", async () => {
|
||||
vi.useFakeTimers();
|
||||
bootInject({
|
||||
url: "https://www.youtube.com/",
|
||||
syncGetDelayMs: 1000
|
||||
});
|
||||
|
||||
const mount = document.createElement("div");
|
||||
const video = document.createElement("video");
|
||||
const rect = makeRect(0, 0, 1280, 720);
|
||||
mount.id = "movie_player";
|
||||
video.src = "blob:https://www.youtube.com/main-player";
|
||||
setRect(mount, rect);
|
||||
setBoxMetrics(mount, rect.width, rect.height);
|
||||
setRect(video, rect);
|
||||
mount.appendChild(video);
|
||||
document.body.appendChild(mount);
|
||||
|
||||
document.dispatchEvent(new Event("speeder-location-changed"));
|
||||
await vi.advanceTimersByTimeAsync(300);
|
||||
expect(window.tc.runtimeSettingsHydrated).toBe(false);
|
||||
expect(video.vsc).toBeUndefined();
|
||||
|
||||
await vi.advanceTimersByTimeAsync(700);
|
||||
await settleLifecycle();
|
||||
|
||||
expect(window.tc.runtimeSettingsHydrated).toBe(true);
|
||||
expect(video.vsc).toBeTruthy();
|
||||
video.dispatchEvent(
|
||||
new KeyboardEvent("keydown", {
|
||||
bubbles: true,
|
||||
code: "KeyD",
|
||||
key: "d"
|
||||
})
|
||||
);
|
||||
expect(video.playbackRate).toBe(1.1);
|
||||
});
|
||||
|
||||
it("skips ambient loops by default and includes them when explicitly enabled", async () => {
|
||||
bootInject();
|
||||
await settleLifecycle();
|
||||
|
||||
@@ -81,6 +81,7 @@ describe("options.js", () => {
|
||||
await vi.advanceTimersByTimeAsync(300);
|
||||
|
||||
expect(chrome.storage.sync._dump().rememberSpeed).toBe(true);
|
||||
expect(document.getElementById("status").textContent).toBe("Auto-saved");
|
||||
});
|
||||
|
||||
it("does not partially save options when a required site shortcut is invalid", async () => {
|
||||
|
||||
@@ -257,7 +257,7 @@ describe("canonical settings storage", () => {
|
||||
expect(rule.forceLastSavedSpeed).toBe(true);
|
||||
expect(rule.controllerOpacity).toBe(1);
|
||||
expect(rule.subtitleNudgeInterval).toBe(250);
|
||||
expect(rule.preferredSpeed).toBe(100);
|
||||
expect(rule.preferredSpeed).toBe(16);
|
||||
});
|
||||
|
||||
it("falls back for null and blank numeric settings instead of coercing zero", () => {
|
||||
|
||||
@@ -158,10 +158,13 @@ describe("shared helpers", () => {
|
||||
"NumpadAdd"
|
||||
);
|
||||
expect(keyBindingUtils.getLegacyKeyCode({ key: 65 })).toBe(65);
|
||||
expect(keyBindingUtils.getActionValueError("fast", 0.01)).toBeNull();
|
||||
expect(keyBindingUtils.getActionValueError("fast", 100)).toBeNull();
|
||||
expect(keyBindingUtils.getActionValueError("fast", 0.009)).toContain(
|
||||
"between 0.01 and 100"
|
||||
expect(keyBindingUtils.getActionValueError("fast", 0.1)).toBeNull();
|
||||
expect(keyBindingUtils.getActionValueError("fast", 16)).toBeNull();
|
||||
expect(keyBindingUtils.getActionValueError("fast", 0.099)).toContain(
|
||||
"between 0.1 and 16"
|
||||
);
|
||||
expect(keyBindingUtils.getActionValueError("fast", 16.001)).toContain(
|
||||
"between 0.1 and 16"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user