Open-Source Alternative Redirector

Redirects you from proprietary web-services to ethical alternatives.

目前为 2022-03-12 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Open-Source Alternative Redirector
  3. // @namespace -
  4. // @version 0.7
  5. // @description Redirects you from proprietary web-services to ethical alternatives.
  6. // @author NotYou
  7. // @include *youtube.com/*
  8. // @include *google.com/*
  9. // @include *yahoo.com/*
  10. // @include *bing.com/*
  11. // @include *reddit.com/*
  12. // @include *twitter.com/*
  13. // @include *instagram.com/*
  14. // @include *wikipedia.org/*
  15. // @run-at document-start
  16. // @license GPL-3.0-or-later
  17. // @icon https://icons.iconarchive.com/icons/itweek/knob-toolbar/32/Knob-Shuffle-Off-icon.png
  18. // @grant none
  19. // ==/UserScript==
  20.  
  21. /*
  22.  
  23. ﹀ Change Log ﹀
  24.  
  25. 0.7 Version:
  26. - Removed duckduckgo
  27. - Better instagram redirect
  28. - Added google translate
  29.  
  30. 0.6 Version:
  31. - Redirect from yahoo
  32. - Redirect from bing
  33. - Redirect from duckduckgo
  34.  
  35. 0.5 Version:
  36. - Support for other languages for wikiless/wikipedia
  37. - Better Instances format
  38.  
  39. */
  40.  
  41. var url = new URL(window.location.href)
  42.  
  43. // INSTANCES //
  44. const
  45. invidious = 'yewtu.be',
  46. searx = 'search.mdosch.de',
  47. libreddit = 'reddit.invak.id',
  48. nitter = 'nitter.snopyta.org',
  49. bibliogram = 'bibliogram.pussthecat.org',
  50. wikiless = 'wikiless.org',
  51. lingva = 'lingva.ml'
  52.  
  53. // YouTube | Invidious //
  54. if(window.location.host.indexOf('youtube.com') != -1){
  55. window.location.replace('https://' + invidious + window.location.pathname + window.location.search)
  56. }
  57.  
  58. if(window.location.host.indexOf('google.com') != -1){
  59. // Google Translate | Lingva Translate //
  60. if(window.location.host.indexOf('translate.google.com') != -1){
  61. if(window.location.search === '') {
  62. window.location.replace('https://' + lingva)
  63. } else {
  64. let lang1 = window.location.search.split('&')[0].split('=')[1];
  65. let lang2 = window.location.search.split('&')[1].split('=')[1];
  66. let text = window.location.search.split('&')[2].split('=')[1];
  67. window.location.replace('https://' + lingva + '/' + lang1 + '/' + lang2 + '/' + text)
  68. }
  69. // Google | SearX //
  70. } else {
  71. window.location.replace('https://' + searx + window.location.pathname + window.location.search)
  72. }
  73. }
  74.  
  75. // Yahoo | SearX //
  76. if(window.location.host.indexOf('yahoo.com') != -1){
  77. let search = window.location.search.replace('?p', '?q')
  78. window.location.replace('https://' + searx + window.location.pathname + search)
  79. }
  80.  
  81. // Bing | SearX //
  82. if(window.location.host.indexOf('bing.com') != -1){
  83. window.location.replace('https://' + searx + window.location.pathname + window.location.search)
  84. }
  85.  
  86. // Reddit | Libreddit //
  87. if(window.location.host.indexOf('reddit.com') != -1){
  88. window.location.replace('https://' + libreddit + window.location.pathname + window.location.search)
  89. }
  90.  
  91. // Twitter | Nitter //
  92. if(window.location.host.indexOf('twitter.com') != -1){
  93. window.location.replace('https://' + nitter + window.location.pathname + window.location.search)
  94. }
  95.  
  96. // Instagram | Bibliogram //
  97. if(window.location.host.indexOf('instagram.com') != -1){
  98. if(window.location.pathname === '/accounts/login/') {
  99. let path1 = window.location.search.split('?next=').at(1)
  100. let path = '/u' + path1
  101. window.location.replace('https://' + bibliogram + path)
  102. } else {
  103. window.location.replace('https://' + bibliogram + window.location.pathname + window.location.search)
  104. }
  105. }
  106.  
  107. // Wikipedia | Wikiless //
  108. if(window.location.host.indexOf('wikipedia.org') != -1){
  109. let sub = url.hostname.split('.')[0];
  110. window.location.replace('https://' + wikiless + window.location.pathname + '?lang=' + sub)
  111. }
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.