mirror of
https://github.com/SoPat712/Speeder.git
synced 2026-10-08 11:05:02 -04:00
v5.0.1-beta.1
This commit is contained in:
2 files changed
+41
-24
No files matched your search
@@ -627,7 +627,26 @@ function sanitizeSpeed(speed, fallback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getVideoSourceKey(video) {
|
function getVideoSourceKey(video) {
|
||||||
return (video && (video.currentSrc || video.src)) || "unknown_src";
|
if (!video) return "unknown_src";
|
||||||
|
|
||||||
|
var docLocation =
|
||||||
|
video.ownerDocument &&
|
||||||
|
video.ownerDocument.location &&
|
||||||
|
video.ownerDocument.location.href
|
||||||
|
? video.ownerDocument.location
|
||||||
|
: location;
|
||||||
|
|
||||||
|
var hostname = (docLocation && docLocation.hostname) || "";
|
||||||
|
if (
|
||||||
|
hostname.includes("youtube.com") ||
|
||||||
|
hostname.includes("youtube-nocookie.com")
|
||||||
|
) {
|
||||||
|
// YouTube frequently reuses the same <video> element and may expose
|
||||||
|
// transient blob/currentSrc values. URL keying makes navigation distinct.
|
||||||
|
return "yt:" + docLocation.pathname + docLocation.search;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (video.currentSrc || video.src) || "unknown_src";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getControllerTargetSpeed(video) {
|
function getControllerTargetSpeed(video) {
|
||||||
@@ -842,6 +861,14 @@ function resolveTargetSpeed(video) {
|
|||||||
return getDesiredSpeed(video);
|
return getDesiredSpeed(video);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearControllerTargetSpeedsOnNavigation() {
|
||||||
|
tc.mediaElements.forEach(function (video) {
|
||||||
|
if (!video || !video.vsc) return;
|
||||||
|
video.vsc.targetSpeed = null;
|
||||||
|
video.vsc.targetSpeedSourceKey = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function extendSpeedRestoreWindow(video, duration) {
|
function extendSpeedRestoreWindow(video, duration) {
|
||||||
if (!video || !video.vsc) return;
|
if (!video || !video.vsc) return;
|
||||||
|
|
||||||
@@ -2329,6 +2356,7 @@ function attachNavigationListeners() {
|
|||||||
if (window.vscNavigationListenersAttached) return;
|
if (window.vscNavigationListenersAttached) return;
|
||||||
|
|
||||||
var scheduleRescan = function () {
|
var scheduleRescan = function () {
|
||||||
|
clearControllerTargetSpeedsOnNavigation();
|
||||||
clearTimeout(window.vscNavigationRescanTimer);
|
clearTimeout(window.vscNavigationRescanTimer);
|
||||||
window.vscNavigationRescanTimer = setTimeout(function () {
|
window.vscNavigationRescanTimer = setTimeout(function () {
|
||||||
initializeWhenReady(document, true);
|
initializeWhenReady(document, true);
|
||||||
@@ -2347,6 +2375,9 @@ function attachNavigationListeners() {
|
|||||||
|
|
||||||
window.addEventListener("popstate", scheduleRescan);
|
window.addEventListener("popstate", scheduleRescan);
|
||||||
window.addEventListener("hashchange", scheduleRescan);
|
window.addEventListener("hashchange", scheduleRescan);
|
||||||
|
// YouTube SPA navigation often emits these before/after URL/view swaps.
|
||||||
|
window.addEventListener("yt-navigate-start", scheduleRescan);
|
||||||
|
window.addEventListener("yt-navigate-finish", scheduleRescan);
|
||||||
window.vscNavigationListenersAttached = true;
|
window.vscNavigationListenersAttached = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-23
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Speeder",
|
"name": "Speeder",
|
||||||
"short_name": "Speeder",
|
"short_name": "Speeder",
|
||||||
"version": "5.0.0",
|
"version": "5.0.1",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"description": "Speed up, slow down, advance and rewind HTML5 audio/video with shortcuts (New and improved version of \"Video Speed Controller\")",
|
"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",
|
"homepage_url": "https://github.com/SoPat712/speeder",
|
||||||
@@ -9,9 +9,7 @@
|
|||||||
"gecko": {
|
"gecko": {
|
||||||
"id": "{ed860648-f54f-4dc9-9a0d-501aec4313f5}",
|
"id": "{ed860648-f54f-4dc9-9a0d-501aec4313f5}",
|
||||||
"data_collection_permissions": {
|
"data_collection_permissions": {
|
||||||
"required": [
|
"required": ["none"]
|
||||||
"none"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -23,9 +21,7 @@
|
|||||||
"background": {
|
"background": {
|
||||||
"scripts": ["background.js"]
|
"scripts": ["background.js"]
|
||||||
},
|
},
|
||||||
"permissions": [
|
"permissions": ["storage"],
|
||||||
"storage"
|
|
||||||
],
|
|
||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "options.html",
|
"page": "options.html",
|
||||||
"open_in_tab": false
|
"open_in_tab": false
|
||||||
@@ -41,27 +37,17 @@
|
|||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"all_frames": true,
|
"all_frames": true,
|
||||||
"matches": [
|
"matches": ["http://*/*", "https://*/*", "file:///*"],
|
||||||
"http://*/*",
|
|
||||||
"https://*/*",
|
|
||||||
"file:///*"
|
|
||||||
],
|
|
||||||
"match_about_blank": true,
|
"match_about_blank": true,
|
||||||
"exclude_matches": [
|
"exclude_matches": [
|
||||||
"https://plus.google.com/hangouts/*",
|
"https://plus.google.com/hangouts/*",
|
||||||
"https://hangouts.google.com/*",
|
"https://hangouts.google.com/*",
|
||||||
"https://meet.google.com/*"
|
"https://meet.google.com/*"
|
||||||
],
|
],
|
||||||
"css": [
|
"css": ["inject.css"],
|
||||||
"inject.css"
|
"js": ["inject.js"]
|
||||||
],
|
|
||||||
"js": [
|
|
||||||
"inject.js"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": ["inject.css", "shadow.css"]
|
||||||
"inject.css",
|
}
|
||||||
"shadow.css"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user