Compare commits

1 Commits
main ... v1.0

Author SHA1 Message Date
7e6fc2e6e4 feat: add timecode if there 2025-07-21 19:23:15 +02:00
4 changed files with 7 additions and 33 deletions

View File

@@ -7,7 +7,7 @@ This is a Firefox Addon that redirect youtube URL to the embed version to have a
* click on "Load Temporary Add-on…"
* select "manifest.json" file
## to have it in private navigation
## to have it in private navication
* go to "about:addons"
* select the extension

View File

@@ -1,6 +1,5 @@
browser.webRequest.onBeforeRequest.addListener(
function(details) {
//console.log(details);
const url = new URL(details.url);
if (url.hostname === "www.youtube.com" || url.hostname === "youtube.com") {
// Extract the video ID from the URL params
@@ -9,39 +8,14 @@ browser.webRequest.onBeforeRequest.addListener(
// Rewrite to the embedded URL format, picking timecode if available
const timecode = url.searchParams.get("t");
return {
redirectUrl: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0` + (timecode ? "&start=" + timecode : "")
redirectUrl: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0` + (timecode ? "&start=" + timecode : "");
};
}
} else if (url.hostname === "github.com") {
const GOTHUB = "gothub.lunar.icu";
if (details.originUrl === undefined) { // entered in the address bar
return
}
origin = new URL(details.originUrl).hostname;
if (origin === GOTHUB || origin === "github.com") { // click within gothub or github page
return
}
// click from everywhere else
path = url.pathname.split("/");
org = path[1];
if (org === "login") { // OAuth2 path
return
}
return {
redirectUrl: `https://${GOTHUB}${url.pathname}`
};
} else if (url.hostname === "www.reddit.com") {
url.hostname = "old.reddit.com"
return {
redirectUrl: url.toString()
};
}
},
{ urls: [
"*://www.youtube.com/*",
"*://youtube.com/*",
"*://github.com/*",
"*://www.reddit.com/*",
"*://youtube.com/*"
]},
["blocking"]
);
);

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "Desenshitifier",
"version": "1.2",
"description": "Rewrites YouTube URLs to embedded format.\nOpen Github links with Gothub\nredirect reddit, www to old",
"name": "YouTube force embed",
"version": "1.0",
"description": "Rewrites YouTube URLs to embedded format.",
"permissions": [
"webRequest",
"webRequestBlocking",