initial commit

This commit is contained in:
Gabe Farrell 2022-10-14 21:04:32 -04:00
commit 6cfc234138
3 changed files with 50 additions and 0 deletions

6
README.md Normal file
View file

@ -0,0 +1,6 @@
### EatMyYTShorts
## The extension to never have to deal with youtube's awful shorts player on desktop youtube.
Hate it when your favorite youtubers upload a silly video and you want to scrub back to see the funny part again but cant because for some AWFUL reason youtube doesnt have a scrub feature for shorts? Trying to learn a guitar solo that a youtuber uploaded but you can't slow it down to practice? YEAH ME TOO IT ABSOLUTELY SUCKS!
No more! With this extension your browser will automatically switch from youtube shorts to normal youtube so you can use all the good features to watch the short.

26
eatmyytshorts.js Normal file
View file

@ -0,0 +1,26 @@
function initContentScript() {
let url = location.href
url = url.substring(8, url.length) //remove 'https://'
url = url.split('/')
if (url[1] == 'shorts' ) { // if the video is a short
console.log('EatMyYTShorts: Fixing video...')
vidID = url[2] //the unique video id
location.assign(`https://youtube.com/watch?v=${vidID}`)
}
}
function addLocationObserver(callback) {
// Options for the observer (which mutations to observe)
const config = { attributes: true, childList: false, subtree: false }
// Create an observer instance linked to the callback function
const observer = new MutationObserver(callback)
// Start observing the target node for configured mutations
observer.observe(document.body, config)
}
initContentScript()
addLocationObserver(initContentScript)

18
manifest.json Normal file
View file

@ -0,0 +1,18 @@
{
"manifest_version": 2,
"name": "EatMyYTShorts",
"version": "1.0",
"description": "Changes YouTube Shorts videos to normal videos.",
"content_scripts": [
{
"matches": ["*://*.youtube.com/*"],
"js": ["eatmyytshorts.js"]
}
],
"permissions": ["webNavigation", "tabs"]
}