Reddit to Libreddit Redirect

Redirects Reddit links to randomly chosen Libreddit instances automatically and provides an option to reload in a different instance, if the user wishes to do so.

  1. // ==UserScript==
  2. // @name Reddit to Libreddit Redirect
  3. // @namespace https://kbin.social/u/LollerCorleone
  4. // @version 1.2
  5. // @description Redirects Reddit links to randomly chosen Libreddit instances automatically and provides an option to reload in a different instance, if the user wishes to do so.
  6. // @author LollerCorleone
  7. // @license GNU GPLv3
  8. // @match *://www.reddit.com/*
  9. // @match *://old.reddit.com/*
  10. // @match https://libreddit.kavin.rocks/*
  11. // @match https://reddit.invak.id/*
  12. // @match https://reddit.simo.sh/*
  13. // @match https://lr.riverside.rocks/*
  14. // @match https://libreddit.strongthany.cc/*
  15. // @match https://libreddit.privacy.com.de/*
  16. // @match https://reddit.baby/*
  17. // @match https://libreddit.domain.glass/*
  18. // @match https://r.nf/*
  19. // @match https://libreddit.de/*
  20. // @match https://libreddit.pussthecat.org/*
  21. // @match https://libreddit.northboot.xyz/*
  22. // @match https://libreddit.hu/*
  23. // @match https://libreddit.totaldarkness.net/*
  24. // @match https://lr.vern.cc/*
  25. // @match https://libreddit.nl/*
  26. // @match https://reddi.tk/*
  27. // @match https://r.walkx.fyi/*
  28. // @match https://libreddit.kylrth.com/*
  29. // @match https://libreddit.tiekoetter.com/*
  30. // @match https://reddit.rtrace.io/*
  31. // @match https://libreddit.privacydev.net/*
  32. // @match https://r.ahwx.org/*
  33. // @match https://libreddit.dcs0.hu/*
  34. // @match https://reddit.dr460nf1r3.org/*
  35. // @match https://l.opnxng.com/*
  36. // @match https://libreddit.cachyos.org/*
  37. // @match https://rd.funami.tech/*
  38. // @match https://libreddit.projectsegfau.lt/*
  39. // @match https://lr.slipfox.xyz/*
  40. // @match https://libreddit.oxymagnesium.com/*
  41. // @match https://reddit.utsav2.dev/*
  42. // @match https://libreddit.freedit.eu/*
  43. // @match https://libreddit.mha.fi/*
  44. // @match https://libreddit.garudalinux.org/*
  45. // @match https://lr.4201337.xyz/*
  46. // @match https://lr.artemislena.eu/*
  47. // @match https://libreddit.pufe.org/*
  48. // @match https://lr.aeong.one/*
  49. // @match https://reddit.smnz.de/*
  50. // @match https://libreddit.bus-hit.me/*
  51. // @match https://reddit.leptons.xyz/*
  52. // @match https://libreddit.lunar.icu/*
  53. // @match https://reddit.moe.ngo/*
  54. // @match https://r.darklab.sh/*
  55. // @match https://snoo.habedieeh.re/*
  56. // @match https://libreddit.kutay.dev/*
  57. // @match https://libreddit.tux.pizza/*
  58. // @grant none
  59. // @run-at document-start
  60. // ==/UserScript==
  61.  
  62. (function() {
  63. 'use strict';
  64.  
  65. // List of Libreddit instances
  66. var libredditInstances = [
  67. 'https://libreddit.kavin.rocks',
  68. 'https://reddit.invak.id',
  69. 'https://reddit.simo.sh',
  70. 'https://lr.riverside.rocks',
  71. 'https://libreddit.strongthany.cc',
  72. 'https://libreddit.privacy.com.de',
  73. 'https://reddit.baby',
  74. 'https://libreddit.domain.glass',
  75. 'https://r.nf',
  76. 'https://libreddit.de',
  77. 'https://libreddit.pussthecat.org',
  78. 'https://libreddit.northboot.xyz',
  79. 'https://libreddit.hu',
  80. 'https://libreddit.totaldarkness.net',
  81. 'https://lr.vern.cc',
  82. 'https://libreddit.nl',
  83. 'https://reddi.tk',
  84. 'https://r.walkx.fyi',
  85. 'https://libreddit.kylrth.com',
  86. 'https://libreddit.tiekoetter.com',
  87. 'https://reddit.rtrace.io',
  88. 'https://libreddit.privacydev.net',
  89. 'https://r.ahwx.org',
  90. 'https://libreddit.dcs0.hu',
  91. 'https://reddit.dr460nf1r3.org',
  92. 'https://l.opnxng.com',
  93. 'https://libreddit.cachyos.org',
  94. 'https://rd.funami.tech',
  95. 'https://libreddit.projectsegfau.lt',
  96. 'https://lr.slipfox.xyz',
  97. 'https://libreddit.oxymagnesium.com',
  98. 'https://reddit.utsav2.dev',
  99. 'https://libreddit.freedit.eu',
  100. 'https://libreddit.mha.fi',
  101. 'https://libreddit.garudalinux.org',
  102. 'https://lr.4201337.xyz',
  103. 'https://lr.artemislena.eu',
  104. 'https://libreddit.pufe.org',
  105. 'https://lr.aeong.one',
  106. 'https://reddit.smnz.de',
  107. 'https://libreddit.bus-hit.me',
  108. 'https://reddit.leptons.xyz',
  109. 'https://libreddit.lunar.icu',
  110. 'https://reddit.moe.ngo',
  111. 'https://r.darklab.sh',
  112. 'https://snoo.habedieeh.re',
  113. 'https://libreddit.kutay.dev',
  114. 'https://libreddit.tux.pizza'
  115. ];
  116.  
  117. // Get the current URL
  118. var currentUrl = window.location.href;
  119.  
  120. // Check if the URL matches the Reddit homepage
  121. if (currentUrl === 'https://www.reddit.com/' || currentUrl === 'https://old.reddit.com/') {
  122. // Redirect to a random Libreddit instance's homepage
  123. var randomInstance = libredditInstances[Math.floor(Math.random() * libredditInstances.length)];
  124. window.location.replace(randomInstance + '/r/all');
  125. return; // Stop further script execution
  126. } else if (currentUrl.match(/https?:\/\/(?:www|old|libreddit)\.reddit\.com\/r\/\w+\//)) {
  127. // Construct the Libreddit subreddit URL
  128. var libredditUrl = currentUrl.replace(/https?:\/\/(?:www|old|libreddit)\.reddit\.com/, function(match) {
  129. return libredditInstances[Math.floor(Math.random() * libredditInstances.length)];
  130. });
  131.  
  132. // Redirect to the Libreddit subreddit URL
  133. window.location.replace(libredditUrl);
  134. return; // Stop further script execution
  135. } else if (currentUrl.match(/https?:\/\/(?:www|old|libreddit)\.reddit\.com\/r\/\w+\/comments\/\w+\//)) {
  136. // Construct the Libreddit post URL
  137. var libredditUrl = currentUrl.replace(/https?:\/\/(?:www|old|libreddit)\.reddit\.com/, function(match) {
  138. return libredditInstances[Math.floor(Math.random() * libredditInstances.length)];
  139. });
  140.  
  141. // Redirect to the Libreddit post URL
  142. window.location.replace(libredditUrl);
  143. return; // Stop further script execution
  144. }
  145.  
  146. // Create the reload button
  147. var reloadButton = document.createElement('button');
  148. reloadButton.textContent = 'Reload in Another Instance';
  149. reloadButton.style.position = 'fixed';
  150. reloadButton.style.bottom = '10px';
  151. reloadButton.style.right = '10px';
  152. reloadButton.style.zIndex = '9999';
  153. reloadButton.style.padding = '8px 12px';
  154. reloadButton.style.fontSize = '14px';
  155. reloadButton.style.fontWeight = 'bold';
  156. reloadButton.style.color = '#fff';
  157. reloadButton.style.backgroundColor = '#0079d3';
  158. reloadButton.style.border = 'none';
  159. reloadButton.style.borderRadius = '4px';
  160. reloadButton.style.cursor = 'pointer';
  161.  
  162. // Add event listener to reload button
  163. reloadButton.addEventListener('click', function() {
  164. // Redirect to a random Libreddit instance
  165. var randomInstance = libredditInstances[Math.floor(Math.random() * libredditInstances.length)];
  166. window.location.href = randomInstance + window.location.pathname + window.location.search + window.location.hash;
  167. });
  168.  
  169. // Append the reload button to the document body
  170. document.body.appendChild(reloadButton);
  171. })();

QingJ © 2025

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