commit 6cfc234138e42df12f0c8fad9b41d1525b419bf1 Author: Gabe Farrell Date: Fri Oct 14 21:04:32 2022 -0400 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..96c5648 --- /dev/null +++ b/README.md @@ -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. \ No newline at end of file diff --git a/eatmyytshorts.js b/eatmyytshorts.js new file mode 100644 index 0000000..44508c7 --- /dev/null +++ b/eatmyytshorts.js @@ -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) \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..313b1e8 --- /dev/null +++ b/manifest.json @@ -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"] + +}