Roblox Search Filters Enhancer (with Theme Toggle)

Adds creator and genre filters with Roblox-style UI and dark/light toggle on the Discover page.

  1. // ==UserScript==
  2. // @name Roblox Search Filters Enhancer (with Theme Toggle)
  3. // @namespace https://greasyfork.org/users/yourusername
  4. // @version 1.1
  5. // @description Adds creator and genre filters with Roblox-style UI and dark/light toggle on the Discover page.
  6. // @author You
  7. // @license MIT
  8. // @match https://www.roblox.com/discover*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. /*
  13. MIT License
  14.  
  15. Copyright (c) 2025 You
  16.  
  17. Permission is hereby granted, free of charge, to any person obtaining a copy
  18. of this software and associated documentation files (the “Software”), to deal
  19. in the Software without restriction, including without limitation the rights
  20. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  21. copies of the Software, and to permit persons to whom the Software is
  22. furnished to do so, subject to the following conditions:
  23.  
  24. The above copyright notice and this permission notice shall be included in all
  25. copies or substantial portions of the Software.
  26.  
  27. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  28. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  29. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  30. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  31. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  32. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  33. SOFTWARE.
  34. */
  35.  
  36. (function () {
  37. 'use strict';
  38.  
  39. const FONT_FAMILY = `'GothamSSm', 'Arial', sans-serif`;
  40.  
  41. const theme = {
  42. light: {
  43. bg: "#ffffff",
  44. text: "#222",
  45. border: "#ccc",
  46. button: "#e5e5e5"
  47. },
  48. dark: {
  49. bg: "#1a1a1a",
  50. text: "#eee",
  51. border: "#333",
  52. button: "#333"
  53. }
  54. };
  55.  
  56. let currentTheme = localStorage.getItem("rbx_filter_theme") || "light";
  57.  
  58. function applyTheme(panel, themeName) {
  59. const t = theme[themeName];
  60. panel.style.background = t.bg;
  61. panel.style.color = t.text;
  62. panel.style.borderColor = t.border;
  63. panel.querySelectorAll("input, select, button").forEach(el => {
  64. el.style.background = t.button;
  65. el.style.color = t.text;
  66. el.style.border = `1px solid ${t.border}`;
  67. });
  68. }
  69.  
  70. // Create main panel
  71. const panel = document.createElement("div");
  72. panel.id = "rbx-filter-panel";
  73. panel.style.position = "fixed";
  74. panel.style.top = "110px";
  75. panel.style.right = "20px";
  76. panel.style.zIndex = "10000";
  77. panel.style.padding = "10px";
  78. panel.style.border = "1px solid";
  79. panel.style.borderRadius = "8px";
  80. panel.style.boxShadow = "0 2px 8px rgba(0,0,0,0.2)";
  81. panel.style.fontSize = "14px";
  82. panel.style.fontFamily = FONT_FAMILY;
  83. panel.style.minWidth = "200px";
  84. panel.innerHTML = `
  85. <strong style="display:block; margin-bottom: 8px;">Roblox Filters</strong>
  86. <label>Creator:<br/><input id="rbx_creator" type="text" placeholder="Username" style="width:100%" /></label><br/><br/>
  87. <label>Genre:<br/>
  88. <select id="rbx_genre" style="width:100%">
  89. <option value="">-- Any --</option>
  90. <option value="1">All</option>
  91. <option value="13">Adventure</option>
  92. <option value="19">Building</option>
  93. <option value="3">Comedy</option>
  94. <option value="5">Fighting</option>
  95. <option value="10">FPS</option>
  96. <option value="8">Horror</option>
  97. <option value="11">Medieval</option>
  98. <option value="9">Military</option>
  99. <option value="20">Naval</option>
  100. <option value="2">RPG</option>
  101. <option value="15">Sci-Fi</option>
  102. <option value="4">Sports</option>
  103. <option value="17">Town and City</option>
  104. <option value="6">Western</option>
  105. </select>
  106. </label><br/><br/>
  107. <button id="rbx_apply" style="width:100%; margin-bottom: 6px;">Apply</button>
  108. <button id="rbx_theme" style="width:100%;">Toggle Theme</button>
  109. `;
  110. document.body.appendChild(panel);
  111. applyTheme(panel, currentTheme);
  112.  
  113. // Place toggle button near search bar
  114. const waitForSearchBar = setInterval(() => {
  115. const searchBar = document.querySelector('.search-input-container input');
  116. if (searchBar) {
  117. clearInterval(waitForSearchBar);
  118. const btn = document.createElement("button");
  119. btn.textContent = "🔍 Filters";
  120. btn.style.marginLeft = "10px";
  121. btn.style.padding = "4px 10px";
  122. btn.style.fontSize = "13px";
  123. btn.style.fontFamily = FONT_FAMILY;
  124. btn.style.borderRadius = "4px";
  125. btn.style.border = "1px solid #ccc";
  126. btn.style.cursor = "pointer";
  127. btn.style.background = "#f5f5f5";
  128. btn.onclick = () => {
  129. panel.style.display = panel.style.display === "none" ? "block" : "none";
  130. };
  131. searchBar.parentElement.appendChild(btn);
  132. }
  133. }, 500);
  134.  
  135. // Apply button logic
  136. document.getElementById("rbx_apply").onclick = () => {
  137. const creator = document.getElementById("rbx_creator").value.trim();
  138. const genre = document.getElementById("rbx_genre").value;
  139.  
  140. const params = new URLSearchParams(window.location.search);
  141.  
  142. if (creator) {
  143. params.set("creatorName", creator);
  144. params.set("creatorType", "User");
  145. } else {
  146. params.delete("creatorName");
  147. params.delete("creatorType");
  148. }
  149.  
  150. if (genre) {
  151. params.set("Genre", genre);
  152. } else {
  153. params.delete("Genre");
  154. }
  155.  
  156. window.location.search = params.toString();
  157. };
  158.  
  159. // Theme toggle logic
  160. document.getElementById("rbx_theme").onclick = () => {
  161. currentTheme = currentTheme === "light" ? "dark" : "light";
  162. localStorage.setItem("rbx_filter_theme", currentTheme);
  163. applyTheme(panel, currentTheme);
  164. };
  165. })();