Privacy Redirector

Redirect social media platforms to their privacy respecting frontends

目前為 2023-03-26 提交的版本,檢視 最新版本

  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.9
  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-nocookie.com/*
  79. // @match *://*.youtube.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 *://www.goodreads.com/*
  88. // @match *://youtube.com/*
  89. // ==/UserScript==
  90.  
  91. /*
  92. ___ _ _ ___ _____ _____
  93. / _ \| \ | | / _ \| ___| ___|
  94. | | | | \| |_____| | | | |_ | |_
  95. | |_| | |\ |_____| |_| | _| | _|
  96. \___/|_| \_| \___/|_| |_|
  97.  
  98. CHANGE THE RELEVANT VALUE TO "false" TO
  99. DISABLE THE REDIRECTION/FARSIDE FOR THAT
  100. PARTICULAR PLATFORM */
  101.  
  102. // REDIRECTON / FARSIDE
  103. let fandom = [true, true];
  104. let goodreads = [true, false];
  105. let google = [true, true];
  106. let gtranslate = [true, true];
  107. let hackernews = [true, true];
  108. let imdb = [true, true];
  109. let imgur = [true, true];
  110. let instagram = [false, true];
  111. let medium = [true, true];
  112. let quora = [true, true];
  113. let reddit = [true, true];
  114. let reuters = [true, true];
  115. let tiktok = [true, true];
  116. let twitter = [true, true];
  117. let wikipedia = [true, true];
  118. let youtube = [true, true];
  119.  
  120. // PREFERRED FRONTEND
  121. let youtubeFrontend = "piped"; // accepts "invidious", "piped"
  122. let youtubeMusicFrontend = "beatbump"; // accepts "beatbump", "invidious", "piped"
  123. let redditFrontend = "libreddit"; // accepts "libreddit", "teddit"
  124. let googleFrontend = "searxng"; // accepts "searx", "searxng"
  125.  
  126. // // // // // // // // // // // // //
  127.  
  128. /*
  129. ___ _
  130. |_ _|_ __ ___| |_ __ _ _ __ ___ ___ ___
  131. | || '_ \/ __| __/ _` | '_ \ / __/ _ \/ __|
  132. | || | | \__ \ || (_| | | | | (_| __/\__ \
  133. |___|_| |_|___/\__\__,_|_| |_|\___\___||___/
  134.  
  135. LIST OF INSTANCES TO USE IF FARSIDE IS NOT ENABLED
  136. */
  137.  
  138. let bibliogramInstances = [
  139. "bibliogram.1d4.us",
  140. "ig.tokhmi.xyz",
  141. ];
  142.  
  143. let biblioreadsInstances = [
  144. "biblioreads.ml",
  145. "biblioreads.ga",
  146. "biblioreads.netlify.app",
  147. "biblioreads.esmailelbob.xyz",
  148. ];
  149.  
  150. let breezewikiInstances = [
  151. "breezewiki.com",
  152. "breezewiki.pussthecat.org",
  153. "breezewiki.esmailelbob.xyz",
  154. "bw.vern.cc",
  155. ];
  156.  
  157. let invidiousInstances = [
  158. "invidious.snopyta.org",
  159. "yewtu.be",
  160. "vid.puffyan.us",
  161. "invidious.namazso.eu",
  162. ];
  163.  
  164. let pipedInstances = [
  165. "piped.video",
  166. "piped.moomoo.me",
  167. "piped.syncpundit.io",
  168. "piped.mha.fi",
  169. ];
  170.  
  171. let libredditInstances = [
  172. "libreddit.spike.codes",
  173. "libreddit.org",
  174. "libreddit.kavin.rocks",
  175. "reddit.invak.id",
  176. ];
  177.  
  178. let libremdbInstances = [
  179. "libremdb.iket.me",
  180. "libremdb.pussthecat.org",
  181. "libremdbeu.herokuapp.com",
  182. "lmdb.tokhmi.xyz",
  183. ];
  184.  
  185. let lingvaInstances = [
  186. "lingva.ml",
  187. "translate.igna.wtf",
  188. "translate.plausibility.cloud",
  189. "translate.projectsegfau.lt",
  190. ];
  191.  
  192. let nitterInstances = [
  193. "nitter.net",
  194. "nitter.pussthecat.org",
  195. "nitter.fdn.fr",
  196. "nitter.1d4.us",
  197. ];
  198.  
  199. let proxitokInstances = [
  200. "proxitok.pabloferreiro.es",
  201. "proxitok.pussthecat.org",
  202. "tok.habedieeh.re",
  203. "proxitok.esmailelbob.xyz",
  204. ];
  205.  
  206. let quetreInstances = [
  207. "quetre.iket.me",
  208. "quora.vern.cc",
  209. "quetre.pussthecat.org",
  210. "quetre.tokhmi.xyz",
  211. ];
  212.  
  213. let rimgoInstances = [
  214. "i.bcow.xyz",
  215. "rimgo.pussthecat.org",
  216. "rimgo.totaldarkness.net",
  217. "rimgo.bus-hit.me",
  218. ];
  219.  
  220. let scribeInstances = [
  221. "scribe.rip",
  222. "scribe.nixnet.services",
  223. "scribe.citizen4.eu",
  224. "scribe.bus-hit.me",
  225. ];
  226.  
  227. let tedditInstances = [
  228. "teddit.pussthecat.org",
  229. "teddit.ggc-project.de",
  230. "teddit.domain.glass",
  231. "teddit.zaggy.nl",
  232. ];
  233.  
  234. let wikilessInstances = [
  235. "wikiless.org",
  236. "wikiless.sethforprivacy.com",
  237. "wiki.604kph.xyz",
  238. "wikiless.lunar.icu",
  239. ];
  240.  
  241. let searxInstances = [
  242. "search.bus-hit.me",
  243. "search.projectsegfau.lt",
  244. "northboot.xyz",
  245. "opnxng.com",
  246. ];
  247.  
  248. let searxngInstances = [
  249. "baresearch.org",
  250. "dynabyte.ca",
  251. "search.bus-hit.me",
  252. "search.leptons.xyz",
  253. ];
  254.  
  255. let farsideInstance = "farside.link";
  256.  
  257. // // // // // // // // // // // // //
  258.  
  259. let debug_mode = false;
  260.  
  261. if (debug_mode == true) {
  262. alert(
  263. "Hostname: " +
  264. window.location.hostname +
  265. "\nPath: " +
  266. window.location.pathname +
  267. "\nQuery: " +
  268. window.location.search +
  269. "\nHash: " +
  270. window.location.hash
  271. );
  272. }
  273.  
  274. function redirectInstagram() {
  275. if (instagram[0] == true) {
  276. window.stop();
  277.  
  278. alert(
  279. "Bibliogram is discontinued, you may want to disable the redirection."
  280. );
  281.  
  282. var selectedInstance = "";
  283.  
  284. if (instagram[1] == false) {
  285. selectedInstance =
  286. bibliogramInstances[
  287. Math.floor(Math.random() * bibliogramInstances.length)
  288. ];
  289. } else {
  290. selectedInstance = `${farsideInstance}/bibliogram`;
  291. }
  292.  
  293. if (window.location.pathname.startsWith("/accounts/login/")) {
  294. if (window.location.search.indexOf("/reel/") != -1) {
  295. // reels
  296. let newURL =
  297. window.location.protocol +
  298. "//" +
  299. selectedInstance +
  300. window.location.pathname.replace("/accounts/login/", "/") +
  301. window.location.search.replace("?next=/reel", "p") +
  302. window.location.hash;
  303.  
  304. window.location.replace(newURL);
  305. } else if (window.location.search.indexOf("/p/") == -1) {
  306. // user pages - it will crash if it's not the second last block
  307. let newURL =
  308. window.location.protocol +
  309. "//" +
  310. selectedInstance +
  311. window.location.pathname.replace("/accounts/login/", "/") +
  312. window.location.search.replace("?next=", "u") +
  313. window.location.hash;
  314.  
  315. window.location.replace(newURL);
  316. } else {
  317. // probably a post
  318. let newURL =
  319. window.location.protocol +
  320. "//" +
  321. selectedInstance +
  322. window.location.pathname.replace("/accounts/login/", "") +
  323. window.location.search.replace("?next=", "") +
  324. window.location.hash;
  325.  
  326. window.location.replace(newURL);
  327. }
  328. } else {
  329. if (window.location.pathname == "/") {
  330. // home page
  331. location.hostname = selectedInstance;
  332. } else if (window.location.pathname.startsWith("/reel/")) {
  333. // reel
  334. let newURL =
  335. window.location.protocol +
  336. "//" +
  337. selectedInstance +
  338. window.location.pathname.replace("/reel", "/p") +
  339. window.location.hash;
  340.  
  341. window.location.replace(newURL);
  342. } else if (!window.location.pathname.startsWith("/p/")) {
  343. // user page - it will crash if it's not the second last block
  344. let newURL =
  345. window.location.protocol +
  346. "//" +
  347. selectedInstance +
  348. "/u" +
  349. window.location.pathname +
  350. window.location.search +
  351. indow.location.hash;
  352.  
  353. window.location.replace(newURL);
  354. } else {
  355. // probably a post
  356. location.hostname = selectedInstance;
  357. }
  358. }
  359. }
  360. }
  361.  
  362. function redirectTwitter() {
  363. if (twitter[0] == true) {
  364. window.stop();
  365. var selectedInstance = "";
  366.  
  367. if (twitter[1] == false) {
  368. selectedInstance =
  369. nitterInstances[Math.floor(Math.random() * nitterInstances.length)];
  370. } else {
  371. selectedInstance = `${farsideInstance}/nitter`;
  372. }
  373.  
  374. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  375.  
  376. window.location.replace(newURL);
  377. }
  378. }
  379.  
  380. function redirectReddit() {
  381. if (reddit[0] == true) {
  382. window.stop();
  383. var selectedInstance = "";
  384.  
  385. if (reddit[1] == false) {
  386. selectedInstance = eval(redditFrontend + "Instances")[
  387. Math.floor(Math.random() * eval(redditFrontend + "Instances.length"))
  388. ];
  389. } else {
  390. selectedInstance = `${farsideInstance}/${redditFrontend}`;
  391. }
  392.  
  393. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  394.  
  395. window.location.replace(newURL);
  396. }
  397. }
  398.  
  399. function redirectYoutube() {
  400. if (youtube[0] == true) {
  401. window.stop();
  402. var selectedInstance = "";
  403.  
  404. if (youtube[1] == false) {
  405. selectedInstance = eval(youtubeFrontend + "Instances")[
  406. Math.floor(Math.random() * eval(youtubeFrontend + "Instances.length"))
  407. ];
  408. } else {
  409. selectedInstance = `${farsideInstance}/${youtubeFrontend}`;
  410. }
  411.  
  412. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  413.  
  414. window.location.replace(newURL);
  415. }
  416. }
  417.  
  418. function redirectTiktok() {
  419. if (tiktok[0] == true) {
  420. window.stop();
  421. var selectedInstance = "";
  422.  
  423. if (tiktok[1] == false) {
  424. selectedInstance =
  425. proxitokInstances[Math.floor(Math.random() * proxitokInstances.length)];
  426. } else {
  427. selectedInstance = `${farsideInstance}/proxitok`;
  428. }
  429.  
  430. if (window.location.pathname.startsWith("/discover")) {
  431. let newURL = `${
  432. window.location.protocol
  433. }//${selectedInstance}${window.location.pathname.replace(
  434. "discover",
  435. "tag"
  436. )}${window.location.hash}`;
  437.  
  438. window.location.replace(newURL);
  439. } else if (
  440. window.location.pathname.search(/[a-z][a-z]\-[A-Z][A-Z]/g) != -1
  441. ) {
  442. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  443.  
  444. window.location.replace(newURL);
  445. } else {
  446. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  447.  
  448. window.location.replace(newURL);
  449. }
  450. }
  451. }
  452.  
  453. function redirectImgur() {
  454. if (imgur[0] == true) {
  455. window.stop();
  456.  
  457. var selectedInstance = "";
  458.  
  459. if (imgur[1] == false) {
  460. selectedInstance =
  461. rimgoInstances[Math.floor(Math.random() * rimgoInstances.length)];
  462. } else {
  463. selectedInstance = `${farsideInstance}/rimgo`;
  464. }
  465.  
  466. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  467.  
  468. window.location.replace(newURL);
  469. }
  470. }
  471.  
  472. function redirectMedium() {
  473. if (medium[0] == true || window.location.pathname != "/") {
  474. window.stop();
  475. var selectedInstance = "";
  476.  
  477. if (medium[1] == false) {
  478. selectedInstance =
  479. scribeInstances[Math.floor(Math.random() * scribeInstances.length)];
  480. } else {
  481. selectedInstance = `${farsideInstance}/scribe`;
  482. }
  483.  
  484. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  485.  
  486. window.location.replace(newURL);
  487. }
  488. }
  489.  
  490. function redirectYoutubeMusic() {
  491. if (youtube[0] == true) {
  492. window.stop();
  493.  
  494. if (window.location.pathname.startsWith("/watch")) {
  495. if (youtube[1] == false) {
  496. selectedInstance = eval(youtubeFrontend + "Instances")[
  497. Math.floor(Math.random() * eval(youtubeFrontend + "Instances.length"))
  498. ];
  499. } else {
  500. selectedInstance = `${farsideInstance}/${youtubeFrontend}`;
  501. }
  502.  
  503. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  504.  
  505. window.location.replace(newURL);
  506. } else if (window.location.pathname.startsWith("/playlist")) {
  507. let newURL = `${window.location.protocol}//beatbump.ml${
  508. window.location.pathname
  509. }${window.location.search.replace("?list=", "/VL")}${
  510. window.location.hash
  511. }`;
  512.  
  513. window.location.replace(newURL);
  514. } else if (window.location.pathname.startsWith("/channel")) {
  515. let newURL = `${
  516. window.location.protocol
  517. }//beatbump.ml${window.location.pathname.replace("/channel", "/artist")}${
  518. window.location.search
  519. }${window.location.hash}`;
  520.  
  521. window.location.replace(newURL);
  522. } else if (window.location.pathname.startsWith("/explore")) {
  523. let newURL = `${
  524. window.location.protocol
  525. }//beatbump.ml${window.location.pathname.replace(
  526. "/explore",
  527. "/trending"
  528. )}${window.location.search}${window.location.hash}`;
  529.  
  530. window.location.replace(newURL);
  531. } else if (window.location.pathname.startsWith("/moods_and_genres")) {
  532. let newURL = `${
  533. window.location.protocol
  534. }//beatbump.ml${window.location.pathname.replace(
  535. "/moods_and_genres",
  536. "/explore"
  537. )}${window.location.search}${window.location.hash}`;
  538.  
  539. window.location.replace(newURL);
  540. } else {
  541. location.hostname = "beatbump.ml";
  542. }
  543. }
  544. }
  545.  
  546. function redirectHackerNews() {
  547. if (
  548. hackernews[0] == true &&
  549. window.location.pathname != "/user" &&
  550. window.location.pathname != "/item"
  551. ) {
  552. window.stop();
  553. let newURL = `${window.location.protocol}//hn.algolia.com`;
  554. window.location.replace(newURL);
  555. }
  556. }
  557.  
  558. function redirectGTranslate() {
  559. if (gtranslate[0] == true) {
  560. window.stop();
  561. var selectedInstance = "";
  562.  
  563. if (gtranslate[1] == false) {
  564. selectedInstance =
  565. lingvaInstances[Math.floor(Math.random() * lingvaInstances.length)];
  566. } else {
  567. selectedInstance = `${farsideInstance}/lingva`;
  568. }
  569.  
  570. if (window.location.search != "") {
  571. let newURL =
  572. window.location.protocol +
  573. "//" +
  574. selectedInstance +
  575. window.location.pathname +
  576. window.location.search
  577. .replace(/\?hl=tr/, "")
  578. .replace(/.sl=/, "")
  579. .replace("&tl=", "/")
  580. .replace("&text=", "/")
  581. .replace("&op=translate", "") +
  582. window.location.hash;
  583.  
  584. window.location.replace(newURL);
  585. } else {
  586. let newURL = window.location.protocol + "//" + selectedInstance;
  587. window.location.replace(newURL);
  588. }
  589. }
  590. }
  591.  
  592. function redirectReuters() {
  593. if (reuters[0] == true) {
  594. window.stop();
  595. location.hostname = "neuters.de";
  596. }
  597. }
  598.  
  599. function redirectWikipedia() {
  600. if (wikipedia[0] == true) {
  601. window.stop();
  602. let langCodeIndex = window.location.hostname.search(/^[a-z][a-z]\./);
  603. var selectedInstance = "";
  604.  
  605. if (wikipedia[1] == false) {
  606. selectedInstance =
  607. wikilessInstances[Math.floor(Math.random() * wikilessInstances.length)];
  608. } else {
  609. selectedInstance = `${farsideInstance}/wikiless`;
  610. }
  611.  
  612. if (langCodeIndex != -1) {
  613. let newURL =
  614. window.location.protocol +
  615. "//" +
  616. selectedInstance +
  617. window.location.pathname +
  618. "?lang=" +
  619. window.location.hostname[langCodeIndex] +
  620. window.location.hostname[langCodeIndex + 1] +
  621. window.location.hash;
  622. window.location.replace(newURL);
  623. } else {
  624. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}?lang=en${window.location.hash}`;
  625. window.location.replace(newURL);
  626. }
  627. }
  628. }
  629.  
  630. function redirectImdb() {
  631. if (imdb[0] == true) {
  632. if (window.location.pathname.startsWith("/title/")) {
  633. window.stop();
  634. var selectedInstance = "";
  635.  
  636. if (imdb[1] == false) {
  637. selectedInstance =
  638. libremdbInstances[
  639. Math.floor(Math.random() * libremdbInstances.length)
  640. ];
  641. } else {
  642. selectedInstance = `${farsideInstance}/libremdb`;
  643. }
  644.  
  645. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  646.  
  647. window.location.replace(newURL);
  648. }
  649. }
  650. }
  651.  
  652. function redirectQuora() {
  653. if (quora[0] == true) {
  654. window.stop();
  655. var selectedInstance = "";
  656.  
  657. if (quora[1] == false) {
  658. selectedInstance =
  659. quetreInstances[Math.floor(Math.random() * quetreInstances.length)];
  660. } else {
  661. selectedInstance = `${farsideInstance}/quetre`;
  662. }
  663.  
  664. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  665.  
  666. window.location.replace(newURL);
  667. }
  668. }
  669.  
  670. function redirectFandom() {
  671. if (fandom[0] == true) {
  672. let randomInstance =
  673. breezewikiInstances[
  674. Math.floor(Math.random() * breezewikiInstances.length)
  675. ];
  676. let fandomName = window.location.hostname.replace(/\..*/, "");
  677. let newURL = "";
  678. window.stop();
  679.  
  680. if (fandomName !== "www") {
  681. newURL = `${window.location.protocol}//${randomInstance}/${fandomName}${window.location.pathname}${window.location.search}${window.location.hash}`;
  682. } else {
  683. newURL = `${window.location.protocol}//${randomInstance}`;
  684. }
  685.  
  686. window.location.replace(newURL);
  687. }
  688. }
  689.  
  690. function redirectGoogle() {
  691. if (
  692. google[0] == true &&
  693. window.location.hostname.startsWith("www") &&
  694. window.location.pathname.startsWith("/search")
  695. ) {
  696. window.stop();
  697. var selectedInstance = "";
  698.  
  699. if (google[1] == false) {
  700. selectedInstance = eval(googleFrontend + "Instances")[
  701. Math.floor(Math.random() * eval(googleFrontend + "Instances.length"))
  702. ];
  703. } else {
  704. selectedInstance = `${farsideInstance}/${googleFrontend}`;
  705. }
  706.  
  707. if (window.location.pathname.match("/")) {
  708. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  709. window.location.replace(newURL);
  710. } else {
  711. let newURL = `${window.location.protocol}//${selectedInstance}${
  712. window.location.pathname
  713. }${window.location.search.match(/\?q.+?(?=\&)/)}`;
  714. window.location.replace(newURL);
  715. }
  716. }
  717. }
  718.  
  719. function redirectGoodreads() {
  720. if (goodreads[0] == true) {
  721. window.stop();
  722.  
  723. var selectedInstance =
  724. biblioreadsInstances[
  725. Math.floor(Math.random() * biblioreadsInstances.length)
  726. ];
  727.  
  728. if (window.location.pathname.startsWith("/search")) {
  729. let newURL =
  730. `${window.location.protocol}//${selectedInstance}${window.location.pathname}` +
  731. window.location.search.replace(/.*.q\=/, "/") +
  732. `${window.location.hash}`;
  733. window.location.replace(newURL);
  734. } else {
  735. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  736. window.location.replace(newURL);
  737. }
  738. }
  739. }
  740.  
  741. let urlHostname = window.location.hostname;
  742.  
  743. switch (urlHostname) {
  744. case "www.instagram.com":
  745. redirectInstagram();
  746. break;
  747.  
  748. case "twitter.com":
  749. case "mobile.twitter.com":
  750. redirectTwitter();
  751. break;
  752.  
  753. case "www.reddit.com":
  754. case "old.reddit.com":
  755. redirectReddit();
  756. break;
  757.  
  758. case "www.youtube.com":
  759. case "m.youtube.com":
  760. case "www.youtube-nocookie.com":
  761. redirectYoutube();
  762. break;
  763.  
  764. case "www.tiktok.com":
  765. redirectTiktok();
  766. break;
  767.  
  768. case "music.youtube.com":
  769. if (youtubeMusicFrontend == "beatbump") {
  770. redirectYoutubeMusic();
  771. } else {
  772. redirectYoutube();
  773. }
  774. break;
  775.  
  776. case "news.ycombinator.com":
  777. redirectHackerNews();
  778. break;
  779.  
  780. case "translate.google.com":
  781. redirectGTranslate();
  782. break;
  783.  
  784. case "www.reuters.com":
  785. redirectReuters();
  786. break;
  787.  
  788. case "www.imdb.com":
  789. redirectImdb();
  790. break;
  791.  
  792. case "www.quora.com":
  793. redirectQuora();
  794. break;
  795.  
  796. case "www.google.com":
  797. redirectGoogle();
  798. break;
  799.  
  800. case "www.goodreads.com":
  801. redirectGoodreads();
  802. break;
  803.  
  804. default:
  805. if (urlHostname.includes("medium.com")) {
  806. redirectMedium();
  807. } else if (urlHostname.includes("imgur.com")) {
  808. redirectImgur();
  809. } else if (urlHostname.includes("wikipedia.org")) {
  810. redirectWikipedia();
  811. } else if (urlHostname.includes("fandom.com")) {
  812. redirectFandom();
  813. }
  814. break;
  815. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址