Open-Source Alternative Redirector

Redirects you from proprietary web-services to ethical alternatives.

当前为 2022-03-12 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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)
}