Privacy Redirector

Redirect social media platforms to their privacy respecting frontends

目前为 2021-11-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Privacy Redirector
  3. // @namespace https://gist.github.com/dybdeskarphet/daf54cab6b1f510097a88104bec2e690
  4. // @license MIT
  5. // @version 1.0
  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. function redirectInstagram() {
  20. if (window.location.pathname.indexOf("/p/") == 0) {
  21. window.stop(); // stop loading the window
  22. location.hostname = 'bibliogram.art';
  23. } else {
  24. let oldUrlPath = window.location.pathname;
  25. let newURL = window.location.protocol + "//" + "bibliogram.art" + "/u" + oldUrlPath + window.location.search + window.location.hash;
  26. window.location.replace (newURL);
  27. }
  28. }
  29.  
  30. function redirectTwitter() {
  31. window.stop();
  32. location.hostname = "nitter.net";
  33. }
  34.  
  35. function redirectReddit() {
  36. window.stop();
  37. location.hostname = "teddit.net";
  38. }
  39.  
  40. function redirectYoutube() {
  41. window.stop();
  42. location.hostname = "invidious.snopyta.org";
  43. }
  44.  
  45. var urlHostname = window.location.hostname;
  46.  
  47. switch (urlHostname) {
  48. case "www.instagram.com":
  49. redirectInstagram();
  50. break;
  51. case "twitter.com":
  52. redirectTwitter();
  53. break;
  54.  
  55. case "www.reddit.com":
  56. redirectReddit();
  57. break;
  58.  
  59. case "www.youtube.com":
  60. redirectYoutube();
  61. break;
  62. }