Privacy Redirector

Redirect social media platforms to their privacy respecting frontends

As of 2023-03-12. See the latest version.

  1. // ==UserScript==
  2. // @name Privacy Redirector
  3. // @name:bg Пренасочване на поверителността
  4. // @name:br Rediretor de privacidade
  5. // @name:cs Přesměrování soukromí
  6. // @name:de Datenschutz Umleiter
  7. // @name:da Omdirigeringsenhed for privatlivets fred
  8. // @name:et Privaatsuse ümbersuunaja
  9. // @name:es Redirección de privacidad
  10. // @name:fi Yksityisyydensuojan uudelleenohjaus
  11. // @name:fr Redirecteur de confidentialité
  12. // @name:el Επανακατευθυντής απορρήτου
  13. // @name:hu Adatvédelmi átirányító
  14. // @name:id Pengarah Privasi
  15. // @name:it Reindirizzatore di privacy
  16. // @name:ja プライバシーリダイレクト
  17. // @name:lt Privatumo nukreipiklis
  18. // @name:lv Konfidencialitātes pāradresētājs
  19. // @name:nl Privacy-omleiding
  20. // @name:pl Przekierownik prywatności
  21. // @name:pt Redirector de Privacidade
  22. // @name:ro Redirector de confidențialitate
  23. // @name:ru Перенаправление конфиденциальности
  24. // @name:sv Omdirigering av sekretess
  25. // @name:sl Preusmerjevalnik zasebnosti
  26. // @name:sk Presmerovanie súkromia
  27. // @name:tr Gizlilik Yönlendiricisi
  28. // @name:uk Редиректор конфіденційності
  29. // @name:zh 隐私重定向器
  30. // @name:zh-CN 隐私重定向器
  31. // @description Redirect social media platforms to their privacy respecting frontends
  32. // @description:bg Пренасочване на платформите за социални медии към заглавните им страници, съобразени с поверителността
  33. // @description:br Redirecionando as plataformas de mídia social para suas primeiras páginas de privacidade
  34. // @description:cs Přesměrování platforem sociálních médií na jejich titulní stránky šetrné k soukromí
  35. // @description:de Leitet von Social-Media-Plattformen auf deren jeweilige datenschutzfreundlicheren Frontends
  36. // @description:da Omdirigering af sociale medieplatforme til deres privatlivsvenlige forsider
  37. // @description:et Sotsiaalmeediaplatvormide ümbersuunamine nende privaatsussõbralikele esilehtedele
  38. // @description:es Redirigir las plataformas de medios sociales a sus portadas respetuosas con la privacidad
  39. // @description:fi Sosiaalisen median alustojen ohjaaminen yksityisyyden suojaa edistäville etusivuille.
  40. // @description:fr Rediriger les plateformes de médias sociaux vers leurs pages d'accueil respectueuses de la vie privée
  41. // @description:el Αναπροσανατολισμός των πλατφορμών κοινωνικής δικτύωσης στις μπροστινές σελίδες τους που είναι φιλικές προς το απόρρητο
  42. // @description:hu A közösségi médiaplatformok átirányítása az adatvédelem-barát kezdőlapokra
  43. // @description:id Mengarahkan platform media sosial ke halaman depan yang ramah privasi
  44. // @description:it Reindirizzare le piattaforme di social media verso le loro pagine frontali che rispettano la privacy
  45. // @description:ja ソーシャルメディアプラットフォームをプライバシーに配慮したフロントページにリダイレクトする
  46. // @description:lt Socialinės žiniasklaidos platformų nukreipimas į privatumą užtikrinančius pirmuosius puslapius
  47. // @description:lv Sociālo plašsaziņas līdzekļu platformu pāradresēšana uz to privātumam draudzīgajām pirmajām lapām.
  48. // @description:nl Sociale-mediaplatforms omleiden naar hun privacyvriendelijke voorpagina's
  49. // @description:pl Przekierowanie platform mediów społecznościowych na ich przyjazne dla prywatności strony tytułowe
  50. // @description:pt Redireccionar as plataformas de redes sociais para as suas primeiras páginas amigas da privacidade
  51. // @description:ro Redirecționarea platformelor de socializare către paginile lor de început care respectă viața privată
  52. // @description:ru Перенаправление платформ социальных сетей на их главные страницы, дружественные к конфиденциальности
  53. // @description:sv Omdirigera sociala medieplattformar till deras integritetsvänliga förstasidor.
  54. // @description:sl preusmeritev platform družabnih medijev na njihove naslovne strani, ki so prijazne do zasebnosti.
  55. // @description:sk Presmerovanie platforiem sociálnych médií na ich úvodné stránky, ktoré chránia súkromie
  56. // @description:tr Sosyal medya platformlarını, gizliliğe saygı duyan önyüzlerine yönlendirir
  57. // @description:uk Перенаправлення соціальних медіа-платформ на їхні головні сторінки, дружні до приватності
  58. // @description:zh 将社交媒体平台重定向到其隐私友好的首页
  59. // @description:zh-CN 将社交媒体平台重定向到其隐私友好的首页
  60. // @namespace https://github.com/dybdeskarphet/privacy-redirector
  61. // @author Ahmet Arda Kavakcı
  62. // @license GPLv3
  63. // @version 1.3.5
  64. // @supportURL https://github.com/dybdeskarphet/privacy-redirector
  65. // @run-at document-start
  66. // @match *://*.fandom.com/*
  67. // @match *://*.google.com/*
  68. // @match *://*.imdb.com/*
  69. // @match *://*.imgur.com/*
  70. // @match *://*.instagram.com/*
  71. // @match *://*.medium.com/*
  72. // @match *://*.quora.com/*
  73. // @match *://*.reddit.com/*
  74. // @match *://*.reuters.com/*
  75. // @match *://*.tiktok.com/*
  76. // @match *://*.twitter.com/*
  77. // @match *://*.wikipedia.org/*
  78. // @match *://*.youtube.com/*
  79. // @match *://*.youtube-nocookie.com/*
  80. // @match *://imgur.com/*
  81. // @match *://instagram.com/*
  82. // @match *://medium.com/*
  83. // @match *://news.ycombinator.com/*
  84. // @match *://reddit.com/*
  85. // @match *://translate.google.com/*
  86. // @match *://twitter.com/*
  87. // @match *://youtube.com/*
  88. // ==/UserScript==
  89.  
  90. /*
  91. ___ _ _ ___ _____ _____
  92. / _ \| \ | | / _ \| ___| ___|
  93. | | | | \| |_____| | | | |_ | |_
  94. | |_| | |\ |_____| |_| | _| | _|
  95. \___/|_| \_| \___/|_| |_|
  96.  
  97. CHANGE THE RELEVANT VALUE TO "false" TO
  98. DISABLE THE REDIRECTION/FARSIDE FOR THAT
  99. PARTICULAR PLATFORM */
  100.  
  101. // REDIRECTON / FARSIDE
  102. let fandom = [true, true];
  103. let google = [true, true];
  104. let gtranslate = [true, true];
  105. let hackernews = [true, true];
  106. let imdb = [true, true];
  107. let imgur = [true, true];
  108. let instagram = [false, true];
  109. let medium = [true, true];
  110. let quora = [true, true];
  111. let reddit = [true, true];
  112. let reuters = [true, true];
  113. let tiktok = [true, true];
  114. let twitter = [true, true];
  115. let wikipedia = [true, true];
  116. let youtube = [true, true];
  117.  
  118. // PREFERRED FRONTEND
  119. let youtubeFrontend = "piped"; // accepts "invidious", "piped"
  120. let redditFrontend = "libreddit"; // accepts "libreddit", "teddit"
  121. let googleFrontend = "searxng"; // accepts "searx", "searxng"
  122.  
  123. // // // // // // // // // // // // //
  124.  
  125. /*
  126. ___ _
  127. |_ _|_ __ ___| |_ __ _ _ __ ___ ___ ___
  128. | || '_ \/ __| __/ _` | '_ \ / __/ _ \/ __|
  129. | || | | \__ \ || (_| | | | | (_| __/\__ \
  130. |___|_| |_|___/\__\__,_|_| |_|\___\___||___/
  131.  
  132. LIST OF INSTANCES TO USE IF FARSIDE IS NOT ENABLED
  133. */
  134.  
  135. let bibliogramInstances = [
  136. "bibliogram.1d4.us",
  137. "ig.tokhmi.xyz"
  138. ];
  139.  
  140. let breezewikiInstances = [
  141. "breezewiki.com",
  142. "breezewiki.pussthecat.org",
  143. "breezewiki.esmailelbob.xyz",
  144. "bw.vern.cc",
  145. ];
  146.  
  147. let invidiousInstances = [
  148. "invidious.snopyta.org",
  149. "yewtu.be",
  150. "vid.puffyan.us",
  151. "invidious.namazso.eu",
  152. ];
  153.  
  154. let pipedInstances = [
  155. "piped.video",
  156. "piped.moomoo.me",
  157. "piped.syncpundit.io",
  158. "piped.mha.fi",
  159. ];
  160.  
  161. let libredditInstances = [
  162. "libreddit.spike.codes",
  163. "libreddit.org",
  164. "libreddit.kavin.rocks",
  165. "reddit.invak.id",
  166. ];
  167.  
  168. let libremdbInstances = [
  169. "libremdb.iket.me",
  170. "libremdb.pussthecat.org",
  171. "libremdbeu.herokuapp.com",
  172. "lmdb.tokhmi.xyz",
  173. ];
  174.  
  175. let lingvaInstances = [
  176. "lingva.ml",
  177. "translate.igna.wtf",
  178. "translate.plausibility.cloud",
  179. "translate.projectsegfau.lt",
  180. ];
  181.  
  182. let nitterInstances = [
  183. "nitter.net",
  184. "nitter.pussthecat.org",
  185. "nitter.fdn.fr",
  186. "nitter.1d4.us",
  187. ];
  188.  
  189. let proxitokInstances = [
  190. "proxitok.pabloferreiro.es",
  191. "proxitok.pussthecat.org",
  192. "tok.habedieeh.re",
  193. "proxitok.esmailelbob.xyz",
  194. ];
  195.  
  196. let quetreInstances = [
  197. "quetre.iket.me",
  198. "quora.vern.cc",
  199. "quetre.pussthecat.org",
  200. "quetre.tokhmi.xyz",
  201. ];
  202.  
  203. let rimgoInstances = [
  204. "i.bcow.xyz",
  205. "rimgo.pussthecat.org",
  206. "rimgo.totaldarkness.net",
  207. "rimgo.bus-hit.me",
  208. ];
  209.  
  210. let scribeInstances = [
  211. "scribe.rip",
  212. "scribe.nixnet.services",
  213. "scribe.citizen4.eu",
  214. "scribe.bus-hit.me",
  215. ];
  216.  
  217. let tedditInstances = [
  218. "teddit.pussthecat.org",
  219. "teddit.ggc-project.de",
  220. "teddit.domain.glass",
  221. "teddit.zaggy.nl",
  222. ];
  223.  
  224. let wikilessInstances = [
  225. "wikiless.org",
  226. "wikiless.sethforprivacy.com",
  227. "wiki.604kph.xyz",
  228. "wikiless.lunar.icu",
  229. ];
  230.  
  231. let searxInstances = [
  232. "search.bus-hit.me",
  233. "search.projectsegfau.lt",
  234. "northboot.xyz",
  235. "opnxng.com",
  236. ];
  237.  
  238. let searxngInstances = [
  239. "baresearch.org",
  240. "dynabyte.ca",
  241. "search.bus-hit.me",
  242. "search.leptons.xyz",
  243. ];
  244.  
  245. let farsideInstance = "farside.link";
  246.  
  247. // // // // // // // // // // // // //
  248.  
  249. let debug_mode = false;
  250.  
  251. if (debug_mode == true) {
  252. alert(
  253. "Hostname: " +
  254. window.location.hostname +
  255. "\nPath: " +
  256. window.location.pathname +
  257. "\nQuery: " +
  258. window.location.search +
  259. "\nHash: " +
  260. window.location.hash
  261. );
  262. }
  263.  
  264. function redirectInstagram() {
  265. if (instagram[0] == true) {
  266. window.stop();
  267.  
  268. alert(
  269. "Bibliogram is discontinued, you may want to disable the redirection."
  270. );
  271.  
  272. var selectedInstance = "";
  273.  
  274. if (instagram[1] == false) {
  275. selectedInstance =
  276. bibliogramInstances[
  277. Math.floor(Math.random() * bibliogramInstances.length)
  278. ];
  279. } else {
  280. selectedInstance = `${farsideInstance}/bibliogram`;
  281. }
  282.  
  283. if (window.location.pathname.startsWith("/accounts/login/")) {
  284. if (window.location.search.indexOf("/reel/") != -1) {
  285. // reels
  286. let newURL =
  287. window.location.protocol +
  288. "//" +
  289. selectedInstance +
  290. window.location.pathname.replace("/accounts/login/", "/") +
  291. window.location.search.replace("?next=/reel", "p") +
  292. window.location.hash;
  293.  
  294. window.location.replace(newURL);
  295. } else if (window.location.search.indexOf("/p/") == -1) {
  296. // user pages - it will crash if it's not the second last block
  297. let newURL =
  298. window.location.protocol +
  299. "//" +
  300. selectedInstance +
  301. window.location.pathname.replace("/accounts/login/", "/") +
  302. window.location.search.replace("?next=", "u") +
  303. window.location.hash;
  304.  
  305. window.location.replace(newURL);
  306. } else {
  307. // probably a post
  308. let newURL =
  309. window.location.protocol +
  310. "//" +
  311. selectedInstance +
  312. window.location.pathname.replace("/accounts/login/", "") +
  313. window.location.search.replace("?next=", "") +
  314. window.location.hash;
  315.  
  316. window.location.replace(newURL);
  317. }
  318. } else {
  319. if (window.location.pathname == "/") {
  320. // home page
  321. location.hostname = selectedInstance;
  322. } else if (window.location.pathname.startsWith("/reel/")) {
  323. // reel
  324. let newURL =
  325. window.location.protocol +
  326. "//" +
  327. selectedInstance +
  328. window.location.pathname.replace("/reel", "/p") +
  329. window.location.hash;
  330.  
  331. window.location.replace(newURL);
  332. } else if (!window.location.pathname.startsWith("/p/")) {
  333. // user page - it will crash if it's not the second last block
  334. let newURL =
  335. window.location.protocol +
  336. "//" +
  337. selectedInstance +
  338. "/u" +
  339. window.location.pathname +
  340. window.location.search +
  341. indow.location.hash;
  342.  
  343. window.location.replace(newURL);
  344. } else {
  345. // probably a post
  346. location.hostname = selectedInstance;
  347. }
  348. }
  349. }
  350. }
  351.  
  352. function redirectTwitter() {
  353. if (twitter[0] == true) {
  354. window.stop();
  355. var selectedInstance = "";
  356.  
  357. if (twitter[1] == false) {
  358. selectedInstance =
  359. nitterInstances[Math.floor(Math.random() * nitterInstances.length)];
  360. } else {
  361. selectedInstance = `${farsideInstance}/nitter`;
  362. }
  363.  
  364. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  365.  
  366. window.location.replace(newURL);
  367. }
  368. }
  369.  
  370. function redirectReddit() {
  371. if (reddit[0] == true) {
  372. window.stop();
  373.  
  374. var selectedTeddit = "";
  375. var selectedLibreddit = "";
  376.  
  377. if (reddit[1] == false) {
  378. selectedInstance = eval(redditFrontend + "Instances")[
  379. Math.floor(Math.random() * eval(redditFrontend + "Instances.length"))
  380. ];
  381. } else {
  382. selectedInstance = `${farsideInstance}/${redditFrontend}`;
  383. }
  384.  
  385. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  386.  
  387. window.location.replace(newURL);
  388. }
  389. }
  390.  
  391. function redirectYoutube() {
  392. if (youtube[0] == true) {
  393. window.stop();
  394.  
  395. var selectedInstance = "";
  396.  
  397. if (youtube[1] == false) {
  398. selectedInstance = eval(youtubeFrontend + "Instances")[
  399. Math.floor(Math.random() * eval(youtubeFrontend + "Instances.length"))
  400. ];
  401. } else {
  402. selectedInstance = `${farsideInstance}/${youtubeFrontend}`;
  403. }
  404.  
  405. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  406.  
  407. window.location.replace(newURL);
  408. }
  409. }
  410.  
  411. function redirectTiktok() {
  412. if (tiktok[0] == true) {
  413. window.stop();
  414.  
  415. var selectedInstance = "";
  416.  
  417. if (tiktok[1] == false) {
  418. selectedInstance =
  419. proxitokInstances[Math.floor(Math.random() * proxitokInstances.length)];
  420. } else {
  421. selectedInstance = `${farsideInstance}/proxitok`;
  422. }
  423.  
  424. if (window.location.pathname.startsWith("/discover")) {
  425. let newURL = `${
  426. window.location.protocol
  427. }//${selectedInstance}${window.location.pathname.replace(
  428. "discover",
  429. "tag"
  430. )}${window.location.hash}`;
  431.  
  432. window.location.replace(newURL);
  433. } else if (
  434. window.location.pathname.search(/[a-z][a-z]\-[A-Z][A-Z]/g) != -1
  435. ) {
  436. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  437.  
  438. window.location.replace(newURL);
  439. } else {
  440. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  441.  
  442. window.location.replace(newURL);
  443. }
  444. }
  445. }
  446.  
  447. function redirectImgur() {
  448. if (imgur[0] == true) {
  449. window.stop();
  450.  
  451. var selectedInstance = "";
  452.  
  453. if (imgur[1] == false) {
  454. selectedInstance =
  455. rimgoInstances[Math.floor(Math.random() * rimgoInstances.length)];
  456. } else {
  457. selectedInstance = `${farsideInstance}/rimgo`;
  458. }
  459.  
  460. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  461.  
  462. window.location.replace(newURL);
  463. }
  464. }
  465.  
  466. function redirectMedium() {
  467. if (medium[0] == true || window.location.pathname != "/") {
  468. window.stop();
  469.  
  470. var selectedInstance = "";
  471.  
  472. if (medium[1] == false) {
  473. selectedInstance =
  474. scribeInstances[Math.floor(Math.random() * scribeInstances.length)];
  475. } else {
  476. selectedInstance = `${farsideInstance}/scribe`;
  477. }
  478.  
  479. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  480.  
  481. window.location.replace(newURL);
  482. }
  483. }
  484.  
  485. function redirectYoutubeMusic() {
  486. if (youtube[0] == true) {
  487. window.stop();
  488.  
  489. if (window.location.pathname.startsWith("/playlist")) {
  490. let newURL = `${window.location.protocol}//beatbump.ml${
  491. window.location.pathname
  492. }${window.location.search.replace("?list=", "/VL")}${
  493. window.location.hash
  494. }`;
  495.  
  496. window.location.replace(newURL);
  497. } else if (window.location.pathname.startsWith("/channel")) {
  498. let newURL = `${
  499. window.location.protocol
  500. }//beatbump.ml${window.location.pathname.replace("/channel", "/artist")}${
  501. window.location.search
  502. }${window.location.hash}`;
  503.  
  504. window.location.replace(newURL);
  505. } else if (window.location.pathname.startsWith("/explore")) {
  506. let newURL = `${
  507. window.location.protocol
  508. }//beatbump.ml${window.location.pathname.replace(
  509. "/explore",
  510. "/trending"
  511. )}${window.location.search}${window.location.hash}`;
  512.  
  513. window.location.replace(newURL);
  514. } else if (window.location.pathname.startsWith("/moods_and_genres")) {
  515. let newURL = `${
  516. window.location.protocol
  517. }//beatbump.ml${window.location.pathname.replace(
  518. "/moods_and_genres",
  519. "/explore"
  520. )}${window.location.search}${window.location.hash}`;
  521.  
  522. window.location.replace(newURL);
  523. } else {
  524. location.hostname = "beatbump.ml";
  525. }
  526. }
  527. }
  528.  
  529. function redirectHackerNews() {
  530. if (hackernews[0] == true) {
  531. window.stop();
  532. let newURL = `${window.location.protocol}//hn.algolia.com`;
  533. window.location.replace(newURL);
  534. }
  535. }
  536.  
  537. function redirectGTranslate() {
  538. if (gtranslate[0] == true) {
  539. window.stop();
  540.  
  541. var selectedInstance = "";
  542.  
  543. if (gtranslate[1] == false) {
  544. selectedInstance =
  545. lingvaInstances[Math.floor(Math.random() * lingvaInstances.length)];
  546. } else {
  547. selectedInstance = `${farsideInstance}/lingva`;
  548. }
  549.  
  550. if (window.location.search != "") {
  551. let newURL =
  552. window.location.protocol +
  553. "//" +
  554. selectedInstance +
  555. window.location.pathname +
  556. window.location.search
  557. .replace(/\?hl=tr/, "")
  558. .replace(/.sl=/, "")
  559. .replace("&tl=", "/")
  560. .replace("&text=", "/")
  561. .replace("&op=translate", "") +
  562. window.location.hash;
  563.  
  564. window.location.replace(newURL);
  565. } else {
  566. let newURL = window.location.protocol + "//" + selectedInstance;
  567. window.location.replace(newURL);
  568. }
  569. }
  570. }
  571.  
  572. function redirectReuters() {
  573. if (reuters[0] == true) {
  574. window.stop();
  575. location.hostname = "neuters.de";
  576. }
  577. }
  578.  
  579. function redirectWikipedia() {
  580. if (wikipedia[0] == false) {
  581. window.stop();
  582.  
  583. let langCodeIndex = window.location.hostname.search(/^[a-z][a-z]\./);
  584. var selectedInstance = "";
  585.  
  586. if (wikipedia[1] == false) {
  587. selectedInstance =
  588. wikilessInstances[Math.floor(Math.random() * wikilessInstances.length)];
  589. } else {
  590. selectedInstance = `${farsideInstance}/wikiless`;
  591. }
  592.  
  593. if (langCodeIndex != -1) {
  594. let newURL =
  595. window.location.protocol +
  596. "//" +
  597. selectedInstance +
  598. window.location.pathname +
  599. "?lang=" +
  600. window.location.hostname[langCodeIndex] +
  601. window.location.hostname[langCodeIndex + 1] +
  602. window.location.hash;
  603. window.location.replace(newURL);
  604. } else {
  605. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}?lang=en${window.location.hash}`;
  606. window.location.replace(newURL);
  607. }
  608. }
  609. }
  610.  
  611. function redirectImdb() {
  612. if (imdb[0] == true) {
  613. if (window.location.pathname.startsWith("/title/")) {
  614. window.stop();
  615.  
  616. var selectedInstance = "";
  617.  
  618. if (imdb[1] == false) {
  619. selectedInstance =
  620. libremdbInstances[
  621. Math.floor(Math.random() * libremdbInstances.length)
  622. ];
  623. } else {
  624. selectedInstance = `${farsideInstance}/libremdb`;
  625. }
  626.  
  627. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  628.  
  629. window.location.replace(newURL);
  630. }
  631. }
  632. }
  633.  
  634. function redirectQuora() {
  635. if (quora[0] == true) {
  636. window.stop();
  637.  
  638. var selectedInstance = "";
  639.  
  640. if (quora[1] == false) {
  641. selectedInstance =
  642. quetreInstances[Math.floor(Math.random() * quetreInstances.length)];
  643. } else {
  644. selectedInstance = `${farsideInstance}/quetre`;
  645. }
  646.  
  647. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  648.  
  649. window.location.replace(newURL);
  650. }
  651. }
  652.  
  653. function redirectFandom() {
  654. if (fandom[0] == true) {
  655. let randomInstance =
  656. breezewikiInstances[
  657. Math.floor(Math.random() * breezewikiInstances.length)
  658. ];
  659. let fandomName = window.location.hostname.replace(/\..*/, "");
  660. let newURL = "";
  661.  
  662. window.stop();
  663.  
  664. if (fandomName !== "www") {
  665. newURL = `${window.location.protocol}//${randomInstance}/${fandomName}${window.location.pathname}${window.location.search}${window.location.hash}`;
  666. } else {
  667. newURL = `${window.location.protocol}//${randomInstance}`;
  668. }
  669.  
  670. window.location.replace(newURL);
  671. }
  672. }
  673.  
  674. function redirectGoogle() {
  675. if (google[0] == true) {
  676.  
  677. window.stop();
  678.  
  679. var selectedInstance = "";
  680.  
  681. if (google[1] == false) {
  682. selectedInstance = eval(googleFrontend + "Instances")[
  683. Math.floor(Math.random() * eval(googleFrontend + "Instances.length"))
  684. ];
  685. } else {
  686. selectedInstance = `${farsideInstance}/${googleFrontend}`;
  687. }
  688.  
  689. if (window.location.pathname.match("/")) {
  690. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  691. window.location.replace(newURL);
  692. } else {
  693. let newURL = `${window.location.protocol}//${selectedInstance}${
  694. window.location.pathname
  695. }${window.location.search.match(/\?q.+?(?=\&)/)}`;
  696. window.location.replace(newURL);
  697. }
  698. }
  699. }
  700.  
  701. let urlHostname = window.location.hostname;
  702.  
  703. switch (urlHostname) {
  704. case "www.instagram.com":
  705. redirectInstagram();
  706. break;
  707.  
  708. case "twitter.com":
  709. case "mobile.twitter.com":
  710. redirectTwitter();
  711. break;
  712.  
  713. case "www.reddit.com":
  714. case "old.reddit.com":
  715. redirectReddit();
  716. break;
  717.  
  718. case "www.youtube.com":
  719. case "m.youtube.com":
  720. case "www.youtube-nocookie.com":
  721. redirectYoutube();
  722. break;
  723.  
  724. case "www.tiktok.com":
  725. redirectTiktok();
  726. break;
  727.  
  728. case "music.youtube.com":
  729. redirectYoutubeMusic();
  730. break;
  731.  
  732. case "news.ycombinator.com":
  733. redirectHackerNews();
  734. break;
  735.  
  736. case "translate.google.com":
  737. redirectGTranslate();
  738. break;
  739.  
  740. case "www.reuters.com":
  741. redirectReuters();
  742. break;
  743.  
  744. case "www.imdb.com":
  745. redirectImdb();
  746. break;
  747.  
  748. case "www.quora.com":
  749. redirectQuora();
  750. break;
  751.  
  752. case "www.google.com":
  753. redirectGoogle();
  754. break;
  755.  
  756. default:
  757. if (urlHostname.includes("medium.com")) {
  758. redirectMedium();
  759. } else if (urlHostname.includes("imgur.com")) {
  760. redirectImgur();
  761. } else if (urlHostname.includes("wikipedia.org")) {
  762. redirectWikipedia();
  763. } else if (urlHostname.includes("fandom.com")) {
  764. redirectFandom();
  765. }
  766. break;
  767. }