mirror of
https://github.com/SoPat712/videospeed.git
synced 2026-04-23 05:12:37 -04:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
3f5983685f
|
|||
|
41d89e0993
|
|||
|
a424dea5ca
|
|||
|
ab7ae99807
|
|||
|
5d47c511be
|
|||
| 7713ba5bad | |||
|
ce0b28de4f
|
Vendored
-3
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"kiroAgent.configureMCP": "Disabled"
|
||||
}
|
||||
@@ -33,7 +33,7 @@ last point to listen to it a few more times.
|
||||
|
||||

|
||||
|
||||
#### *Install [Chrome](https://chrome.google.com/webstore/detail/video-speed-controller/nffaoalbilbmmfgbnbgppjihopabppdk) or [Firefox](https://addons.mozilla.org/en-us/firefox/addon/videospeed/) Extension*
|
||||
#### *Install [Chrome](https://chrome.google.com/webstore/detail/video-speed-controller/nffaoalbilbmmfgbnbgppjihopabppdk) or [Firefox](https://addons.mozilla.org/en-us/firefox/addon/speeder/) Extension*
|
||||
|
||||
\*\* Once the extension is installed simply navigate to any page that offers
|
||||
HTML5 video ([example](https://www.youtube.com/watch?v=E9FxNzv1Tr8)), and you'll
|
||||
@@ -56,7 +56,7 @@ shortcuts with different values, which will allow you to quickly toggle between
|
||||
your most commonly used speeds. To add a new shortcut, open extension settings
|
||||
and click "Add New".
|
||||
|
||||

|
||||
<img width="1760" height="1330" alt="image" src="https://github.com/user-attachments/assets/32e814dd-93ea-4943-8ec9-3eca735447ac" />
|
||||
|
||||
Some sites may assign other functionality to one of the assigned shortcut keys —
|
||||
these collisions are inevitable, unfortunately. As a workaround, the extension
|
||||
|
||||
@@ -130,11 +130,14 @@ var controllerButtonDefs = {
|
||||
display: { label: "", className: "hideButton" },
|
||||
reset: { label: "\u21BB", className: "" },
|
||||
fast: { label: "", className: "" },
|
||||
settings: { label: "", className: "" },
|
||||
nudge: { label: "", className: "" },
|
||||
pause: { label: "", className: "" },
|
||||
muted: { label: "", className: "" },
|
||||
louder: { label: "", className: "" },
|
||||
softer: { label: "", className: "" },
|
||||
mark: { label: "", className: "" },
|
||||
jump: { label: "", className: "" }
|
||||
jump: { label: "", className: "" },
|
||||
settings: { label: "", className: "" }
|
||||
};
|
||||
|
||||
function createDefaultBinding(action, code, value) {
|
||||
@@ -2586,6 +2589,8 @@ function runAction(action, value, e) {
|
||||
"advance",
|
||||
"faster",
|
||||
"slower",
|
||||
"louder",
|
||||
"softer",
|
||||
"reset",
|
||||
"fast",
|
||||
"move",
|
||||
@@ -2708,6 +2713,12 @@ function runAction(action, value, e) {
|
||||
case "muted":
|
||||
muted(v);
|
||||
break;
|
||||
case "louder":
|
||||
volumeUp(v, Number.isFinite(numValue) ? numValue : 0.1);
|
||||
break;
|
||||
case "softer":
|
||||
volumeDown(v, Number.isFinite(numValue) ? numValue : 0.1);
|
||||
break;
|
||||
case "mark":
|
||||
setMark(v);
|
||||
break;
|
||||
@@ -2772,7 +2783,49 @@ function resetSpeed(v, target, isFastKey = false) {
|
||||
}
|
||||
|
||||
function muted(v) {
|
||||
v.muted = !v.muted;
|
||||
var nextMuted = !v.muted;
|
||||
v.muted = nextMuted;
|
||||
if (!isOnYouTube()) return;
|
||||
var ytApi = getYouTubePlayerApi(v);
|
||||
if (!ytApi) return;
|
||||
if (nextMuted && typeof ytApi.mute === "function") ytApi.mute();
|
||||
if (!nextMuted && typeof ytApi.unMute === "function") ytApi.unMute();
|
||||
}
|
||||
|
||||
function getYouTubePlayerApi(video) {
|
||||
if (!isOnYouTube()) return null;
|
||||
var playerEl =
|
||||
(video && video.closest ? video.closest(".html5-video-player") : null) ||
|
||||
document.getElementById("movie_player") ||
|
||||
document.querySelector(".html5-video-player");
|
||||
if (!playerEl) return null;
|
||||
return playerEl.wrappedJSObject || playerEl;
|
||||
}
|
||||
|
||||
function syncYouTubePlayerVolume(video, volume) {
|
||||
var ytApi = getYouTubePlayerApi(video);
|
||||
if (!ytApi || typeof ytApi.setVolume !== "function") return;
|
||||
ytApi.setVolume(Math.round(volume * 100));
|
||||
if (volume > 0 && typeof ytApi.unMute === "function") {
|
||||
ytApi.unMute();
|
||||
}
|
||||
}
|
||||
|
||||
function setVideoVolume(video, targetVolume) {
|
||||
var nextVolume = Math.max(0, Math.min(1, Number(targetVolume.toFixed(2))));
|
||||
video.volume = nextVolume;
|
||||
if (nextVolume > 0 && video.muted) {
|
||||
video.muted = false;
|
||||
}
|
||||
syncYouTubePlayerVolume(video, nextVolume);
|
||||
}
|
||||
|
||||
function volumeUp(v, value) {
|
||||
setVideoVolume(v, v.volume + value);
|
||||
}
|
||||
|
||||
function volumeDown(v, value) {
|
||||
setVideoVolume(v, v.volume - value);
|
||||
}
|
||||
|
||||
function setMark(v) {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Speeder",
|
||||
"short_name": "Speeder",
|
||||
"version": "5.1.8.0",
|
||||
"version": "5.2.0",
|
||||
"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",
|
||||
|
||||
+97
-25
@@ -74,11 +74,13 @@ var controllerButtonDefs = {
|
||||
reset: { icon: "\u21BB", name: "Reset speed" },
|
||||
fast: { icon: "\u2605", name: "Preferred speed" },
|
||||
nudge: { icon: "\u2713", name: "Subtitle nudge" },
|
||||
settings: { icon: "\u2699", name: "Settings" },
|
||||
pause: { icon: "\u23EF", name: "Pause / Play" },
|
||||
pause: { icon: "\u23EF", name: "Play / Pause" },
|
||||
muted: { icon: "M", name: "Mute / Unmute" },
|
||||
louder: { icon: "+", name: "Increase volume" },
|
||||
softer: { icon: "\u2212", name: "Decrease volume" },
|
||||
mark: { icon: "\u2691", name: "Set marker" },
|
||||
jump: { icon: "\u21E5", name: "Jump to marker" }
|
||||
jump: { icon: "\u21E5", name: "Jump to marker" },
|
||||
settings: { icon: "\u2699", name: "Settings" },
|
||||
};
|
||||
var popupExcludedButtonIds = new Set(["settings"]);
|
||||
|
||||
@@ -221,14 +223,17 @@ const actionLabels = {
|
||||
advance: "Advance",
|
||||
reset: "Reset speed",
|
||||
fast: "Preferred speed",
|
||||
muted: "Mute",
|
||||
pause: "Pause",
|
||||
toggleSubtitleNudge: "Toggle subtitle nudge",
|
||||
pause: "Play / Pause",
|
||||
muted: "Mute / Unmute",
|
||||
louder: "Increase volume",
|
||||
softer: "Decrease volume",
|
||||
mark: "Set marker",
|
||||
jump: "Jump to marker",
|
||||
toggleSubtitleNudge: "Toggle subtitle nudge"
|
||||
jump: "Jump to marker"
|
||||
};
|
||||
|
||||
const speedBindingActions = ["slower", "faster", "fast"];
|
||||
const speedBindingActions = ["slower", "faster", "fast", "softer", "louder"];
|
||||
const requiredShortcutActions = new Set(["display", "slower", "faster"]);
|
||||
|
||||
function formatSpeedBindingDisplay(action, value) {
|
||||
if (!speedBindingActions.includes(action)) {
|
||||
@@ -241,6 +246,30 @@ function formatSpeedBindingDisplay(action, value) {
|
||||
return n.toFixed(2);
|
||||
}
|
||||
|
||||
function getDefaultShortcutValue(action) {
|
||||
if (action === "louder" || action === "softer") {
|
||||
return 0.1;
|
||||
}
|
||||
var defaultBinding = tcDefaults.keyBindings.find(function (binding) {
|
||||
return binding.action === action;
|
||||
});
|
||||
if (defaultBinding && Number.isFinite(Number(defaultBinding.value))) {
|
||||
return Number(defaultBinding.value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function resolveShortcutValue(action, value) {
|
||||
if (value === undefined || value === null) {
|
||||
return getDefaultShortcutValue(action);
|
||||
}
|
||||
var numericValue = Number(value);
|
||||
if (Number.isFinite(numericValue)) {
|
||||
return numericValue;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const customActionsNoValues = [
|
||||
"reset",
|
||||
"display",
|
||||
@@ -580,7 +609,10 @@ function add_shortcut(action, value) {
|
||||
valueInput.value = "N/A";
|
||||
valueInput.disabled = true;
|
||||
} else {
|
||||
valueInput.value = formatSpeedBindingDisplay(action, value || 0);
|
||||
valueInput.value = formatSpeedBindingDisplay(
|
||||
action,
|
||||
resolveShortcutValue(action, value)
|
||||
);
|
||||
}
|
||||
|
||||
var removeButton = document.createElement("button");
|
||||
@@ -607,9 +639,25 @@ function createKeyBindings(item) {
|
||||
var binding = normalizeStoredBinding(input.vscBinding);
|
||||
|
||||
if (!binding) {
|
||||
if (requiredShortcutActions.has(action)) {
|
||||
return {
|
||||
valid: false,
|
||||
message:
|
||||
"Error: Shortcut for " +
|
||||
(actionLabels[action] || action) +
|
||||
" cannot be empty. Unable to save"
|
||||
};
|
||||
}
|
||||
binding = createDisabledBinding();
|
||||
}
|
||||
|
||||
if (binding.disabled === true && requiredShortcutActions.has(action)) {
|
||||
return {
|
||||
valid: false,
|
||||
message: "Error: Shortcut for " + action + " is invalid. Unable to save"
|
||||
message:
|
||||
"Error: Shortcut for " +
|
||||
(actionLabels[action] || action) +
|
||||
" cannot be empty. Unable to save"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -828,24 +876,43 @@ function save_options() {
|
||||
if (ruleEl.querySelector(".override-shortcuts").checked) {
|
||||
var shortcuts = [];
|
||||
ruleEl.querySelectorAll(".site-shortcuts-container .customs").forEach((shortcutRow) => {
|
||||
if (saveError) return;
|
||||
var action = shortcutRow.dataset.action;
|
||||
var keyInput = shortcutRow.querySelector(".customKey");
|
||||
var valueInput = shortcutRow.querySelector(".customValue");
|
||||
var forceCheckbox = shortcutRow.querySelector(".customForce");
|
||||
var binding = normalizeStoredBinding(keyInput.vscBinding);
|
||||
|
||||
if (binding) {
|
||||
shortcuts.push({
|
||||
action: action,
|
||||
code: binding.code,
|
||||
disabled: binding.disabled === true,
|
||||
value: customActionsNoValues.includes(action)
|
||||
? 0
|
||||
: Number(valueInput.value),
|
||||
force: forceCheckbox ? forceCheckbox.checked : false
|
||||
});
|
||||
if (!binding) {
|
||||
if (requiredShortcutActions.has(action)) {
|
||||
saveError =
|
||||
"Error: Site rule shortcut for " +
|
||||
(actionLabels[action] || action) +
|
||||
" cannot be empty. Unable to save";
|
||||
return;
|
||||
}
|
||||
binding = createDisabledBinding();
|
||||
}
|
||||
|
||||
if (binding.disabled === true && requiredShortcutActions.has(action)) {
|
||||
saveError =
|
||||
"Error: Site rule shortcut for " +
|
||||
(actionLabels[action] || action) +
|
||||
" cannot be empty. Unable to save";
|
||||
return;
|
||||
}
|
||||
|
||||
shortcuts.push({
|
||||
action: action,
|
||||
code: binding.code,
|
||||
disabled: binding.disabled === true,
|
||||
value: customActionsNoValues.includes(action)
|
||||
? 0
|
||||
: Number(valueInput.value),
|
||||
force: forceCheckbox ? forceCheckbox.checked : false
|
||||
});
|
||||
});
|
||||
if (saveError) return;
|
||||
if (shortcuts.length > 0) rule.shortcuts = shortcuts;
|
||||
}
|
||||
|
||||
@@ -891,11 +958,13 @@ function addSiteRuleShortcut(container, action, binding, value, force) {
|
||||
advance: "Advance",
|
||||
reset: "Reset speed",
|
||||
fast: "Preferred speed",
|
||||
muted: "Mute",
|
||||
pause: "Pause",
|
||||
toggleSubtitleNudge: "Toggle subtitle nudge",
|
||||
pause: "Play / Pause",
|
||||
muted: "Mute / Unmute",
|
||||
louder: "Increase volume",
|
||||
softer: "Decrease volume",
|
||||
mark: "Set marker",
|
||||
jump: "Jump to marker",
|
||||
toggleSubtitleNudge: "Toggle subtitle nudge"
|
||||
jump: "Jump to marker"
|
||||
};
|
||||
var actionLabelText = actionLabels[action] || action;
|
||||
if (action === "toggleSubtitleNudge") {
|
||||
@@ -923,7 +992,10 @@ function addSiteRuleShortcut(container, action, binding, value, force) {
|
||||
valueInput.value = "N/A";
|
||||
valueInput.disabled = true;
|
||||
} else {
|
||||
valueInput.value = formatSpeedBindingDisplay(action, value || 0);
|
||||
valueInput.value = formatSpeedBindingDisplay(
|
||||
action,
|
||||
resolveShortcutValue(action, value)
|
||||
);
|
||||
}
|
||||
|
||||
var forceLabel = document.createElement("label");
|
||||
|
||||
@@ -14,11 +14,13 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
reset: { label: "\u21BB", className: "" },
|
||||
fast: { label: "", className: "" },
|
||||
nudge: { label: "", className: "" },
|
||||
settings: { label: "", className: "" },
|
||||
pause: { label: "", className: "" },
|
||||
muted: { label: "", className: "" },
|
||||
louder: { label: "", className: "" },
|
||||
softer: { label: "", className: "" },
|
||||
mark: { label: "", className: "" },
|
||||
jump: { label: "", className: "" }
|
||||
jump: { label: "", className: "" },
|
||||
settings: { label: "", className: "" }
|
||||
};
|
||||
|
||||
var defaultButtons = ["rewind", "slower", "faster", "advance", "display"];
|
||||
|
||||
@@ -16,6 +16,10 @@ var vscUiIconPaths = {
|
||||
slower: '<line x1="5" y1="12" x2="19" y2="12"/>',
|
||||
faster:
|
||||
'<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',
|
||||
softer:
|
||||
'<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/><line x1="16" y1="12" x2="22" y2="12"/>',
|
||||
louder:
|
||||
'<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/><line x1="17" y1="9" x2="17" y2="15"/><line x1="14" y1="12" x2="20" y2="12"/>',
|
||||
moreHorizontal:
|
||||
'<circle cx="6" cy="12" r="1.5"/><circle cx="12" cy="12" r="1.5"/><circle cx="18" cy="12" r="1.5"/>',
|
||||
chevronUp: '<path d="m18 15-6-6-6 6"/>',
|
||||
|
||||
Reference in New Issue
Block a user