Useless Things Series: Random Redirector

Redirects you to a random website for fun and exploration.

  1. // ==UserScript==
  2. // @name Useless Things Series: Random Redirector
  3. // @version 1.0
  4. // @description Redirects you to a random website for fun and exploration.
  5. // @match *://*/*
  6. // @grant GM_setValue
  7. // @grant GM_getValue
  8. // @license MIT
  9. // @namespace https://greasyfork.org/users/1126616
  10. // ==/UserScript==
  11.  
  12. // Configuration
  13. let redirectionProbability = 1; // Initial probability of redirection (1 = 100% chance)
  14. const redirectionInterval = 5000; // Time interval in milliseconds (5 seconds)
  15.  
  16. // Adjust the probability of redirection
  17. function adjustRedirectionProbability(probability) {
  18. redirectionProbability = probability;
  19. }
  20.  
  21. // Generate a random URL to redirect to
  22. function generateRandomUrl() {
  23. // List of websites
  24. const listWebsites = [
  25. "https://www.google.com",
  26. "https://www.youtube.com",
  27. "https://www.facebook.com",
  28. "https://www.twitter.com",
  29. "https://www.instagram.com",
  30. "https://www.linkedin.com",
  31. "https://www.pinterest.com",
  32. "https://www.reddit.com",
  33. "https://www.tumblr.com",
  34. "https://www.snapchat.com",
  35. "https://www.tiktok.com",
  36. "https://www.netflix.com",
  37. "https://www.amazon.com",
  38. "https://www.ebay.com",
  39. "https://www.apple.com",
  40. "https://www.microsoft.com",
  41. "https://www.wikipedia.org",
  42. "https://www.yahoo.com",
  43. "https://www.bing.com",
  44. "https://www.twitch.tv",
  45. "https://www.y8.com",
  46. "https://www.friv.com",
  47. "https://www.agame.com",
  48. "https://www.kongregate.com",
  49. "https://www.miniclip.com",
  50. "https://www.addictinggames.com",
  51. "https://www.poki.com",
  52. "https://www.crazygames.com",
  53. "https://www.gamesgames.com",
  54. "https://www.arkadium.com"
  55. // Add more websites here
  56. ];
  57.  
  58. const randomIndex = Math.floor(Math.random() * listWebsites.length);
  59. return listWebsites[randomIndex];
  60. }
  61.  
  62. // Redirect to a random website
  63. function redirectToRandomWebsite() {
  64. const randomUrl = generateRandomUrl();
  65. window.location.href = randomUrl;
  66. }
  67.  
  68. // Activate the redirection at the specified interval
  69. setInterval(() => {
  70. if (Math.random() < redirectionProbability) {
  71. redirectToRandomWebsite();
  72. }
  73. }, redirectionInterval);
  74.  
  75. // Additional Functions
  76. function enableRedirection() {
  77. redirectionProbability = 1;
  78. }
  79.  
  80. function disableRedirection() {
  81. redirectionProbability = 0;
  82. }
  83.  
  84. function adjustRedirectionInterval(interval) {
  85. redirectionInterval = interval;
  86. }
  87.  
  88. function uselessFunction1() {
  89. console.log("This is a useless function.");
  90. }
  91.  
  92. function uselessFunction2() {
  93. console.log("Another useless function.");
  94. }
  95.  
  96. function usefulFunction1() {
  97. console.log("This is a useful function.");
  98. }
  99.  
  100. function usefulFunction2() {
  101. console.log("Another useful function.");
  102. }
  103.  
  104. // Example usage:
  105. // enableRedirection(); // Uncomment this line to enable redirection
  106. // disableRedirection(); // Uncomment this line to disable redirection
  107. // adjustRedirectionInterval(10000); // Uncomment this line to adjust the redirection interval (in milliseconds)
  108. // uselessFunction1(); // Uncomment this line to invoke the useless function 1
  109. // uselessFunction2(); // Uncomment this line to invoke the useless function 2
  110. // usefulFunction1(); // Uncomment this line to invoke the useful function 1
  111. // usefulFunction2(); // Uncomment this line to invoke the useful function 2