Open-Source Alternative Redirector

Redirects you from proprietary web-services to ethical alternatives.

目前為 2022-03-12 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name Open-Source Alternative Redirector
// @namespace -
// @version 0.7
// @description Redirects you from proprietary web-services to ethical alternatives.
// @author NotYou
// @include *youtube.com/*
// @include *google.com/*
// @include *yahoo.com/*
// @include *bing.com/*
// @include *reddit.com/*
// @include *twitter.com/*
// @include *instagram.com/*
// @include *wikipedia.org/*
// @run-at document-start
// @license GPL-3.0-or-later
// @icon https://icons.iconarchive.com/icons/itweek/knob-toolbar/32/Knob-Shuffle-Off-icon.png
// @grant none
// ==/UserScript==

/*

﹀ Change Log ﹀

0.7 Version:
- Removed duckduckgo
- Better instagram redirect
- Added google translate

0.6 Version:
- Redirect from yahoo
- Redirect from bing
- Redirect from duckduckgo

0.5 Version:
- Support for other languages for wikiless/wikipedia
- Better Instances format

*/

var url = new URL(window.location.href)

// INSTANCES //
const
invidious = 'yewtu.be',
searx = 'search.mdosch.de',
libreddit = 'reddit.invak.id',
nitter = 'nitter.snopyta.org',
bibliogram = 'bibliogram.pussthecat.org',
wikiless = 'wikiless.org',
lingva = 'lingva.ml'

// YouTube | Invidious //
if(window.location.host.indexOf('youtube.com') != -1){
    window.location.replace('https://' + invidious + window.location.pathname + window.location.search)
}

if(window.location.host.indexOf('google.com') != -1){
    // Google Translate | Lingva Translate //
    if(window.location.host.indexOf('translate.google.com') != -1){
        if(window.location.search === '') {
            window.location.replace('https://' + lingva)
        } else {
            let lang1 = window.location.search.split('&')[0].split('=')[1];
            let lang2 = window.location.search.split('&')[1].split('=')[1];
            let text = window.location.search.split('&')[2].split('=')[1];
            window.location.replace('https://' + lingva + '/' + lang1 + '/' + lang2 + '/' + text)
        }
    // Google | SearX //
    } else {
        window.location.replace('https://' + searx + window.location.pathname + window.location.search)
    }
}

// Yahoo | SearX //
if(window.location.host.indexOf('yahoo.com') != -1){
    let search = window.location.search.replace('?p', '?q')
    window.location.replace('https://' + searx + window.location.pathname + search)
}

// Bing | SearX //
if(window.location.host.indexOf('bing.com') != -1){
    window.location.replace('https://' + searx + window.location.pathname + window.location.search)
}

// Reddit | Libreddit //
if(window.location.host.indexOf('reddit.com') != -1){
    window.location.replace('https://' + libreddit + window.location.pathname + window.location.search)
}

// Twitter | Nitter //
if(window.location.host.indexOf('twitter.com') != -1){
    window.location.replace('https://' + nitter + window.location.pathname + window.location.search)
}

// Instagram | Bibliogram //
if(window.location.host.indexOf('instagram.com') != -1){
    if(window.location.pathname === '/accounts/login/') {
        let path1 = window.location.search.split('?next=').at(1)
        let path = '/u' + path1
        window.location.replace('https://' + bibliogram + path)
    } else {
        window.location.replace('https://' + bibliogram + window.location.pathname + window.location.search)
    }
}

// Wikipedia | Wikiless //
if(window.location.host.indexOf('wikipedia.org') != -1){
    let sub = url.hostname.split('.')[0];
    window.location.replace('https://' + wikiless + window.location.pathname + '?lang=' + sub)
}