2022-07-18 08:21:37 +01:00
// ==UserScript==
// @name lol just redirect to nitter
2022-07-18 08:25:48 +01:00
// @namespace https://git.froggi.es/tom/redirect-to-nitter-n-shit/
2022-07-19 02:42:20 +01:00
// @namespace https://greasyfork.org/en/scripts/448085-lol-just-redirect-to-nitter
2022-07-19 02:47:42 +01:00
// @version 0.1021
2022-07-19 02:42:20 +01:00
// @license GNU GPLv3
2022-07-18 08:21:37 +01:00
// @description see title. edit code for settings.
2022-07-18 08:25:48 +01:00
// @author Thomas F.
2022-07-18 08:21:37 +01:00
// @match https://twitter.com/*
// @icon https://git.froggi.es/tom/redirect-to-nitter-n-shit/raw/branch/main/icon.ico
// @grant none
2022-07-19 02:47:42 +01:00
// @updateURL https://git.froggi.es/tom/redirect-to-nitter-n-shit/raw/branch/main/lol%20just%20redirect%20to%20nitter.user.js
// @downloadURL https://greasyfork.org/scripts/448085-lol-just-redirect-to-nitter/code/lol%20just%20redirect%20to%20nitter.user.js
2022-07-18 08:21:37 +01:00
// ==/UserScript==
// Settings
2022-07-19 02:42:20 +01:00
let timelineRedirect = true ; // Redirect on main home page/timeline? true/false (script's still a wip so getting redirected to nitter by clicking on a tweet on the twitter timeline isn't programmed in yet. true by default until then.)
2022-07-18 08:21:37 +01:00
let nitterInstance = "https://nitter.ca/" ; // (PLEASE INCLUDE "https://" AT THE START OF THE DOMAIN AND "/" AT THE END) | What Nitter instance you'd like to be redirected to. Using ".ca" as default because it's the best instance I personally know, I also recommend "twiit.com", which selects an instance that's running well and isn't rate-limited.
2022-07-19 02:42:20 +01:00
2022-07-18 08:21:37 +01:00
//
2022-07-19 02:42:20 +01:00
// console.log("is this even loading");
2022-07-18 08:21:37 +01:00
let href = document . location . href ;
var ofm = href . split ( "/" ) ;
2022-07-19 02:42:20 +01:00
2022-07-18 08:21:37 +01:00
for ( var i = 0 ; i < 2 ; i ++ ) {
ofm . shift ( ) ;
}
2022-07-19 02:42:20 +01:00
// console.log(ofm);
2022-07-18 08:21:37 +01:00
var goTo = nitterInstance ;
2022-07-19 02:42:20 +01:00
2022-07-18 08:21:37 +01:00
if ( ofm [ 1 ] == "home" || ofm [ 1 ] == "" || ofm [ 1 ] == "i" ) {
console . log ( "j" ) ;
if ( timelineRedirect == false ) {
2022-07-19 02:42:20 +01:00
goTo = "false" ;
2022-07-18 08:21:37 +01:00
}
} else {
for ( var m = 1 ; m < ofm . length ; m ++ ) {
goTo += ofm [ m ] + "/" ;
}
}
2022-07-19 02:42:20 +01:00
2022-07-18 08:21:37 +01:00
if ( goTo == "false" ) {
2022-07-19 02:42:20 +01:00
// console.log("no");
2022-07-18 08:21:37 +01:00
} else {
2022-07-19 02:42:20 +01:00
// console.info("this was supposed to redirect to " + goTo);
2022-07-18 08:21:37 +01:00
document . location = goTo ;
}