commit 5e61293877d73b2010604e45225574b4eea96f2f Author: Sam Blazes Date: Mon Jan 16 17:07:24 2023 -0500 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..416d0fe --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +NoShorts +======== + +This is a FireFox extension that redirects any YouTube shorts URLs to use the regular YouTube video player. \ No newline at end of file diff --git a/noshorts.zip b/noshorts.zip new file mode 100644 index 0000000..46e05be Binary files /dev/null and b/noshorts.zip differ diff --git a/noshorts/icons/noshorts-48.png b/noshorts/icons/noshorts-48.png new file mode 100644 index 0000000..11fcaf9 Binary files /dev/null and b/noshorts/icons/noshorts-48.png differ diff --git a/noshorts/icons/noshorts-96.png b/noshorts/icons/noshorts-96.png new file mode 100644 index 0000000..a019b4d Binary files /dev/null and b/noshorts/icons/noshorts-96.png differ diff --git a/noshorts/manifest.json b/noshorts/manifest.json new file mode 100644 index 0000000..e740e0b --- /dev/null +++ b/noshorts/manifest.json @@ -0,0 +1,23 @@ +{ + + "manifest_version": 2, + "name": "NoShorts", + "version": "1.0", + + "description": "Opens YouTube Shorts in the regular YouTube player.", + + "icons": { + "48": "icons/noshorts-48.png", + "96": "icons/noshorts-96.png" + }, + + "permissions": [ + "tabs" + ], + + "background": { + "scripts": ["noshorts.js"], + "persistent": false + } + +} diff --git a/noshorts/noshorts.js b/noshorts/noshorts.js new file mode 100644 index 0000000..b737cd0 --- /dev/null +++ b/noshorts/noshorts.js @@ -0,0 +1,11 @@ +browser.tabs.onUpdated.addListener( + (tabId, changeInfo, tabInfo) => { + if (changeInfo.url && changeInfo.url.includes("shorts/")) { + browser.tabs.update(tabId, { + loadReplace: true, + url: tabInfo.url.replace("shorts/", "watch?v=") + }); + } + }, + { urls: ['*://*.youtube.com/shorts/*']} +) \ No newline at end of file