Privacy Redirector

Redirect social media platforms to their privacy respecting frontends

Version au 13/03/2022. Voir la dernière version.

  1. // ==UserScript==
  2. // @name Privacy Redirector
  3. // @namespace https://github.com/dybdeskarphet/privacy-redirector
  4. // @license WTFPL
  5. // @version 1.1.3
  6. // @description Redirect social media platforms to their privacy respecting frontends
  7. // @description:tr Sosyal medya platformlarını, gizliliğe saygı duyan önyüzlerine yönlendirir
  8. // @run-at document-start
  9. // @match *://instagram.com/*
  10. // @match *://*.instagram.com/*
  11. // @match *://twitter.com/*
  12. // @match *://*.twitter.com/*
  13. // @match *://reddit.com/*
  14. // @match *://*.reddit.com/*
  15. // @match *://youtube.com/*
  16. // @match *://*.youtube.com/*
  17. // ==/UserScript==
  18.  
  19. /*
  20. ___ _ _ ___ _____ _____
  21. / _ \| \ | | / _ \| ___| ___|
  22. | | | | \| |_____| | | | |_ | |_
  23. | |_| | |\ |_____| |_| | _| | _|
  24. \___/|_| \_| \___/|_| |_|
  25.  
  26. CHANGE THE RELEVANT VALUE TO "false" TO
  27. DISABLE THE REDIRECTION FOR THAT
  28. PARTICULAR SITE */
  29. let redirect_youtube = true;
  30. let redirect_instagram = true;
  31. let redirect_twitter = true;
  32. let redirect_reddit = true;
  33.  
  34. // // // // // // // // // // // // //
  35.  
  36. function redirectInstagram() {
  37.  
  38. if (redirect_instagram == false) {
  39. return;
  40. }
  41.  
  42. if (window.location.pathname.indexOf("/p/") == 0) {
  43. window.stop();
  44. location.hostname = 'bibliogram.pussthecat.org';
  45. } else if (window.location.pathname == "/") {
  46. window.stop();
  47. location.hostname = 'bibliogram.pussthecat.org';
  48. } else if (window.location.pathname === "/accounts/login/") {
  49. window.stop();
  50. let oldQuery = window.location.search;
  51. let newQuery = oldQuery.replace("?next=/", "/")
  52. let newURL = window.location.protocol + "//" + "bibliogram.pussthecat.org" + "/u" + newQuery + window.location.hash;
  53. window.location.replace(newURL);
  54. } else {
  55. window.stop();
  56. let oldUrlPath = window.location.pathname;
  57. let newURL = window.location.protocol + "//" + "bibliogram.pussthecat.org" + "/u" + oldUrlPath + window.location.search + window.location.hash;
  58. window.location.replace(newURL);
  59. }
  60.  
  61. }
  62.  
  63. function redirectTwitter() {
  64. if (redirect_twitter == false) {
  65. return;
  66. }
  67.  
  68. window.stop();
  69. location.hostname = "nitter.42l.fr";
  70. }
  71.  
  72. function redirectReddit() {
  73. if (redirect_reddit == false) {
  74. return;
  75. }
  76.  
  77. window.stop();
  78. location.hostname = "libreddit.spike.codes";
  79. }
  80.  
  81. function redirectYoutube() {
  82. if (redirect_youtube == false) {
  83. return;
  84. }
  85.  
  86. if (window.location.pathname.indexOf("results?search_query") == 1) {
  87. window.stop();
  88. location.hostname = "vid.puffyan.us";
  89. window.location.replace("results?search_query", "search?q");
  90. } else {
  91. window.stop();
  92. location.hostname = "vid.puffyan.us";
  93. }
  94. }
  95.  
  96. var urlHostname = window.location.hostname;
  97.  
  98. switch (urlHostname) {
  99. case "www.instagram.com":
  100. redirectInstagram();
  101. break;
  102.  
  103. case "twitter.com":
  104. redirectTwitter();
  105. break;
  106.  
  107. case "mobile.twitter.com":
  108. redirectTwitter();
  109. break;
  110.  
  111. case "www.reddit.com":
  112. redirectReddit();
  113. break;
  114.  
  115. case "www.youtube.com":
  116. redirectYoutube();
  117. break;
  118.  
  119. case "m.youtube.com":
  120. redirectYoutube();
  121. break;
  122. }