-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf0138e
commit 6a47dc6
Showing
10 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
if (window.location.href.includes("youtube.com/shorts")) { | ||
let currentUrl = window.location.href; | ||
// Get the video ID from the URL | ||
let splitLink = currentUrl.split('/'); | ||
let videoId; | ||
|
||
for (let i = 0; i < splitLink.length; i++) { | ||
if (splitLink[i] === "shorts") { | ||
videoId = splitLink[i + 1]; | ||
break; | ||
} | ||
} | ||
|
||
if (videoId === undefined) { | ||
console.log("Anti-short: No video ID found."); | ||
} else { | ||
// Redirect to youtube.com/watch?v=videoId | ||
let videoLink = "https://www.youtube.com/watch?v=" + videoId; | ||
history.replaceState({}, 'Title', videoLink); | ||
window.location.href = videoLink; | ||
console.log(`Anti-short: Redirected to ${videoLink}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const usingChrome = navigator.userAgent.indexOf('Chrome') > -1; | ||
|
||
if (usingChrome) { | ||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { | ||
if (changeInfo.url) { | ||
chrome.scripting.executeScript({ | ||
target: {tabId: tab.id}, | ||
files: ['antishort.js'] | ||
}); | ||
} | ||
}); | ||
} else { | ||
browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { | ||
if (changeInfo.url) { | ||
browser.tabs.executeScript({file: 'antishort.js'}); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "Anti-Short", | ||
"version": "1.0", | ||
"version_name": "1.0 pre-release", | ||
"description": "Stop using YouTube's short video player.", | ||
"author": "Steve Tautonico", | ||
"permissions": [ | ||
"tabs", | ||
"scripting" | ||
], | ||
"host_permissions": [ | ||
"*://*.youtube.com/*" | ||
], | ||
"homepage_url": "https://github.com/stautonico/anti-short", | ||
"icons": { | ||
"16": "images/icon16.png", | ||
"48": "images/icon48.png", | ||
"128": "images/icon128.png" | ||
}, | ||
"background": { | ||
"service_worker": "background.js" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Anti-Short", | ||
"version": "1.0", | ||
"description": "Stop using YouTube's short video player.", | ||
"author": "Steve Tautonico", | ||
"permissions": [ | ||
"tabs", | ||
"*://*.youtube.com/*" | ||
], | ||
"homepage_url": "https://github.com/stautonico/anti-short", | ||
"icons": { | ||
"16": "images/icon16.png", | ||
"48": "images/icon48.png", | ||
"128": "images/icon128.png" | ||
}, | ||
"background": { | ||
"scripts": [ | ||
"background.js" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
echo "Building package for Firefox..." | ||
|
||
mkdir -p build/firefox build/chrome | ||
|
||
zip -q -r build/firefox/antishort.xpi README.md manifest.json LICENSE images antishort.js background.js | ||
|
||
echo -e "$(tput setaf 2)Successfully packaged for Firefox$(tput setaf 7)\n" | ||
|
||
echo "Building package for Chrome..." | ||
|
||
cp chrome_manifest.json build/chrome/manifest.json | ||
cp -r images antishort.js background.js LICENSE README.md build/chrome | ||
|
||
cd build/chrome | ||
zip -q -r antishort.zip * | ||
rm -rf images antishort.js background.js LICENSE README.md manifest.json | ||
|
||
|
||
echo "$(tput setaf 2)Successfully packaged for Chrome" |