├── icons ├── iconColor.ico ├── iconColor.png └── iconColor.icns ├── manifest.json ├── README.md ├── redirect.js └── LICENSE /icons/iconColor.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeTubeApp/freetube-redirect/HEAD/icons/iconColor.ico -------------------------------------------------------------------------------- /icons/iconColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeTubeApp/freetube-redirect/HEAD/icons/iconColor.png -------------------------------------------------------------------------------- /icons/iconColor.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeTubeApp/freetube-redirect/HEAD/icons/iconColor.icns -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "manifest_version": 2, 4 | "name": "Freetube Redirect", 5 | "version": "0.1", 6 | 7 | "description": "Redirects YouTube links to FreeTube.", 8 | 9 | "icons": { 10 | "48": "icons/iconColor.png" 11 | }, 12 | 13 | "content_scripts": [{ 14 | "matches": [""], 15 | "js": ["redirect.js"] 16 | }] 17 | 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ** DEPRECATED ** 2 | 3 | This extension is no longer being worked on. Please consider using [Privacy Redirect](https://github.com/SimonBrazell/privacy-redirect) as an alternative. 4 | 5 | ## FreeTube-Redirect 6 | FreeTube-Redirect is a Chrome / Firefox extension that allows you to open up YouTube and HookTube links into [FreeTube](https://github.com/FreeTubeApp/FreeTube) 7 | 8 | FreeTube must be installed for the extension to work. More information can be found at the [FreeTube Wiki](https://github.com/FreeTubeApp/FreeTube/wiki/Browser-Extension) 9 | 10 | [Download for Firefox](https://addons.mozilla.org/en-US/firefox/addon/freetube-redirect/) 11 | 12 | [Instructrions for Google Chrome](https://github.com/FreeTubeApp/FreeTube/wiki/Browser-Extension) 13 | -------------------------------------------------------------------------------- /redirect.js: -------------------------------------------------------------------------------- 1 | function checkUrl(e) { 2 | // Grab elements 3 | let target = e.target; 4 | while ((target.tagName != "A" || !target.href) && target.parentNode) { 5 | target = target.parentNode; 6 | } 7 | if (target.tagName != "A") 8 | return; 9 | 10 | // Redirect the user to FreeTube 11 | if (target.href.includes('youtube.com') || target.href.includes('youtu.be') || target.href.includes('hooktube.com')){ 12 | window.stop(); 13 | e.stopImmediatePropagation(); 14 | e.preventDefault(); 15 | let url = 'freetube://' + target.href; 16 | console.log(url); 17 | window.location = url; 18 | return false; 19 | } 20 | } 21 | 22 | // Listen for click events 23 | window.addEventListener("click", (event) => { 24 | checkUrl(event); 25 | }); 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 FreeTubeApp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------