RoLocate

Adds filter options to roblox server page. Alternative to paid extensions like RoPro, RoGold (Ultimate), RoQol, and RoKit.

  1. // ==UserScript==
  2. // @name RoLocate
  3. // @namespace https://oqarshi.github.io/
  4. // @version 36.3
  5. // @description Adds filter options to roblox server page. Alternative to paid extensions like RoPro, RoGold (Ultimate), RoQol, and RoKit.
  6. // @author Oqarshi
  7. // @match https://www.roblox.com/*
  8. // @license CC-BY-4.0; https://creativecommons.org/licenses/by/4.0/
  9. // @icon data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSgBBwcHCggKEwoKEygaFhooKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKP/AABEIAEAAQAMBEQACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AOE714B+/wDUO9AdQoABQCExxTF0FNIbDHSgAxzQHUTjPSmLQv6HYJqmr21i9zHa+e4QSyA7VJ6Zx6nj8acY8ztc58VX+r0pVVHmsr2W503jH4e3/hWK1uLy4hltJpPLeaJWIiPuPpn8q1qUJU7Ns8vLM+o5i5QpxakleztqdBB8GdRnhSWHV7B4pFDKyqxDA8gjitfqknrc82XF1CDcZUpJr0HH4Kart41SxJ91f/Cj6nLuT/rjhv8An2/wOb8TfDfxBoFu9zNbx3Vqgy8ts2/aPUggHHvjFZTw84anq4LiHBYyShF8sn0en/AOM444rE9vQOM9KA0uL3pD6m34P0N/EWrvp8LbJ2gkkiPYuoyAfrjH41pThzuyODMccsDS9tJaXSfo2e2+CNSh8ceDrzQ9cDfb7Zfs9yrff4+7J9QR+Y9676UlVg4S3Pgs0w8spxscXhvglqu3mvT9GeT+JdV17RI4PDlxdXMEmlySKskUrJ5kbbSvQ8jgkezY7VxzlOHuN7H2OBw2ExbljYxTVRLRpOzV7/8AB9DCXxFrS4K6vqII7i5f/Gs/aS7ne8BhWtaUfuR6r8HfHOpajq/9iazO12ssbNDLJy4KjJUnuCM9fSuvDVpSfLI+R4kyWhQo/WsPHls9UttevlqcN8V9Fh0LxpdQWiBLaZVuI0HRQ2cge2QawxEFCbSPf4fxs8ZgoznrJaP5f8A5DvWB7fUO9Aa3O8+CP/JQLX/rjL/6Ca6ML/ER87xT/wAi+XqvzN/x1qv/AAh3xbTUrGPak0KPdRr0lDEhvx4B+ozWlWXsq3Mjzspwv9qZQ6FR6pvlfa239djf+L3h6HxJ4cg8RaRiWaCISFkH+tgPP5r1/OtcRTU488TzuHMfPAYmWBr6Ju3pL/g7fceERwyyr+6jd+3yqTzXn2P0GU1Fas9Z+Cvg/UoteTW9QtpLW2gRhEJVKtIzDHAPOACefpXZhqUubmZ8fxPm1CWHeFpSUpNq9uiWv3nM/GLVotW8cXJtnDxWyLbBhyCVyW/UkfhWWJkpTdj1eG8LPDYGPPo5Nv79vwOJ71znvdQ70B1O8+CP/JQbX/rjL/6Ca6ML/ER87xT/AMi+XqvzO28T6fb6r8arSxvU328+nMjr7FJOR7jrW84qVdJ9jwsBXnh8jlWpuzU0/wAYlj4a30/hzXb3wVrT7grNJZSN0dTyVHsRzj13CqoycJOlL5GWd0IY7DwzXD9dJLs/+Bt9xHppPw88fNp8hK+HtZbdAT92GT09sE4+hU9qUf3NS3RlVl/beX+2X8alv5r+tfW5ofGvUdd0zQ4ZdImENjIfKuXjX94uenzdgeRxznHPNViZTjH3djm4Yw+ExFdxrq81qu3np3Pnk9eteafpdg70B1E4z2pi0ud78Ecf8LBtf+uMv/oJrfC/xEfPcUW/s+XqvzPQdR/5L5pf/Xkf/QJK6X/vC9D5uj/yT9T/ABfrE5L453Etn49sLm2kMc8VpG6OOqsJHINY4ptVE0ezwpThVy+cJq6cmn9yO8ItPih8O8jYl8o/783Cj+Rz+TetdGlen5nzq9pkGY94fnF/qvzQeA9TTxb4WvdA19CdQtFNrdRv95h0D/UY6+oz3opS9pFwluh5vhnluLhjMK/cl70e3p6foeDeJtGn8P65dabdj95C+A2OHXqrD6ivPnBwk4s/Q8Fi6eNoRrw2f4PqjL4z2qTq0uL3pD6mv4V1+58NazHqVlFFJMisoWUErgjB6EVpTm6b5kcWYYGGPouhUbSdtvI2ZviBqc3jCDxG1tZi8hi8lYwreWRhhyN2c/Me9W68ufn6nDDIqEcHLApvlbvfS/Ty8uxmeMPE934r1OO+v4YIpUiEIWEELgEnuTzyaipUdR3Z15Zl1PLqTo0m2m762/4HYm8GeMNS8JT3EunLFIk6BXimBKkjoeCORz+dOnVlTehnmeU0MyhGNW6a2atctHx5qS+Lh4it7a0t7xk2Sxxq3lzDGPmBbPp0PYVXt5c/OjH+xKDwf1Kbbje6btdemn9XKvjTxbdeLLi3nv7O0hnhUoHgVgWXrg5Y9OcfU1NWq6mrRtlmV08ti4UpNp9Hb9EjnO9ZHqdQ70BrcO9Aa3CgNQFAK4namLWwppDdwoDUO9AdT//Z
  10. // @grant GM_xmlhttpRequest
  11. // @grant GM_getValue
  12. // @grant GM_listValues
  13. // @grant GM_setValue
  14. // @grant GM_deleteValue
  15. // @require https://update.greasyfork.org/scripts/535590/1586769/Rolocate%20Base64%20Image%20Library%2020.js
  16. // ==/UserScript==
  17.  
  18.  
  19.  
  20. (function() {
  21. 'use strict';
  22.  
  23.  
  24.  
  25. function initializeLocalStorage() {
  26. // Define default settings
  27. const defaultSettings = {
  28. enableLogs: false, // disabled by default
  29. removeads: false, // disabled by default
  30. togglefilterserversbutton: true, // enable by default
  31. toggleserverhopbutton: true, // enable by default
  32. AutoRunServerRegions: false, // disabled by default
  33. ShowOldGreeting: false, // disabled by default
  34. togglerecentserverbutton: true, // enable by default
  35. quicknav: false, // disabled by default
  36. prioritylocation: "automatic", // automatic by default
  37. fastservers: false, // disabled by default
  38. };
  39.  
  40. // Loop through default settings and set them in localStorage if they don't exist
  41. Object.entries(defaultSettings).forEach(([key, value]) => {
  42. const storageKey = `ROLOCATE_${key}`;
  43. if (localStorage.getItem(storageKey) === null) {
  44. localStorage.setItem(storageKey, value);
  45. }
  46. });
  47. }
  48.  
  49. //// testing for locations not in production
  50. //(async () => {
  51. // ConsoleLogEnabled("[GM Storage Dump] --- Start ---");
  52. // const keys = await GM_listValues();
  53. // for (const key of keys) {
  54. // ConsoleLogEnabled(`[GM] ${key}:`, await GM_getValue(key));
  55. // }
  56. // ConsoleLogEnabled("[GM Storage Dump] --- End ---");
  57. //})();//
  58. //// testing for locations
  59. //(async () => {
  60. // const keys = await GM_listValues();
  61. // for (const key of keys) {
  62. // GM_deleteValue(key);
  63. // ConsoleLogEnabled(`Deleted ${key}`);
  64. // }
  65. //})();
  66.  
  67.  
  68. function initializeCoordinatesStorage() {
  69. // Check if coordinates are already stored
  70. try {
  71. const storedCoords = GM_getValue("ROLOCATE_coordinates");
  72. if (!storedCoords) {
  73. // Set default empty coordinates
  74. GM_setValue("ROLOCATE_coordinates", JSON.stringify({
  75. lat: "",
  76. lng: ""
  77. }));
  78. } else {
  79. // Validate existing coordinates
  80. const parsedCoords = JSON.parse(storedCoords);
  81. if ((!parsedCoords.lat || !parsedCoords.lng) && localStorage.getItem("ROLOCATE_prioritylocation") === "manual") {
  82. // If manual mode but no coordinates, revert to automatic
  83. localStorage.setItem("ROLOCATE_prioritylocation", "automatic");
  84. }
  85. }
  86. } catch (e) {
  87. ConsoleLogEnabled("Error initializing coordinates storage:", e);
  88. // Set default empty coordinates if parsing fails
  89. GM_setValue("ROLOCATE_coordinates", JSON.stringify({
  90. lat: "",
  91. lng: ""
  92. }));
  93. }
  94. }
  95.  
  96.  
  97. function getSettingsContent(section) {
  98. if (section === "home") {
  99. return `
  100. <div class="home-section">
  101. <img class="rolocate-logo" src="${window.Base64Images.logo}" alt="ROLOCATE Logo">
  102. <div class="version">Rolocate: Version 36.3</div>
  103. <div class="section-separator"></div>
  104. <p>Rolocate Settings Menu.</p>
  105. </div>
  106. `;
  107. }
  108.  
  109. if (section === "appearance") {
  110. return `
  111. <div class="appearance-section">
  112. <label class="toggle-slider section-hover">
  113. <input type="checkbox" id="ShowOldGreeting">
  114. <span class="slider"></span>
  115. Show Old Greeting
  116. </label>
  117. <div class="hint-text">
  118. <p>Restores the classic Roblox greeting style on your home page</p>
  119. </div>
  120. </div>
  121. `;
  122. }
  123.  
  124. if (section === "advanced") {
  125. return `
  126. <div class="advanced-section">
  127. <span class="warning_advanced">For Experienced Users Only🧠🙃</span>
  128. <div class="section-separator"></div>
  129.  
  130. <label class="toggle-slider section-hover">
  131. <input type="checkbox" id="enableLogs">
  132. <span class="slider"></span>
  133. Enable Console Logs
  134. </label>
  135.  
  136. <label class="toggle-slider section-hover">
  137. <input type="checkbox" id="togglefilterserversbutton">
  138. <span class="slider"></span>
  139. Enable Server Filters
  140. </label>
  141.  
  142. <label class="toggle-slider section-hover">
  143. <input type="checkbox" id="toggleserverhopbutton">
  144. <span class="slider"></span>
  145. Enable Server Hop Button
  146. </label>
  147.  
  148. <label class="toggle-slider section-hover experiment_label">
  149. <input type="checkbox" id="fastservers">
  150. <span class="slider"></span>
  151. Fast Server Search
  152. <span class="experimental">Experimental
  153. <span class="tooltip">Still being tested</span>
  154. </span>
  155. </label>
  156.  
  157.  
  158.  
  159. <div class="location-settings section-hover">
  160. <div class="setting-header">
  161. <span>Set Default Location Mode</span>
  162. <span class="help-icon" title="Choose how your location will be determined">?</span>
  163. </div>
  164.  
  165. <select id="prioritylocation-select">
  166. <option value="manual" style="color: rgb(255, 40, 40);">Manual</option>
  167. <option value="automatic" style="color: rgb(255, 40, 40);">Automatic</option>
  168. </select>
  169.  
  170. <div id="location-hint">
  171. <strong>Manual:</strong> Set your location manually below
  172. <strong>Automatic:</strong> Auto detect your device's location
  173. </div>
  174.  
  175. <div id="manual-coordinates" style="margin-top: 15px; display: none;">
  176. <div class="coordinates-inputs" style="display: flex; gap: 10px; margin-bottom: 12px;">
  177. <div style="flex: 1;">
  178. <label for="latitude" style="display: block; margin-bottom: 8px; font-size: 14px;">Latitude</label>
  179. <input type="text" id="latitude" placeholder="e.g. 40.7128"
  180. style="width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.05);; background: rgba(255,255,255,0.05); color: #e0e0e0;">
  181. </div>
  182. <div style="flex: 1;">
  183. <label for="longitude" style="display: block; margin-bottom: 8px; font-size: 14px;">Longitude</label>
  184. <input type="text" id="longitude" placeholder="e.g. -74.0060"
  185. style="width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.05);; background: rgba(255,255,255,0.05); color: #e0e0e0;">
  186. </div>
  187. </div>
  188. <button id="save-coordinates" class="edit-nav-button" style="width: 100%; margin-top: 8px;">
  189. Save Coordinates
  190. </button>
  191. <div class="hint-text" style="margin-top: 12px; font-size: 13px; color: #a0a0a0;">
  192. Enter your location's decimal coordinates, or if you're not comfortable sharing them, use the nearest Roblox server coordinates (e.g., Los Angeles: 34.0549, -118.2426).
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. `;
  198. }
  199.  
  200. if (section === "about") {
  201. return `
  202. <div class="about-section">
  203. <div class="section-separator"></div>
  204. <h3 class="red-accent">Credits:</h3>
  205. <p>This project was created by:</p>
  206. <ul>
  207. <li><strong>Developer:</strong> <a href="https://www.roblox.com/users/545334824/profile" target="_blank" style="text-decoration: underline; color: #007bff;">Oqarshi</a></li>
  208. <li><strong>Rolocate Source Code:</strong> <a href="https://greasyfork.org/en/scripts/523727-rolocate/code" target="_blank" style="text-decoration: underline; color: #007bff;">GreasyFork</a></li>
  209. <li><strong>Invite & FAQ Source Code:</strong> <a href="https://github.com/Oqarshi/Invite" target="_blank" style="text-decoration: underline; color: #007bff;">GitHub</a></li>
  210. <li><strong>FAQ Website:</strong> <a href="https://oqarshi.github.io/Invite/rolocate/index.html" target="_blank" style="text-decoration: underline; color: #007bff;">RoLocate FAQ</a></li>
  211. <li><strong>Suggest or Report Issues:</strong> <a href="https://greasyfork.org/en/scripts/523727-rolocate/feedback" target="_blank" style="text-decoration: underline; color: #007bff;">Submit Feedback</a></li>
  212. <li><strong>Inspiration:</strong> <a href="https://chromewebstore.google.com/detail/btroblox-making-roblox-be/hbkpclpemjeibhioopcebchdmohaieln" target="_blank" style="text-decoration: underline; color: #007bff;">Btroblox Team</a></li>
  213. </ul>
  214. </div>
  215. `;
  216. }
  217.  
  218. if (section === "help") {
  219. return `
  220. <div class="help-section">
  221. <div class="section-separator"></div>
  222. <h3 class="red-accent">General Tab</h3>
  223. <ul>
  224. <li><strong>Auto Run Server Regions:</strong> <span>Replaces Roblox's 8 default servers with at least 8 servers, providing detailed info such as location and ping.</span></li>
  225. <li><strong>Remove All Roblox Ads:</strong> <span>Blocks most ads on the Roblox site.</span></li>
  226. <li><strong>Recent Servers:</strong> <span>Shows the most recent servers you have joined in the past 3 days.</span></li>
  227. <li><strong>Quick Navigation:</strong> <span>Ability to add quick navigations to the leftside panel of the Roblox page.</span></li>
  228. </ul>
  229.  
  230. <div class="section-separator"></div>
  231.  
  232. <h3 class="red-accent">Appearance Tab</h3>
  233. <ul>
  234. <li><strong>Show Old Greeting:</strong> <span>Shows the old greeting Roblox had on their home page.</span></li>
  235. </ul>
  236.  
  237. <div class="section-separator"></div>
  238.  
  239. <h3 class="red-accent">Advanced Tab</h3>
  240. <ul>
  241. <li><strong>Enable Console Logs:</strong> <span>Enables console.log messages from the script.</span></li>
  242. <li><strong>Enable Server Filters:</strong> <span>Enables server filter features on the game page.</span></li>
  243. <li><strong>Enable Server Hop Button:</strong> <span>Enables server hop feature on the game page.</span></li>
  244. <li><strong>Fast Server Search:</strong> <span>Increases the speed of searching for server locations up to 100x. Still experimental.</span></li>
  245. <li><strong>Set default location:</strong> <span>Enables the user to set a default location for Roblox server regions. Turn this on if the script cannot automatically detect your location.</span></li>
  246. </ul>
  247. </div>
  248. `;
  249. }
  250.  
  251. // General tab (default)
  252. return `
  253. <div class="general-section">
  254. <label class="toggle-slider section-hover">
  255. <input type="checkbox" id="AutoRunServerRegions">
  256. <span class="slider"></span>
  257. Auto Run Server Regions
  258. </label>
  259.  
  260. <label class="toggle-slider section-hover">
  261. <input type="checkbox" id="removeads">
  262. <span class="slider"></span>
  263. Remove All Roblox Ads
  264. </label>
  265.  
  266. <label class="toggle-slider section-hover">
  267. <input type="checkbox" id="togglerecentserverbutton">
  268. <span class="slider"></span>
  269. Recent Servers
  270. </label>
  271.  
  272. <div class="quicknav-container section-hover">
  273. <label class="toggle-slider slider-element">
  274. <input type="checkbox" id="quicknav">
  275. <span class="slider"></span>
  276. Quick Navigation
  277. </label>
  278. <button id="edit-quicknav-btn" class="edit-nav-button">
  279. Edit Quick Nav
  280. </button>
  281. </div>
  282. </div>
  283. `;
  284. }
  285.  
  286.  
  287. function openSettingsMenu() {
  288. if (document.getElementById("userscript-settings-menu")) return;
  289.  
  290. // Initialize localStorage with default values if they don't exist
  291. initializeLocalStorage();
  292. initializeCoordinatesStorage();
  293.  
  294. // Create overlay
  295. const overlay = document.createElement("div");
  296. overlay.id = "userscript-settings-menu";
  297. overlay.innerHTML = `
  298. <div class="settings-container">
  299. <button id="close-settings" class="close-hover">✖</button>
  300. <div class="settings-sidebar">
  301. <h2>RoLocate</h2>
  302. <ul>
  303. <li class="active" data-section="home">🏠 Home</li>
  304. <li data-section="general">⚙️ General</li>
  305. <li data-section="appearance">🎨 Appearance</li>
  306. <li data-section="advanced">🚀 Advanced</li>
  307. <li data-section="help">📙 Help</li>
  308. <li data-section="about">ℹ️ About</li>
  309. </ul>
  310. </div>
  311. <div class="settings-content">
  312. <h2 id="settings-title">Home</h2>
  313. <div id="settings-body" class="animated-content">${getSettingsContent("home")}</div>
  314. </div>
  315. </div>
  316. `;
  317.  
  318. document.body.appendChild(overlay);
  319.  
  320. // Inject CSS styles
  321. const style = document.createElement("style");
  322. style.textContent = `
  323. .experiment_label .experimental {
  324. margin-left: 8px;
  325. color: gold;
  326. font-size: 12px;
  327. font-weight: bold;
  328. background-color: rgba(255, 215, 0, 0.1);
  329. padding: 2px 6px;
  330. border-radius: 3px;
  331. position: relative; /* Needed for positioning the tooltip */
  332. z-index: 10001;
  333. }
  334.  
  335. .experiment_label .tooltip {
  336. visibility: hidden;
  337. background-color: rgba(0, 0, 0, 0.7);
  338. color: #fff;
  339. font-size: 12px;
  340. padding: 6px;
  341. border-radius: 5px;
  342. position: absolute;
  343. top: 100%;
  344. left: 50%;
  345. transform: translateX(-50%);
  346. white-space: nowrap;
  347. z-index: 10001;
  348. opacity: 0;
  349. transition: opacity 0.3s;
  350. }
  351.  
  352. .experiment_label .experimental:hover .tooltip {
  353. visibility: visible;
  354. opacity: 1;
  355. z-index: 10001;
  356. }
  357.  
  358.  
  359. @keyframes fadeIn {
  360. from { opacity: 0; transform: scale(0.96); }
  361. to { opacity: 1; transform: scale(1); }
  362. }
  363.  
  364. @keyframes fadeOut {
  365. from { opacity: 1; transform: scale(1); }
  366. to { opacity: 0; transform: scale(0.96); }
  367. }
  368.  
  369. @keyframes sectionFade {
  370. from { opacity: 0; transform: translateY(12px); }
  371. to { opacity: 1; transform: translateY(0); }
  372. }
  373.  
  374. @keyframes slideIn {
  375. from { transform: translateX(-20px); opacity: 0; }
  376. to { transform: translateX(0); opacity: 1; }
  377. }
  378.  
  379. #userscript-settings-menu {
  380. position: fixed;
  381. top: 0; left: 0;
  382. width: 100vw; height: 100vh;
  383. background: rgba(0,0,0,0.6);
  384. display: flex;
  385. align-items: center;
  386. justify-content: center;
  387. z-index: 10000;
  388. animation: fadeIn 0.7s cubic-bezier(0.19, 1, 0.22, 1);
  389. }
  390.  
  391. .settings-container {
  392. display: flex;
  393. position: relative;
  394. width: 580px; /* Reduced from 680px */
  395. height: 420px; /* Reduced from 480px */
  396. background: linear-gradient(145deg, #1a1a1a, #232323);
  397. border-radius: 12px; /* Slightly smaller radius */
  398. overflow: hidden;
  399. box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7);
  400. font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  401. border: 1px solid rgba(255, 255, 255, 0.05);
  402. }
  403.  
  404. #close-settings {
  405. position: absolute;
  406. top: 12px; /* Reduced from 16px */
  407. right: 12px; /* Reduced from 16px */
  408. background: transparent;
  409. border: none;
  410. color: #c0c0c0;
  411. font-size: 20px; /* Reduced from 22px */
  412. cursor: pointer;
  413. z-index: 10001;
  414. transition: all 0.5s ease;
  415. width: 30px; /* Reduced from 34px */
  416. height: 30px; /* Reduced from 34px */
  417. border-radius: 50%;
  418. display: flex;
  419. align-items: center;
  420. justify-content: center;
  421. }
  422.  
  423. #close-settings:hover {
  424. color: #ff3b47;
  425. background: rgba(255, 59, 71, 0.1);
  426. transform: rotate(90deg);
  427. }
  428.  
  429. .settings-sidebar {
  430. width: 32%; /* Reduced from 35% */
  431. background: #272727;
  432. padding: 18px 12px; /* Reduced from 24px 15px */
  433. color: white;
  434. display: flex;
  435. flex-direction: column;
  436. align-items: center;
  437. box-shadow: 6px 0 12px -6px rgba(0,0,0,0.3);
  438. position: relative;
  439. overflow: hidden;
  440. }
  441.  
  442. .settings-sidebar h2 {
  443. margin-bottom: 16px; /* Reduced from 20px */
  444. font-weight: 600;
  445. font-size: 22px; /* Reduced from 24px */
  446. text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  447. text-decoration: none;
  448. position: relative;
  449. text-align: center;
  450. }
  451.  
  452. .settings-sidebar h2::after {
  453. content: "";
  454. position: absolute;
  455. left: 50%;
  456. transform: translateX(-50%);
  457. bottom: -6px; /* Reduced from -8px */
  458. width: 36px; /* Reduced from 40px */
  459. height: 3px;
  460. background: white;
  461. border-radius: 2px;
  462. }
  463.  
  464. .settings-sidebar ul {
  465. list-style: none;
  466. padding: 0;
  467. width: 100%;
  468. margin-top: 5px; /* Reduced from 10px */
  469. }
  470.  
  471. .settings-sidebar li {
  472. padding: 10px 12px; /* Reduced from 14px */
  473. margin: 6px 0; /* Reduced from 8px 0 */
  474. text-align: left;
  475. cursor: pointer;
  476. transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  477. border-radius: 8px;
  478. font-weight: 500;
  479. font-size: 17px; /* increased from 15px */
  480. position: relative;
  481. animation: slideIn 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  482. animation-fill-mode: both;
  483. display: flex;
  484. align-items: center;
  485. }
  486.  
  487. .settings-sidebar li:hover {
  488. background: #444;
  489. transform: translateX(5px);
  490. }
  491.  
  492. .settings-sidebar .active {
  493. background: #444;
  494. color: white;
  495. transform: translateX(0);
  496. }
  497.  
  498. .settings-sidebar .active:hover {
  499. transform: translateX(0);
  500. }
  501.  
  502. .settings-sidebar li:hover::before {
  503. height: 100%;
  504. }
  505.  
  506. .settings-sidebar .active::before {
  507. background: #dc3545;
  508. }
  509.  
  510. /* Custom Scrollbar */
  511. .settings-content {
  512. flex: 1;
  513. padding: 24px; /* Reduced from 32px */
  514. color: white;
  515. text-align: center;
  516. max-height: 100%;
  517. overflow-y: auto;
  518. scrollbar-width: thin;
  519. scrollbar-color: darkgreen black;
  520. background: #1e1e1e;
  521. position: relative;
  522. }
  523.  
  524. /* Webkit (Chrome, Safari) Scrollbar */
  525. .settings-content::-webkit-scrollbar {
  526. width: 6px; /* Reduced from 8px */
  527. }
  528. .settings-content::-webkit-scrollbar-track {
  529. background: #333;
  530. border-radius: 3px; /* Reduced from 4px */
  531. }
  532. .settings-content::-webkit-scrollbar-thumb {
  533. background: linear-gradient(180deg, #dc3545, #b02a37);
  534. border-radius: 3px; /* Reduced from 4px */
  535. }
  536. .settings-content::-webkit-scrollbar-thumb:hover {
  537. background: linear-gradient(180deg, #ff3b47, #dc3545);
  538. }
  539.  
  540. .settings-content h2 {
  541. margin-bottom: 24px; /* Reduced from 30px */
  542. font-weight: 600;
  543. font-size: 22px; /* Reduced from 24px */
  544. color: white;
  545. text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  546. letter-spacing: 0.5px;
  547. position: relative;
  548. display: inline-block;
  549. padding-bottom: 6px; /* Reduced from 8px */
  550. }
  551.  
  552. .settings-content h2::after {
  553. content: "";
  554. position: absolute;
  555. bottom: 0;
  556. left: 0;
  557. width: 100%;
  558. height: 2px;
  559. background: white;
  560. border-radius: 2px;
  561. }
  562.  
  563. .settings-content div {
  564. animation: sectionFade 0.7s cubic-bezier(0.19, 1, 0.22, 1);
  565. }
  566.  
  567. /* Toggle Slider Styles */
  568. .toggle-slider {
  569. display: flex;
  570. align-items: center;
  571. margin: 12px 0; /* Reduced from 16px 0 */
  572. cursor: pointer;
  573. padding: 8px 14px; /* Reduced from 10px 16px */
  574. background: rgba(255, 255, 255, 0.03);
  575. border-radius: 6px; /* Reduced from 8px */
  576. transition: all 0.5s ease;
  577. user-select: none;
  578. border: 1px solid rgba(255, 255, 255, 0.05);
  579. }
  580.  
  581. .toggle-slider:hover {
  582. background: rgba(255, 255, 255, 0.05);
  583. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  584. transform: translateY(-2px);
  585. }
  586.  
  587. .toggle-slider input {
  588. display: none;
  589. }
  590.  
  591. .toggle-slider .slider {
  592. position: relative;
  593. display: inline-block;
  594. width: 42px; /* Reduced from 48px */
  595. height: 22px; /* Reduced from 24px */
  596. background-color: rgba(255, 255, 255, 0.2);
  597. border-radius: 22px;
  598. margin-right: 12px; /* Reduced from 14px */
  599. transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  600. box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
  601. }
  602.  
  603. .toggle-slider .slider::before {
  604. content: "";
  605. position: absolute;
  606. height: 16px; /* Reduced from 18px */
  607. width: 16px; /* Reduced from 18px */
  608. left: 3px;
  609. bottom: 3px;
  610. background-color: white;
  611. border-radius: 50%;
  612. transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  613. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  614. }
  615.  
  616. .toggle-slider input:checked + .slider {
  617. background-color: #4CAF50;
  618. box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.05), inset 0 1px 3px rgba(0, 0, 0, 0.2);
  619. }
  620.  
  621. .toggle-slider input:checked + .slider::before {
  622. transform: translateX(20px); /* Reduced from 24px */
  623. }
  624.  
  625. .toggle-slider input:checked + .slider::after {
  626. opacity: 1;
  627. }
  628.  
  629. .rolocate-logo {
  630. width: 90px !important; /* Reduced from 110px */
  631. height: 90px !important; /* Reduced from 110px */
  632. object-fit: contain;
  633. border-radius: 14px; /* Reduced from 16px */
  634. display: block;
  635. margin: 0 auto 16px auto; /* Reduced from 20px */
  636. box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  637. transition: all 0.5s ease;
  638. border: 2px solid rgba(220, 53, 69, 0.4);
  639. }
  640.  
  641. .rolocate-logo:hover {
  642. transform: scale(1.05);
  643. }
  644.  
  645. .version {
  646. font-size: 13px; /* Reduced from 14px */
  647. color: #aaa;
  648. margin-bottom: 24px; /* Reduced from 30px */
  649. display: inline-block;
  650. padding: 5px 14px; /* Reduced from 6px 16px */
  651. background: rgba(220, 53, 69, 0.1);
  652. border-radius: 18px; /* Reduced from 20px */
  653. border: 1px solid rgba(220, 53, 69, 0.2);
  654. }
  655.  
  656. .settings-content ul {
  657. text-align: left;
  658. list-style-type: none;
  659. padding: 0;
  660. margin-top: 16px; /* Reduced from 20px */
  661. }
  662.  
  663. .settings-content ul li {
  664. margin: 12px 0; /* Reduced from 16px 0 */
  665. padding: 10px 14px; /* Reduced from 12px 16px */
  666. background: rgba(255, 255, 255, 0.03);
  667. border-radius: 6px; /* Reduced from 8px */
  668. transition: all 0.4s ease;
  669. }
  670.  
  671. .settings-content ul li:hover {
  672. background: rgba(255, 255, 255, 0.05);
  673. border-left: 3px solid #4CAF50;
  674. transform: translateX(5px);
  675. }
  676.  
  677. .settings-content ul li strong {
  678. color: #4CAF50;
  679. }
  680.  
  681. .warning_advanced {
  682. font-size: 14px; /* Reduced from 16px */
  683. color: #ff3b47;
  684. font-weight: bold;
  685. padding: 8px 14px; /* Reduced from 10px 16px */
  686. background: rgba(220, 53, 69, 0.1);
  687. border-radius: 6px;
  688. margin-bottom: 16px; /* Reduced from 20px */
  689. display: inline-block;
  690. border: 1px solid rgba(220, 53, 69, 0.2);
  691. }
  692.  
  693. .average_text {
  694. font-size: 16px; /* Reduced from 18px */
  695. color: #e0e0e0;
  696. font-weight: 500;
  697. margin-top: 12px; /* Reduced from 15px */
  698. line-height: 1.5;
  699. letter-spacing: 0.3px;
  700. background: linear-gradient(90deg, #ff3b47, #ff6b74);
  701. -webkit-background-clip: text;
  702. -webkit-text-fill-color: transparent;
  703. display: inline-block;
  704. }
  705.  
  706. .quicknav-container {
  707. display: flex;
  708. align-items: center;
  709. gap: 12px; /* Reduced from 16px */
  710. margin: 16px 0; /* Reduced from 20px 0 */
  711. flex-wrap: wrap;
  712. }
  713.  
  714. .edit-nav-button {
  715. padding: 6px 14px; /* Reduced from 8px 16px */
  716. background: #4CAF50;
  717. color: white;
  718. border: none;
  719. border-radius: 6px; /* Reduced from 8px */
  720. cursor: pointer;
  721. font-family: 'Inter', 'Helvetica', sans-serif;
  722. font-size: 12px; /* Reduced from 13px */
  723. font-weight: 600;
  724. letter-spacing: 0.5px;
  725. text-transform: uppercase;
  726. transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  727. height: auto;
  728. line-height: 1.5;
  729. position: relative;
  730. overflow: hidden;
  731. }
  732.  
  733. .edit-nav-button:hover {
  734. transform: translateY(-3px);
  735. background: linear-gradient(135deg, #1e8449 0%, #196f3d 100%);
  736. }
  737.  
  738. .edit-nav-button:hover::before {
  739. left: 100%;
  740. }
  741.  
  742. .edit-nav-button:active {
  743. background: linear-gradient(135deg, #1e8449 0%, #196f3d 100%);
  744. transform: translateY(1px);
  745. }
  746.  
  747. /* Dropdown styling */
  748. select {
  749. width: 100%;
  750. padding: 10px 14px; /* Reduced from 12px 16px */
  751. border-radius: 6px; /* Reduced from 8px */
  752. background: rgba(255, 255, 255, 0.05);
  753. color: #e0e0e0;
  754. font-size: 14px; /* Reduced from 14px */
  755. appearance: none;
  756. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23dc3545" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
  757. background-repeat: no-repeat;
  758. background-position: right 14px center;
  759. background-size: 14px;
  760. transition: all 0.5s ease;
  761. cursor: pointer;
  762. box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  763. border-color: rgba(255, 255, 255, 0.05);
  764. }
  765.  
  766. /* Dropdown hint styling */
  767. #location-hint {
  768. margin-top: 10px; /* Reduced from 12px */
  769. font-size: 12px; /* Reduced from 13px */
  770. color: #c0c0c0;
  771. background: rgba(255, 255, 255, 0.05);
  772. border-radius: 6px; /* Reduced from 8px */
  773. padding: 10px 14px; /* Reduced from 12px 16px */
  774. border: 1px solid rgba(255, 255, 255, 0.05);
  775. line-height: 1.6;
  776. transition: all 0.5s ease;
  777. }
  778.  
  779. /* Section separator */
  780. .section-separator {
  781. width: 100%;
  782. height: 1px;
  783. background: linear-gradient(90deg, transparent, #272727, transparent);
  784. margin: 24px 0; /* Reduced from 30px 0 */
  785. }
  786.  
  787.  
  788. /* Help section styles */
  789. .help-section h3, .about-section h3 {
  790. color: white;
  791. margin-top: 20px; /* Reduced from 25px */
  792. margin-bottom: 12px; /* Reduced from 15px */
  793. font-size: 16px; /* Reduced from 18px */
  794. text-align: left;
  795. }
  796.  
  797. /* Hint text styling */
  798. .hint-text {
  799. font-size: 13px; /* Reduced from 14px */
  800. color: #a0a0a0;
  801. margin-top: 6px; /* Reduced from 8px */
  802. margin-left: 16px; /* Reduced from 20px */
  803. text-align: left;
  804. }
  805.  
  806. /* Location settings styling */
  807. .location-settings {
  808. background: rgba(255, 255, 255, 0.03);
  809. border-radius: 6px; /* Reduced from 8px */
  810. padding: 14px; /* Reduced from 16px */
  811. margin-top: 16px; /* Reduced from 20px */
  812. border: 1px solid rgba(255, 255, 255, 0.05);
  813. transition: all 0.5s ease;
  814. }
  815.  
  816. .setting-header {
  817. display: flex;
  818. justify-content: space-between;
  819. align-items: center;
  820. margin-bottom: 10px; /* Reduced from 12px */
  821. }
  822.  
  823. .setting-header span {
  824. font-size: 14px; /* Reduced from 15px */
  825. font-weight: 500;
  826. }
  827.  
  828. .help-icon {
  829. display: inline-flex;
  830. align-items: center;
  831. justify-content: center;
  832. width: 18px; /* Reduced from 20px */
  833. height: 18px; /* Reduced from 20px */
  834. background: rgba(220, 53, 69, 0.2);
  835. border-radius: 50%;
  836. font-size: 11px; /* Reduced from 12px */
  837. color: #ff3b47;
  838. cursor: help;
  839. transition: all 0.5s ease;
  840. }
  841.  
  842. /* Manual coordinates input styling */
  843. #manual-coordinates {
  844. margin-top: 12px !important; /* Reduced from 15px */
  845. }
  846.  
  847. .coordinates-inputs {
  848. gap: 8px !important; /* Reduced from 10px */
  849. margin-bottom: 10px !important; /* Reduced from 12px */
  850. }
  851.  
  852. #manual-coordinates input {
  853. padding: 8px 10px !important; /* Reduced from 10px 12px */
  854. border-radius: 6px !important; /* Reduced from 8px */
  855. font-size: 13px !important; /* Reduced from default */
  856. }
  857.  
  858. #manual-coordinates label {
  859. margin-bottom: 6px !important; /* Reduced from 8px */
  860. font-size: 13px !important; /* Reduced from 14px */
  861. }
  862.  
  863. #save-coordinates {
  864. margin-top: 6px !important; /* Reduced from 8px */
  865. }
  866.  
  867. /* Animated content */
  868. .animated-content {
  869. animation: sectionFade 0.7s cubic-bezier(0.19, 1, 0.22, 1);
  870. }
  871. `;
  872.  
  873. document.head.appendChild(style);
  874.  
  875. // Enhanced sidebar navigation with animation
  876. document.querySelectorAll(".settings-sidebar li").forEach((li, index) => {
  877. // Add staggered animation delay
  878. li.style.animationDelay = `${0.05 * (index + 1)}s`;
  879.  
  880. li.addEventListener("click", function() {
  881. const currentActive = document.querySelector(".settings-sidebar .active");
  882. if (currentActive) currentActive.classList.remove("active");
  883. this.classList.add("active");
  884.  
  885. const section = this.getAttribute("data-section");
  886. const settingsBody = document.getElementById("settings-body");
  887. const settingsTitle = document.getElementById("settings-title");
  888.  
  889. // Apply fade-out animation
  890. settingsBody.style.opacity = "0";
  891. settingsBody.style.transform = "translateY(10px)";
  892. settingsTitle.style.opacity = "0";
  893. settingsTitle.style.transform = "translateY(10px)";
  894.  
  895. setTimeout(() => {
  896. // Update content
  897. settingsTitle.textContent = section.charAt(0).toUpperCase() + section.slice(1);
  898. settingsBody.innerHTML = getSettingsContent(section);
  899.  
  900. // Show the edit button when Quick Nav is checked
  901. if (section === "general") {
  902. const quickNavCheckbox = document.getElementById("quicknav");
  903. const editButton = document.getElementById("edit-quicknav-btn");
  904.  
  905. if (quickNavCheckbox && editButton) {
  906. // Initialize button visibility
  907. editButton.style.display = localStorage.getItem("ROLOCATE_quicknav") === "true" ? "block" : "none";
  908.  
  909. // Update button visibility when checkbox changes
  910. quickNavCheckbox.addEventListener("change", function() {
  911. editButton.style.display = this.checked ? "block" : "none";
  912. });
  913. }
  914. }
  915.  
  916. // Apply fade-in animation
  917. settingsBody.style.transition = "all 0.4s cubic-bezier(0.19, 1, 0.22, 1)";
  918. settingsTitle.style.transition = "all 0.4s cubic-bezier(0.19, 1, 0.22, 1)";
  919.  
  920. // Trigger reflow to restart animation
  921. void settingsBody.offsetWidth;
  922. void settingsTitle.offsetWidth;
  923.  
  924. settingsBody.style.opacity = "1";
  925. settingsBody.style.transform = "translateY(0)";
  926. settingsTitle.style.opacity = "1";
  927. settingsTitle.style.transform = "translateY(0)";
  928.  
  929. // Apply stored settings to ensure toggles match localStorage
  930. applyStoredSettings();
  931. }, 200);
  932. });
  933. });
  934.  
  935. // Close button with enhanced animation
  936. document.getElementById("close-settings").addEventListener("click", function() {
  937. // Check if manual mode is selected with empty coordinates
  938. const priorityLocation = localStorage.getItem("ROLOCATE_prioritylocation");
  939. if (priorityLocation === "manual") {
  940. try {
  941. const coords = JSON.parse(GM_getValue("ROLOCATE_coordinates", '{"lat":"","lng":""}'));
  942. if (!coords.lat || !coords.lng) {
  943. notifications('Please set the latitude and longitude values for the manual location, or set it to automatic.', 'error', '⚠️', 8000);
  944. return; // Prevent closing
  945. }
  946. } catch (e) {
  947. ConsoleLogEnabled("Error checking coordinates:", e);
  948. notifications('Error checking location settings', 'error', '⚠️', 8000);
  949. return; // Prevent closing
  950. }
  951. }
  952.  
  953. // Proceed with closing if validation passes
  954. const menu = document.getElementById("userscript-settings-menu");
  955. menu.style.animation = "fadeOut 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards";
  956.  
  957. // Add rotation to close button when closing
  958. this.style.transform = "rotate(90deg)";
  959.  
  960. setTimeout(() => menu.remove(), 400);
  961. });
  962.  
  963. // Apply stored settings immediately when opened
  964. applyStoredSettings();
  965.  
  966. // Add "Edit Quick Nav" button functionality
  967. setTimeout(() => {
  968. const editButton = document.getElementById("edit-quicknav-btn");
  969. if (editButton) {
  970. // Initialize button visibility
  971. const quickNavEnabled = localStorage.getItem("ROLOCATE_quicknav") === "true";
  972. editButton.style.display = quickNavEnabled ? "block" : "none";
  973.  
  974. // Add click handler for edit button
  975. editButton.addEventListener("click", function() {
  976. // Here you'd open a modal or implement the edit quick nav functionality
  977. alert("Quick Navigation Editor will open here!");
  978. // Alternatively, implement a proper modal for editing quick nav links
  979. });
  980. }
  981. }, 100);
  982.  
  983. // Add ripple effect to buttons
  984. const buttons = document.querySelectorAll(".edit-nav-button, .settings-button");
  985. buttons.forEach(button => {
  986. button.addEventListener("mousedown", function(e) {
  987. const ripple = document.createElement("span");
  988. const rect = this.getBoundingClientRect();
  989.  
  990. const size = Math.max(rect.width, rect.height);
  991. const x = e.clientX - rect.left - size / 2;
  992. const y = e.clientY - rect.top - size / 2;
  993.  
  994. ripple.style.cssText = `
  995. position: absolute;
  996. background: rgba(255,255,255,0.4);
  997. border-radius: 50%;
  998. pointer-events: none;
  999. width: ${size}px;
  1000. height: ${size}px;
  1001. top: ${y}px;
  1002. left: ${x}px;
  1003. transform: scale(0);
  1004. transition: transform 0.6s, opacity 0.6s;
  1005. `;
  1006.  
  1007. this.appendChild(ripple);
  1008.  
  1009. setTimeout(() => {
  1010. ripple.style.transform = "scale(2)";
  1011. ripple.style.opacity = "0";
  1012. setTimeout(() => ripple.remove(), 600);
  1013. }, 10);
  1014. });
  1015. });
  1016. }
  1017.  
  1018.  
  1019. function showQuickNavPopup() {
  1020. // Remove existing quick nav if it exists
  1021. const existingNav = document.getElementById("premium-quick-nav");
  1022. if (existingNav) existingNav.remove();
  1023.  
  1024. // POPUP CREATION
  1025. // Create overlay
  1026. const overlay = document.createElement("div");
  1027. overlay.id = "quicknav-overlay";
  1028. overlay.style.position = "fixed";
  1029. overlay.style.top = "0";
  1030. overlay.style.left = "0";
  1031. overlay.style.width = "100%";
  1032. overlay.style.height = "100%";
  1033. overlay.style.backgroundColor = "rgba(0,0,0,0)"; // Darker overlay for dark mode
  1034. overlay.style.backdropFilter = "blur(1px)";
  1035. overlay.style.zIndex = "10000";
  1036. overlay.style.opacity = "0";
  1037. overlay.style.transition = "opacity 0.3s ease";
  1038.  
  1039. // Create popup
  1040. const popup = document.createElement("div");
  1041. popup.id = "premium-quick-nav-popup";
  1042. popup.style.position = "fixed";
  1043. popup.style.top = "50%";
  1044. popup.style.left = "50%";
  1045. popup.style.transform = "translate(-50%, -50%) scale(0.95)";
  1046. popup.style.opacity = "0";
  1047. popup.style.background = "linear-gradient(145deg, #0a0a0a, #121212)"; // Darker background for dark mode
  1048. popup.style.color = "white";
  1049. popup.style.padding = "32px";
  1050. popup.style.borderRadius = "16px";
  1051. popup.style.boxShadow = "0 20px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05)";
  1052. popup.style.zIndex = "10001";
  1053. popup.style.width = "600px";
  1054. popup.style.maxWidth = "90%";
  1055. popup.style.maxHeight = "85vh";
  1056. popup.style.overflowY = "auto";
  1057. popup.style.transition = "transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease";
  1058.  
  1059. // Get saved quick navs (if any)
  1060. const saved = JSON.parse(localStorage.getItem("ROLOCATE_quicknav_settings") || "[]");
  1061.  
  1062. // Build header
  1063. const header = `
  1064. <div style="position: relative; margin-bottom: 24px; text-align: center;">
  1065. <h2 style="margin: 0 0 8px; font-size: 28px; font-weight: 600; background: linear-gradient(90deg, #4CAF50, #8BC34A); -webkit-background-clip: text; background-clip: text; color: transparent;">Quick Navigation</h2>
  1066. <p style="margin: 0; font-size: 16px; color: #a0a0a0; font-weight: 300;">Configure up to 9 custom navigation shortcuts</p>
  1067. <div style="width: 60px; height: 4px; background: linear-gradient(90deg, #4CAF50, #8BC34A); margin: 16px auto; border-radius: 2px;"></div>
  1068.  
  1069. <img src="${window.Base64Images.logo}" alt="Logo" style="position: absolute; bottom: -581px; left: 0; height: 40px; margin: 12px; border-radius: 12px; transition: all 0.3s ease-in-out; box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);"
  1070. onmouseover="this.style.transform='scale(1.2)'; this.style.boxShadow='0 0 15px rgba(255, 0, 0, 1)';"
  1071. onmouseout="this.style.transform='scale(1)'; this.style.boxShadow='0 0 10px rgba(255, 0, 0, 0.6)';" />
  1072. </div>
  1073. `;
  1074.  
  1075.  
  1076.  
  1077. // Build inputs for 9 links in a 3x3 grid
  1078. const inputsGrid = `
  1079. <div class="quicknav-inputs-grid" style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px;">
  1080. ${Array.from({length: 9}, (_, i) => `
  1081. <div class="quicknav-input-group" style="background: rgba(255,255,255,0.03); padding: 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05);">
  1082. <p style="font-weight: 500; font-size: 14px; margin: 0 0 8px; color: #A5D6A7;">${i + 1}</p>
  1083. <input type="text" id="quicknav-name-${i}" placeholder="Name" value="${saved[i]?.name || ""}"
  1084. style="width: 100%; padding: 10px 12px; margin-bottom: 8px; border-radius: 8px; border: none; background: rgba(255,255,255,0.05); color: white; font-size: 14px; transition: all 0.2s;">
  1085. <input type="text" id="quicknav-link-${i}" placeholder="URL" value="${saved[i]?.link || ""}"
  1086. style="width: 100%; padding: 10px 12px; border-radius: 8px; border: none; background: rgba(255,255,255,0.05); color: white; font-size: 14px; transition: all 0.2s;">
  1087. </div>
  1088. `).join("")}
  1089. </div>
  1090. `;
  1091.  
  1092. // Build footer with buttons
  1093. const footer = `
  1094. <div style="display: flex; justify-content: flex-end; gap: 12px;">
  1095. <button id="cancel-quicknav" style="background: transparent; color: #a0a0a0; border: 1px solid rgba(255,255,255,0.1); padding: 12px 20px; border-radius: 8px; cursor: pointer; font-weight: 500; transition: all 0.2s;">
  1096. Cancel
  1097. </button>
  1098. <button id="save-quicknav" style="background: linear-gradient(90deg, #4CAF50, #388E3C); color: white; border: none; padding: 12px 24px; border-radius: 8px; cursor: pointer; font-weight: 500; box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3); transition: all 0.2s;">
  1099. Save Changes
  1100. </button>
  1101. </div>
  1102. `;
  1103.  
  1104. // Combine all sections
  1105. popup.innerHTML = header + inputsGrid + footer;
  1106.  
  1107. // Add elements to DOM
  1108. document.body.appendChild(overlay);
  1109. document.body.appendChild(popup);
  1110.  
  1111. // POPUP EVENTS
  1112. // Add input hover and focus effects
  1113. popup.querySelectorAll('input').forEach(input => {
  1114. input.addEventListener('focus', () => {
  1115. input.style.background = 'rgba(255,255,255,0.1)';
  1116. input.style.boxShadow = '0 0 0 2px rgba(76, 175, 80, 0.4)';
  1117. });
  1118.  
  1119. input.addEventListener('blur', () => {
  1120. input.style.background = 'rgba(255,255,255,0.05)';
  1121. input.style.boxShadow = 'none';
  1122. });
  1123.  
  1124. input.addEventListener('mouseover', () => {
  1125. if (document.activeElement !== input) {
  1126. input.style.background = 'rgba(255,255,255,0.08)';
  1127. }
  1128. });
  1129.  
  1130. input.addEventListener('mouseout', () => {
  1131. if (document.activeElement !== input) {
  1132. input.style.background = 'rgba(255,255,255,0.05)';
  1133. }
  1134. });
  1135. });
  1136.  
  1137. // Add button hover effects
  1138. const saveBtn = popup.querySelector('#save-quicknav');
  1139. saveBtn.addEventListener('mouseover', () => {
  1140. saveBtn.style.background = 'linear-gradient(90deg, #66BB6A, #4CAF50)';
  1141. saveBtn.style.boxShadow = '0 4px 15px rgba(76, 175, 80, 0.4)';
  1142. saveBtn.style.transform = 'translateY(-1px)';
  1143. });
  1144.  
  1145. saveBtn.addEventListener('mouseout', () => {
  1146. saveBtn.style.background = 'linear-gradient(90deg, #4CAF50, #388E3C)';
  1147. saveBtn.style.boxShadow = '0 4px 12px rgba(76, 175, 80, 0.3)';
  1148. saveBtn.style.transform = 'translateY(0)';
  1149. });
  1150.  
  1151. const cancelBtn = popup.querySelector('#cancel-quicknav');
  1152. cancelBtn.addEventListener('mouseover', () => {
  1153. cancelBtn.style.background = 'rgba(255,255,255,0.05)';
  1154. });
  1155.  
  1156. cancelBtn.addEventListener('mouseout', () => {
  1157. cancelBtn.style.background = 'transparent';
  1158. });
  1159.  
  1160. // Animate in
  1161. setTimeout(() => {
  1162. overlay.style.opacity = "1";
  1163. popup.style.opacity = "1";
  1164. popup.style.transform = "translate(-50%, -50%) scale(1)";
  1165. }, 10);
  1166.  
  1167. // POPUP CLOSE FUNCTION
  1168. function closePopup() {
  1169. overlay.style.opacity = "0";
  1170. popup.style.opacity = "0";
  1171. popup.style.transform = "translate(-50%, -50%) scale(0.95)";
  1172. setTimeout(() => {
  1173. overlay.remove();
  1174. popup.remove();
  1175. }, 300);
  1176. }
  1177.  
  1178. // Save on click
  1179. popup.querySelector("#save-quicknav").addEventListener("click", () => {
  1180. const quickNavSettings = [];
  1181. for (let i = 0; i < 9; i++) {
  1182. const name = document.getElementById(`quicknav-name-${i}`).value.trim();
  1183. const link = document.getElementById(`quicknav-link-${i}`).value.trim();
  1184. if (name && link) {
  1185. quickNavSettings.push({
  1186. name,
  1187. link
  1188. });
  1189. }
  1190. }
  1191. localStorage.setItem("ROLOCATE_quicknav_settings", JSON.stringify(quickNavSettings));
  1192. closePopup();
  1193. });
  1194.  
  1195. // Cancel button
  1196. popup.querySelector("#cancel-quicknav").addEventListener("click", closePopup);
  1197.  
  1198. // Close when clicking overlay
  1199. overlay.addEventListener("click", (e) => {
  1200. if (e.target === overlay) {
  1201. closePopup();
  1202. }
  1203. });
  1204.  
  1205. // Close with ESC key
  1206. document.addEventListener("keydown", function escClose(e) {
  1207. if (e.key === "Escape") {
  1208. closePopup();
  1209. document.removeEventListener("keydown", escClose);
  1210. }
  1211. });
  1212.  
  1213. // AUTO-INIT AND KEYBOARD SHORTCUT
  1214. // Set up keyboard shortcut (Alt+Q)
  1215. document.addEventListener("keydown", function keyboardShortcut(e) {
  1216. if (e.altKey && e.key === "q") {
  1217. showQuickNavPopup();
  1218. }
  1219. });
  1220. }
  1221.  
  1222.  
  1223.  
  1224.  
  1225. function applyStoredSettings() {
  1226. // Handle all checkboxes
  1227. document.querySelectorAll("input[type='checkbox']").forEach(checkbox => {
  1228. const storageKey = `ROLOCATE_${checkbox.id}`;
  1229. const savedValue = localStorage.getItem(storageKey);
  1230. checkbox.checked = savedValue === "true";
  1231.  
  1232. checkbox.addEventListener("change", () => {
  1233. localStorage.setItem(storageKey, checkbox.checked);
  1234.  
  1235. if (checkbox.id === "quicknav") {
  1236. const editBtn = document.getElementById("edit-quicknav-btn");
  1237. if (editBtn) {
  1238. editBtn.style.display = checkbox.checked ? "inline-block" : "none";
  1239. }
  1240. }
  1241. });
  1242.  
  1243. if (checkbox.id === "quicknav" && checkbox.checked) {
  1244. const editBtn = document.getElementById("edit-quicknav-btn");
  1245. if (editBtn) {
  1246. editBtn.style.display = "inline-block";
  1247. }
  1248. }
  1249. });
  1250.  
  1251. // Handle dropdown for prioritylocation-select
  1252. const prioritySelect = document.getElementById("prioritylocation-select");
  1253. if (prioritySelect) {
  1254. const storageKey = "ROLOCATE_prioritylocation";
  1255. const savedValue = localStorage.getItem(storageKey) || "automatic";
  1256. prioritySelect.value = savedValue;
  1257.  
  1258. // Show/hide coordinates inputs based on selected value
  1259. const manualCoordinates = document.getElementById("manual-coordinates");
  1260. if (manualCoordinates) {
  1261. manualCoordinates.style.display = savedValue === "manual" ? "block" : "none";
  1262.  
  1263. // Set input values from stored coordinates if available
  1264. if (savedValue === "manual") {
  1265. try {
  1266. const savedCoords = JSON.parse(GM_getValue("ROLOCATE_coordinates", '{"lat":"","lng":""}'));
  1267. document.getElementById("latitude").value = savedCoords.lat || "";
  1268. document.getElementById("longitude").value = savedCoords.lng || "";
  1269.  
  1270. // If manual mode but no coordinates saved, revert to automatic
  1271. if (!savedCoords.lat || !savedCoords.lng) {
  1272. prioritySelect.value = "automatic";
  1273. localStorage.setItem(storageKey, "automatic");
  1274. manualCoordinates.style.display = "none";
  1275. }
  1276. } catch (e) {
  1277. ConsoleLogEnabled("Error loading saved coordinates:", e);
  1278. }
  1279. }
  1280. }
  1281.  
  1282. prioritySelect.addEventListener("change", () => {
  1283. const newValue = prioritySelect.value;
  1284. localStorage.setItem(storageKey, newValue);
  1285.  
  1286. // Show/hide coordinates inputs based on new value
  1287. if (manualCoordinates) {
  1288. manualCoordinates.style.display = newValue === "manual" ? "block" : "none";
  1289.  
  1290. // When switching to manual mode, load any saved coordinates
  1291. if (newValue === "manual") {
  1292. try {
  1293. const savedCoords = JSON.parse(GM_getValue("ROLOCATE_coordinates", '{"lat":"","lng":""}'));
  1294. document.getElementById("latitude").value = savedCoords.lat || "";
  1295. document.getElementById("longitude").value = savedCoords.lng || "";
  1296.  
  1297. // If no coordinates exist, keep the inputs empty
  1298. } catch (e) {
  1299. ConsoleLogEnabled("Error loading saved coordinates:", e);
  1300. }
  1301. }
  1302. }
  1303. });
  1304. }
  1305.  
  1306. // Button click handlers
  1307. const editQuickNavBtn = document.getElementById("edit-quicknav-btn");
  1308. if (editQuickNavBtn) {
  1309. editQuickNavBtn.addEventListener("click", () => {
  1310. showQuickNavPopup();
  1311. });
  1312. }
  1313.  
  1314. const fastServersToggle = document.getElementById("fastservers");
  1315. if (fastServersToggle) {
  1316. fastServersToggle.addEventListener("change", () => {
  1317. if (fastServersToggle.checked) {
  1318. notifications('Fast Server Search is currently experimental and may not function as intended.', 'info', '🧪', '30000')
  1319. }
  1320. });
  1321. }
  1322.  
  1323.  
  1324. // Save coordinates button handler
  1325. const saveCoordinatesBtn = document.getElementById("save-coordinates");
  1326. if (saveCoordinatesBtn) {
  1327. saveCoordinatesBtn.addEventListener("click", () => {
  1328. const latInput = document.getElementById("latitude");
  1329. const lngInput = document.getElementById("longitude");
  1330. const lat = latInput.value.trim();
  1331. const lng = lngInput.value.trim();
  1332.  
  1333. // If manual mode but no coordinates provided, revert to automatic
  1334. if (!lat || !lng) {
  1335. const prioritySelect = document.getElementById("prioritylocation-select");
  1336. if (prioritySelect) {
  1337. prioritySelect.value = "automatic";
  1338. localStorage.setItem("ROLOCATE_prioritylocation", "automatic");
  1339. document.getElementById("manual-coordinates").style.display = "none";
  1340.  
  1341. // show feedback to user even if they dont see it
  1342. saveCoordinatesBtn.textContent = "Reverted to Automatic!";
  1343. saveCoordinatesBtn.style.background = "#4CAF50";
  1344.  
  1345. setTimeout(() => {
  1346. saveCoordinatesBtn.textContent = "Save Coordinates";
  1347. saveCoordinatesBtn.style.background = "background: #4CAF50;";
  1348. }, 2000);
  1349. }
  1350. return;
  1351. }
  1352.  
  1353. // Validate coordinates
  1354. const latNum = parseFloat(lat);
  1355. const lngNum = parseFloat(lng);
  1356. if (isNaN(latNum) || isNaN(lngNum) || latNum < -90 || latNum > 90 || lngNum < -180 || lngNum > 180) {
  1357. alert("Invalid coordinates! Latitude must be between -90 and 90, and longitude between -180 and 180.");
  1358. return;
  1359. }
  1360.  
  1361. // Save valid coordinates
  1362. const coordinates = {
  1363. lat,
  1364. lng
  1365. };
  1366. GM_setValue("ROLOCATE_coordinates", JSON.stringify(coordinates));
  1367.  
  1368. // Ensure we're in manual mode
  1369. localStorage.setItem("ROLOCATE_prioritylocation", "manual");
  1370. if (prioritySelect) {
  1371. prioritySelect.value = "manual";
  1372. }
  1373.  
  1374. // Provide feedback
  1375. saveCoordinatesBtn.textContent = "Saved!";
  1376. saveCoordinatesBtn.style.background = "linear-gradient(135deg, #1e8449 0%, #196f3d 100%);";
  1377.  
  1378. setTimeout(() => {
  1379. saveCoordinatesBtn.textContent = "Save Coordinates";
  1380. saveCoordinatesBtn.style.background = "background: #4CAF50;";
  1381. }, 2000);
  1382. });
  1383. }
  1384. }
  1385.  
  1386.  
  1387.  
  1388.  
  1389. function AddSettingsButton() {
  1390. const base64Logo = window.Base64Images.logo;
  1391. const navbarGroup = document.querySelector('.nav.navbar-right.rbx-navbar-icon-group');
  1392. if (!navbarGroup || document.getElementById('custom-logo')) return;
  1393.  
  1394. const li = document.createElement('li');
  1395. li.id = 'custom-logo-container';
  1396. li.style.position = 'relative';
  1397.  
  1398. li.innerHTML = `
  1399. <img id="custom-logo"
  1400. style="
  1401. margin-top: 6px;
  1402. margin-left: 6px;
  1403. width: 26px;
  1404. cursor: pointer;
  1405. border-radius: 4px;
  1406. transition: all 0.2s ease-in-out;
  1407. "
  1408. src="${base64Logo}">
  1409. <span id="custom-tooltip"
  1410. style="
  1411. visibility: hidden;
  1412. background-color: black;
  1413. color: white;
  1414. text-align: center;
  1415. padding: 5px;
  1416. border-radius: 5px;
  1417. position: absolute;
  1418. top: 35px;
  1419. left: 50%;
  1420. transform: translateX(-50%);
  1421. white-space: nowrap;
  1422. font-size: 12px;
  1423. opacity: 0;
  1424. transition: opacity 0.2s ease-in-out;
  1425. ">
  1426. Settings
  1427. </span>
  1428. `;
  1429.  
  1430. const logo = li.querySelector('#custom-logo');
  1431. const tooltip = li.querySelector('#custom-tooltip');
  1432.  
  1433. logo.addEventListener('click', () => openSettingsMenu());
  1434.  
  1435. logo.addEventListener('mouseover', () => {
  1436. logo.style.width = '30px';
  1437. logo.style.border = '2px solid white';
  1438. tooltip.style.visibility = 'visible';
  1439. tooltip.style.opacity = '1';
  1440. });
  1441.  
  1442. logo.addEventListener('mouseout', () => {
  1443. logo.style.width = '26px';
  1444. logo.style.border = 'none';
  1445. tooltip.style.visibility = 'hidden';
  1446. tooltip.style.opacity = '0';
  1447. });
  1448.  
  1449. navbarGroup.appendChild(li);
  1450. }
  1451.  
  1452.  
  1453.  
  1454.  
  1455. /*************************************************************************
  1456. Premium Notification System
  1457. *************************************************************************/
  1458. function notifications(message, type = 'info', emoji = '', duration = 3000) {
  1459. // Helper function to manipulate colors - supports hex, rgb, and rgba
  1460. function adjustColor(color, percent) {
  1461. // Handle hex colors
  1462. if (color.startsWith('#')) {
  1463. let num = parseInt(color.slice(1), 16),
  1464. amt = Math.round(2.55 * percent),
  1465. R = (num >> 16) + amt,
  1466. G = ((num >> 8) & 0xFF) + amt,
  1467. B = (num & 0xFF) + amt;
  1468. R = Math.max(Math.min(255, R), 0);
  1469. G = Math.max(Math.min(255, G), 0);
  1470. B = Math.max(Math.min(255, B), 0);
  1471. return "#" + ((1 << 24) + (R << 16) + (G << 8) + B).toString(16).slice(1);
  1472. }
  1473. // Handle rgb/rgba colors
  1474. else if (color.startsWith('rgb')) {
  1475. const isRGBA = color.startsWith('rgba');
  1476. const parts = color.match(/\d+(\.\d+)?/g).map(Number);
  1477.  
  1478. for (let i = 0; i < 3; i++) {
  1479. parts[i] = Math.max(0, Math.min(255, parts[i] + (2.55 * percent)));
  1480. }
  1481.  
  1482. return isRGBA ?
  1483. `rgba(${parts[0]}, ${parts[1]}, ${parts[2]}, ${parts[3]})` :
  1484. `rgb(${parts[0]}, ${parts[1]}, ${parts[2]})`;
  1485. }
  1486.  
  1487. return color; // Return original if format not recognized
  1488. }
  1489.  
  1490. // Inject CSS styles for the toast system once
  1491. if (!document.getElementById('premium-toast-styles')) {
  1492. const style = document.createElement('style');
  1493. style.id = 'premium-toast-styles';
  1494. style.innerHTML = `
  1495. @keyframes toast-slide-in {
  1496. 0% { opacity: 0; transform: translateX(50px); }
  1497. 100% { opacity: 1; transform: translateX(0); }
  1498. }
  1499.  
  1500. @keyframes toast-slide-out {
  1501. 0% { opacity: 1; transform: translateX(0); }
  1502. 100% { opacity: 0; transform: translateX(50px); }
  1503. }
  1504.  
  1505. @keyframes progress-shrink {
  1506. 0% { width: 100%; }
  1507. 100% { width: 0%; }
  1508. }
  1509.  
  1510. @keyframes emoji-pop {
  1511. 0% { transform: scale(0.8); opacity: 0.7; }
  1512. 40% { transform: scale(1.3); opacity: 1; }
  1513. 60% { transform: scale(0.9); opacity: 0.95; }
  1514. 80% { transform: scale(1.1); opacity: 1; }
  1515. 100% { transform: scale(1); opacity: 1; }
  1516. }
  1517.  
  1518. @keyframes emoji-float {
  1519. 0% { transform: translateY(0); }
  1520. 50% { transform: translateY(-4px); }
  1521. 100% { transform: translateY(0); }
  1522. }
  1523.  
  1524. @keyframes emoji-glow {
  1525. 0% { text-shadow: 0 0 5px rgba(255,255,255,0); }
  1526. 50% { text-shadow: 0 0 10px rgba(255,255,255,0.5); }
  1527. 100% { text-shadow: 0 0 5px rgba(255,255,255,0); }
  1528. }
  1529.  
  1530. #toast-container {
  1531. position: fixed;
  1532. top: 24px;
  1533. right: 24px;
  1534. z-index: 999999;
  1535. display: flex;
  1536. flex-direction: column;
  1537. gap: 12px;
  1538. pointer-events: none;
  1539. }
  1540.  
  1541. .toast {
  1542. position: relative;
  1543. min-width: 320px;
  1544. max-width: 420px;
  1545. padding: 16px 20px;
  1546. border-radius: 12px;
  1547. box-shadow: 0 8px 20px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.15), 0 0 1px rgba(255,255,255,0.2);
  1548. animation: toast-slide-in 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  1549. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  1550. backdrop-filter: blur(10px);
  1551. word-wrap: break-word;
  1552. pointer-events: auto;
  1553. overflow: hidden;
  1554. display: flex;
  1555. flex-direction: column;
  1556. }
  1557.  
  1558. .toast.removing {
  1559. animation: toast-slide-out 0.5s cubic-bezier(0.55, 0, 0.1, 1) forwards;
  1560. }
  1561.  
  1562. .toast .toast-content {
  1563. display: flex;
  1564. align-items: center;
  1565. gap: 12px;
  1566. color: white;
  1567. font-size: 15px;
  1568. line-height: 1.5;
  1569. font-weight: 500;
  1570. letter-spacing: 0.2px;
  1571. }
  1572.  
  1573. .toast-emoji-wrapper {
  1574. position: relative;
  1575. display: flex;
  1576. justify-content: center;
  1577. align-items: center;
  1578. width: 32px;
  1579. height: 32px;
  1580. }
  1581.  
  1582. .toast-emoji {
  1583. font-size: 22px;
  1584. position: relative;
  1585. display: inline-block;
  1586. animation: emoji-pop 0.6s ease-out, emoji-float 3s ease-in-out infinite, emoji-glow 2s ease-in-out infinite;
  1587. transform-origin: center;
  1588. z-index: 2;
  1589. }
  1590.  
  1591. .toast .message {
  1592. flex: 1;
  1593. }
  1594.  
  1595. .toast-close-btn {
  1596. position: absolute;
  1597. top: 12px;
  1598. right: 12px;
  1599. width: 20px;
  1600. height: 20px;
  1601. cursor: pointer;
  1602. border-radius: 50%;
  1603. display: flex;
  1604. align-items: center;
  1605. justify-content: center;
  1606. background: rgba(255, 255, 255, 0.15);
  1607. transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  1608. border: 1px solid rgba(255, 255, 255, 0.2);
  1609. }
  1610.  
  1611. .toast-close-btn:before, .toast-close-btn:after {
  1612. content: '';
  1613. position: absolute;
  1614. width: 12px;
  1615. height: 2px;
  1616. background: rgba(255, 255, 255, 0.9);
  1617. border-radius: 1px;
  1618. transition: all 0.3s ease;
  1619. }
  1620.  
  1621. .toast-close-btn:before {
  1622. transform: rotate(45deg);
  1623. }
  1624.  
  1625. .toast-close-btn:after {
  1626. transform: rotate(-45deg);
  1627. }
  1628.  
  1629. .toast-close-btn:hover {
  1630. background: rgba(255, 255, 255, 0.25);
  1631. transform: scale(1.1) rotate(90deg);
  1632. box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  1633. }
  1634.  
  1635. .toast-close-btn:hover:before, .toast-close-btn:hover:after {
  1636. background: rgba(255, 255, 255, 1);
  1637. }
  1638.  
  1639. .toast .progress-bar-container {
  1640. position: absolute;
  1641. bottom: 0;
  1642. left: 0;
  1643. height: 4px;
  1644. width: 100%;
  1645. background-color: rgba(255, 255, 255, 0.2);
  1646. overflow: hidden;
  1647. }
  1648.  
  1649. .toast .progress-bar {
  1650. height: 100%;
  1651. width: 100%;
  1652. background: linear-gradient(90deg, rgba(255,255,255,0.5), rgba(255,255,255,0.9));
  1653. animation-name: progress-shrink;
  1654. animation-timing-function: linear;
  1655. animation-fill-mode: forwards;
  1656. box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  1657. }
  1658.  
  1659. .toast-icon {
  1660. width: 24px;
  1661. height: 24px;
  1662. display: flex;
  1663. align-items: center;
  1664. justify-content: center;
  1665. border-radius: 50%;
  1666. background: rgba(255, 255, 255, 0.25);
  1667. flex-shrink: 0;
  1668. box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
  1669. }
  1670.  
  1671. .toast.success {
  1672. background: linear-gradient(135deg, #43A047, #66BB6A);
  1673. border-left: 4px solid #2E7D32;
  1674. }
  1675.  
  1676. .toast.error {
  1677. background: linear-gradient(135deg, #E53935, #EF5350);
  1678. border-left: 4px solid #C62828;
  1679. }
  1680.  
  1681. .toast.info {
  1682. background: linear-gradient(135deg, #1E88E5, #42A5F5);
  1683. border-left: 4px solid #1565C0;
  1684. }
  1685.  
  1686. .toast.warning {
  1687. background: linear-gradient(135deg, #FB8C00, #FFA726);
  1688. border-left: 4px solid #EF6C00;
  1689. }
  1690. `;
  1691. document.head.appendChild(style);
  1692. }
  1693.  
  1694. // Create or get the container
  1695. let container = document.getElementById('toast-container');
  1696. if (!container) {
  1697. container = document.createElement('div');
  1698. container.id = 'toast-container';
  1699. document.body.appendChild(container);
  1700. }
  1701.  
  1702. // Create toast element
  1703. const toast = document.createElement('div');
  1704. toast.className = `toast ${type.toLowerCase()}`;
  1705.  
  1706. // Create content wrapper with optional emoji and icon
  1707. const content = document.createElement('div');
  1708. content.className = 'toast-content';
  1709.  
  1710. // Add type-specific icon
  1711. const icon = document.createElement('div');
  1712. icon.className = 'toast-icon';
  1713.  
  1714. // Set icon content based on type
  1715. let iconContent = '';
  1716. switch (type.toLowerCase()) {
  1717. case 'success':
  1718. iconContent = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>';
  1719. break;
  1720. case 'error':
  1721. iconContent = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>';
  1722. break;
  1723. case 'warning':
  1724. iconContent = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>';
  1725. break;
  1726. case 'info':
  1727. default:
  1728. iconContent = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>';
  1729. break;
  1730. }
  1731.  
  1732. icon.innerHTML = iconContent;
  1733. content.appendChild(icon);
  1734.  
  1735. // Add emoji if provided with enhanced animations
  1736. if (emoji) {
  1737. const emojiWrapper = document.createElement('div');
  1738. emojiWrapper.className = 'toast-emoji-wrapper';
  1739.  
  1740. const emojiSpan = document.createElement('span');
  1741. emojiSpan.className = 'toast-emoji';
  1742. emojiSpan.textContent = emoji;
  1743.  
  1744. emojiWrapper.appendChild(emojiSpan);
  1745. content.appendChild(emojiWrapper);
  1746. }
  1747.  
  1748. // Add message
  1749. const messageSpan = document.createElement('span');
  1750. messageSpan.className = 'message';
  1751. messageSpan.textContent = message;
  1752. content.appendChild(messageSpan);
  1753.  
  1754. toast.appendChild(content);
  1755.  
  1756. // Create the enhanced close button (X)
  1757. const closeBtn = document.createElement('div');
  1758. closeBtn.className = 'toast-close-btn';
  1759. closeBtn.addEventListener('click', () => removeToast(toast));
  1760. toast.appendChild(closeBtn);
  1761.  
  1762. // Create progress bar container and progress bar
  1763. const progressBarContainer = document.createElement('div');
  1764. progressBarContainer.className = 'progress-bar-container';
  1765.  
  1766. const progressBar = document.createElement('div');
  1767. progressBar.className = 'progress-bar';
  1768. progressBar.style.animationDuration = `${duration}ms`;
  1769.  
  1770. progressBarContainer.appendChild(progressBar);
  1771. toast.appendChild(progressBarContainer);
  1772.  
  1773. // Append toast to container
  1774. container.appendChild(toast);
  1775.  
  1776. // Auto-remove toast after the specified duration
  1777. const removeTimeout = setTimeout(() => removeToast(toast), duration);
  1778. let removeTimeoutRef = removeTimeout;
  1779.  
  1780. // Add hover pause functionality
  1781. toast.addEventListener('mouseenter', () => {
  1782. // Pause the progress bar animation
  1783. progressBar.style.animationPlayState = 'paused';
  1784. clearTimeout(removeTimeoutRef);
  1785.  
  1786. // Subtle scale effect on hover
  1787. toast.style.transform = 'scale(1.02)';
  1788. toast.style.transition = 'transform 0.3s ease';
  1789. });
  1790.  
  1791. toast.addEventListener('mouseleave', () => {
  1792. // Resume the progress bar animation
  1793. progressBar.style.animationPlayState = 'running';
  1794. // Reset scale
  1795. toast.style.transform = 'scale(1)';
  1796.  
  1797. // Calculate remaining time based on progress bar width percentage
  1798. const remainingPercentage = progressBar.offsetWidth / progressBarContainer.offsetWidth;
  1799. const remainingTime = duration * remainingPercentage;
  1800. // Set new timeout with remaining time
  1801. clearTimeout(removeTimeoutRef);
  1802. removeTimeoutRef = setTimeout(() => removeToast(toast), remainingTime);
  1803. });
  1804.  
  1805. // Function to fade out and remove toast
  1806. function removeToast(toastEl) {
  1807. clearTimeout(removeTimeoutRef);
  1808. toastEl.classList.add('removing');
  1809. setTimeout(() => toastEl.remove(), 500);
  1810. }
  1811.  
  1812. // Return an object with methods to control the toast
  1813. return {
  1814. remove: () => removeToast(toast),
  1815. update: (newMessage) => {
  1816. messageSpan.textContent = newMessage;
  1817. },
  1818. setType: (newType) => {
  1819. toast.className = `toast ${newType.toLowerCase()}`;
  1820. },
  1821. setDuration: (newDuration) => {
  1822. clearTimeout(removeTimeoutRef);
  1823. // Reset the progress bar animation
  1824. progressBar.style.animation = 'none';
  1825. setTimeout(() => {
  1826. progressBar.style.animation = `progress-shrink ${newDuration}ms linear forwards`;
  1827. removeTimeoutRef = setTimeout(() => removeToast(toast), newDuration);
  1828. }, 10);
  1829. },
  1830. updateEmoji: (newEmoji) => {
  1831. if (emoji) {
  1832. const emojiElement = toast.querySelector('.toast-emoji');
  1833. if (emojiElement) {
  1834. // Reset animation by cloning and replacing
  1835. const parent = emojiElement.parentNode;
  1836. const newEmojiElement = emojiElement.cloneNode(true);
  1837. newEmojiElement.textContent = newEmoji;
  1838. parent.replaceChild(newEmojiElement, emojiElement);
  1839. }
  1840. }
  1841. }
  1842. };
  1843. }
  1844.  
  1845.  
  1846. function Update_Popup() {
  1847. const VERSION = "V36.3";
  1848. const PREV_VERSION = "V35.3";
  1849.  
  1850. // Check if a version other than V36.3 exists and show the popup
  1851. const currentVersion = localStorage.getItem('version') || "V0.0"; // Get saved version or default to "V0.0"
  1852. if (currentVersion !== VERSION) {
  1853. localStorage.setItem('version', VERSION); // Set the new version
  1854. } else {
  1855. return; // If the current version is the latest, do not show the popup
  1856. }
  1857.  
  1858. // Remove any previous version flag if present
  1859. if (localStorage.getItem(PREV_VERSION)) {
  1860. localStorage.removeItem(PREV_VERSION);
  1861. }
  1862.  
  1863. const css = `
  1864. .first-time-popup {
  1865. display: flex;
  1866. position: fixed;
  1867. inset: 0;
  1868. background: rgba(0, 0, 0, 0.25); /* Increased opacity for darker background without blur */
  1869. justify-content: center;
  1870. align-items: center;
  1871. z-index: 1000;
  1872. opacity: 0;
  1873. animation: fadeIn 0.5s ease-in-out forwards;
  1874. }
  1875. .first-time-popup-content {
  1876. background: linear-gradient(135deg, rgba(30, 30, 40, 0.95) 0%, rgba(15, 15, 25, 0.98) 100%);
  1877. border-radius: 24px;
  1878. padding: 35px;
  1879. width: 450px;
  1880. max-width: 90%;
  1881. box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  1882. text-align: center;
  1883. color: #fff;
  1884. transform: scale(0.85);
  1885. animation: scaleUp 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
  1886. position: relative;
  1887. overflow: hidden;
  1888. }
  1889. .first-time-popup-content::before {
  1890. content: '';
  1891. position: absolute;
  1892. top: 0;
  1893. left: 0;
  1894. right: 0;
  1895. height: 3px;
  1896. background: linear-gradient(90deg, #4da6ff, #9966ff, #4da6ff);
  1897. background-size: 200% 100%;
  1898. animation: shimmer 3s infinite linear;
  1899. }
  1900. .popup-header {
  1901. font-size: 24px;
  1902. font-weight: 800;
  1903. color: #fff;
  1904. text-transform: uppercase;
  1905. letter-spacing: 1.5px;
  1906. margin-bottom: 8px;
  1907. text-align: center;
  1908. text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  1909. }
  1910. .popup-version {
  1911. font-size: 18px;
  1912. font-weight: bold;
  1913. color: #ffcc00;
  1914. margin-bottom: 20px;
  1915. display: inline-block;
  1916. padding: 5px 15px;
  1917. border-radius: 20px;
  1918. background: rgba(255, 204, 0, 0.1);
  1919. box-shadow: 0 0 0 1px rgba(255, 204, 0, 0.3);
  1920. }
  1921. .popup-info {
  1922. font-size: 15px;
  1923. color: #e0e0e0;
  1924. margin-bottom: 25px;
  1925. line-height: 1.7;
  1926. padding: 18px;
  1927. border-radius: 16px;
  1928. background: rgba(255, 255, 255, 0.03);
  1929. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  1930. }
  1931. .popup-info p {
  1932. margin: 12px 0;
  1933. }
  1934. .popup-info a {
  1935. color: #4da6ff;
  1936. text-decoration: none;
  1937. font-weight: bold;
  1938. transition: all 0.3s ease;
  1939. padding: 2px 5px;
  1940. border-radius: 4px;
  1941. background: rgba(77, 166, 255, 0.1);
  1942. }
  1943. .popup-info a:hover {
  1944. color: #80bfff;
  1945. text-decoration: none;
  1946. background: rgba(77, 166, 255, 0.2);
  1947. box-shadow: 0 0 0 1px rgba(77, 166, 255, 0.3);
  1948. }
  1949. .popup-footer {
  1950. font-size: 14px;
  1951. color: rgba(255, 255, 255, 0.6);
  1952. font-weight: 500;
  1953. margin-top: 15px;
  1954. transition: opacity 0.4s ease-out;
  1955. padding: 8px;
  1956. border-radius: 8px;
  1957. background: rgba(0, 0, 0, 0.2);
  1958. }
  1959. .popup-footer.hidden {
  1960. opacity: 0;
  1961. visibility: hidden;
  1962. }
  1963. .popup-note {
  1964. font-size: 13px;
  1965. font-weight: bold;
  1966. color: #ff6666;
  1967. margin-top: 12px;
  1968. }
  1969. .popup-logo {
  1970. display: block;
  1971. margin: 0 auto 20px;
  1972. width: 90px;
  1973. height: auto;
  1974. border-radius: 18px;
  1975. box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
  1976. transform: translateY(0);
  1977. transition: transform 0.3s ease;
  1978. }
  1979. .popup-logo:hover {
  1980. transform: translateY(-3px);
  1981. }
  1982. .developer-message {
  1983. display: inline-block;
  1984. padding: 10px 15px;
  1985. margin: 10px 0;
  1986. background: rgba(40, 167, 69, 0.1);
  1987. border-left: 3px solid #28a745;
  1988. color: #bfffca;
  1989. border-radius: 3px;
  1990. font-weight: 500;
  1991. text-align: left;
  1992. line-height: 1.5;
  1993. }
  1994. .feature-item {
  1995. display: flex;
  1996. align-items: center;
  1997. margin: 12px 0;
  1998. text-align: left;
  1999. }
  2000. .feature-icon {
  2001. margin-right: 10px;
  2002. color: #4da6ff;
  2003. font-size: 18px;
  2004. }
  2005. .feature-highlight {
  2006. display: inline-block;
  2007. padding: 2px 8px;
  2008. background: rgba(77, 166, 255, 0.15);
  2009. border-radius: 4px;
  2010. color: #ffffff;
  2011. font-weight: bold;
  2012. }
  2013. .first-time-popup-close {
  2014. position: absolute;
  2015. top: 15px;
  2016. right: 20px;
  2017. font-size: 26px;
  2018. font-weight: bold;
  2019. cursor: pointer;
  2020. color: rgba(255, 255, 255, 0.6);
  2021. opacity: 0.4;
  2022. transition: all 0.3s ease;
  2023. pointer-events: none;
  2024. width: 30px;
  2025. height: 30px;
  2026. display: flex;
  2027. align-items: center;
  2028. justify-content: center;
  2029. border-radius: 50%;
  2030. }
  2031. .first-time-popup-close.active {
  2032. opacity: 1;
  2033. pointer-events: auto;
  2034. background: rgba(255, 255, 255, 0.05);
  2035. }
  2036. .first-time-popup-close:hover {
  2037. color: #ff4d4d;
  2038. transform: rotate(90deg);
  2039. background: rgba(255, 77, 77, 0.1);
  2040. }
  2041. @keyframes fadeIn {
  2042. from { opacity: 0; }
  2043. to { opacity: 1; }
  2044. }
  2045. @keyframes fadeOut {
  2046. from { opacity: 1; }
  2047. to { opacity: 0; }
  2048. }
  2049. @keyframes scaleUp {
  2050. 0% { transform: scale(0.85); }
  2051. 70% { transform: scale(1.03); }
  2052. 100% { transform: scale(1); }
  2053. }
  2054. @keyframes scaleDown {
  2055. from { transform: scale(1); }
  2056. to { transform: scale(0.85); opacity: 0; }
  2057. }
  2058. @keyframes shimmer {
  2059. 0% { background-position: 0% 0; }
  2060. 100% { background-position: 200% 0; }
  2061. }
  2062. `;
  2063.  
  2064. const style = document.createElement('style');
  2065. style.type = 'text/css';
  2066. style.innerHTML = css;
  2067. document.head.appendChild(style);
  2068.  
  2069. const popupHTML = `
  2070. <div class="first-time-popup">
  2071. <div class="first-time-popup-content">
  2072. <span class="first-time-popup-close active">&times;</span>
  2073. <img class="popup-logo" src="${window.Base64Images.logo}" alt="Rolocate Logo">
  2074. <div class="popup-header">Rolocate Update</div>
  2075. <div class="popup-version">${VERSION}</div>
  2076. <div class="popup-info">
  2077. <div class="developer-message">
  2078. <span style="font-weight: bold;">From the Developer:</span> Please report any issues on GreasyFork if something breaks! Thank you for your support.
  2079. </div>
  2080.  
  2081. <div class="feature-item">
  2082. <span class="feature-icon">🆕</span>
  2083. <div>New in Advanced Settings: <span class="feature-highlight">Fast Server search</span> - Up to <span class="feature-highlight">100x</span> faster search location search. Still experimental.</div>
  2084. </div>
  2085.  
  2086. <div class="feature-item">
  2087. <span class="feature-icon">📚</span>
  2088. <div>Need help? Check out our <a href="https://oqarshi.github.io/Invite/rolocate/index.html" target="_blank">FAQ page</a> or create an issue on greasyfork! 😊</div>
  2089. </div>
  2090.  
  2091. <p style="margin-top: 15px; text-align: center; opacity: 0.8;">This message will not appear again until the next update.</p>
  2092. </div>
  2093. </div>
  2094. </div>
  2095. `;
  2096.  
  2097. const popupContainer = document.createElement('div');
  2098. popupContainer.innerHTML = popupHTML;
  2099. document.body.appendChild(popupContainer);
  2100.  
  2101. const closeButton = popupContainer.querySelector('.first-time-popup-close');
  2102. const popup = popupContainer.querySelector('.first-time-popup');
  2103.  
  2104. if (closeButton && popup) {
  2105. closeButton.addEventListener('click', () => {
  2106. popup.style.animation = 'fadeOut 0.4s ease-in-out forwards';
  2107. popup.querySelector('.first-time-popup-content').style.animation = 'scaleDown 0.4s ease-in-out forwards';
  2108. setTimeout(() => {
  2109. popup.remove();
  2110. }, 400);
  2111. });
  2112. } else {
  2113. console.warn('Popup initialization failed: close button or popup not found.');
  2114. }
  2115. }
  2116.  
  2117.  
  2118.  
  2119. function removeAds() {
  2120. if (localStorage.getItem("ROLOCATE_removeads") !== "true") {
  2121. return;
  2122. }
  2123.  
  2124. const iframeSelector = `.ads-container iframe,.abp iframe,.abp-spacer iframe,.abp-container iframe,.top-abp-container iframe,
  2125. #AdvertisingLeaderboard iframe,#AdvertisementRight iframe,#MessagesAdSkyscraper iframe,.Ads_WideSkyscraper iframe,
  2126. .profile-ads-container iframe, #ad iframe, iframe[src*="roblox.com/user-sponsorship/"]`;
  2127.  
  2128. const iframes = document.getElementsByTagName("iframe");
  2129. const scripts = document.getElementsByTagName("script");
  2130. const doneMap = new WeakMap();
  2131.  
  2132. function removeElements() {
  2133. // Remove Iframes
  2134. for (let i = iframes.length; i--;) {
  2135. const iframe = iframes[i];
  2136. if (!doneMap.get(iframe) && iframe.matches(iframeSelector)) {
  2137. iframe.remove();
  2138. doneMap.set(iframe, true);
  2139. }
  2140. }
  2141.  
  2142. // Remove Scripts
  2143. for (let i = scripts.length; i--;) {
  2144. const script = scripts[i];
  2145. if (doneMap.get(script)) {
  2146. continue;
  2147. }
  2148. doneMap.set(script, true);
  2149.  
  2150. if (script.src && (
  2151. script.src.includes("imasdk.googleapis.com") ||
  2152. script.src.includes("googletagmanager.com") ||
  2153. script.src.includes("radar.cedexis.com") ||
  2154. script.src.includes("ns1p.net")
  2155. )) {
  2156. script.remove();
  2157. } else {
  2158. const cont = script.textContent;
  2159. if (!cont.includes("ContentJS") && (
  2160. cont.includes("scorecardresearch.com") ||
  2161. cont.includes("cedexis.com") ||
  2162. cont.includes("pingdom.net") ||
  2163. cont.includes("ns1p.net") ||
  2164. cont.includes("Roblox.Hashcash") ||
  2165. cont.includes("Roblox.VideoPreRollDFP") ||
  2166. cont.includes("Roblox.AdsHelper=") ||
  2167. cont.includes("googletag.enableServices()") ||
  2168. cont.includes("gtag('config'")
  2169. )) {
  2170. script.remove();
  2171. } else if (cont.includes("Roblox.EventStream.Init")) {
  2172. script.textContent = cont.replace(/"[^"]*"/g, "\"\"");
  2173. }
  2174. }
  2175. }
  2176.  
  2177. // Hide Sponsored Game Cards (existing method)
  2178. document.querySelectorAll(".game-card-native-ad").forEach(ad => {
  2179. const gameCard = ad.closest(".game-card-container");
  2180. if (gameCard) {
  2181. gameCard.style.display = "none";
  2182. }
  2183. });
  2184.  
  2185. // Block Sponsored Ads Game Card
  2186. document.querySelectorAll("div.gamecardcontainer").forEach(container => {
  2187. if (container.querySelector("div.game-card-native-ad")) {
  2188. container.style.display = "none";
  2189. }
  2190. });
  2191.  
  2192. // Block Sponsored Section On HomePage
  2193. document.querySelectorAll(".game-sort-carousel-wrapper").forEach(wrapper => {
  2194. const sponsoredLink = wrapper.querySelector('a[href*="Sponsored"]');
  2195. if (sponsoredLink) {
  2196. wrapper.style.display = "none";
  2197. }
  2198. });
  2199.  
  2200. // NEW: Remove elements with class "sdui-feed-item-container"
  2201. document.querySelectorAll(".sdui-feed-item-container").forEach(node => {
  2202. node.remove();
  2203. });
  2204. }
  2205.  
  2206. // Observe DOM for dynamically added elements
  2207. new MutationObserver(removeElements).observe(document.body, {
  2208. childList: true,
  2209. subtree: true
  2210. });
  2211.  
  2212. removeElements(); // Initial run
  2213. }
  2214.  
  2215.  
  2216.  
  2217. function ConsoleLogEnabled(...args) {
  2218. if (localStorage.getItem("ROLOCATE_enableLogs") === "true") {
  2219. console.log("[ROLOCATE]", ...args);
  2220. }
  2221. }
  2222.  
  2223.  
  2224. async function showOldRobloxGreeting() {
  2225. ConsoleLogEnabled("Function showOldRobloxGreeting() started.");
  2226.  
  2227. // Check if the URL is roblox.com/home
  2228. if (!window.location.href.includes("roblox.com/home")) {
  2229. ConsoleLogEnabled("Not on roblox.com/home. Exiting function.");
  2230. return; // ⛔ Stops execution if not on the home page
  2231. }
  2232.  
  2233. // Check LocalStorage before proceeding
  2234. if (localStorage.getItem("ROLOCATE_ShowOldGreeting") !== "true") {
  2235. ConsoleLogEnabled("ShowOldGreeting is disabled. Exiting function.");
  2236. return; // ⛔ Stops execution if setting is off
  2237. }
  2238.  
  2239. ConsoleLogEnabled("Waiting 500ms before proceeding.");
  2240. await new Promise(r => setTimeout(r, 500));
  2241.  
  2242. function observeElement(selector) {
  2243. ConsoleLogEnabled(`Observing element: ${selector}`);
  2244. return new Promise((resolve) => {
  2245. const observer = new MutationObserver(() => {
  2246. const element = document.querySelector(selector);
  2247. if (element) {
  2248. ConsoleLogEnabled(`Element found: ${selector}`);
  2249. observer.disconnect();
  2250. resolve(element);
  2251. }
  2252. });
  2253. observer.observe(document.body, {
  2254. childList: true,
  2255. subtree: true
  2256. });
  2257. });
  2258. }
  2259.  
  2260. async function fetchAvatar(selector, fallbackImage) {
  2261. ConsoleLogEnabled(`Fetching avatar from selector: ${selector}`);
  2262. for (let attempt = 0; attempt < 3; attempt++) {
  2263. ConsoleLogEnabled(`Attempt ${attempt + 1} to fetch avatar.`);
  2264. const imgElement = document.querySelector(selector);
  2265. if (imgElement && imgElement.src !== fallbackImage) {
  2266. ConsoleLogEnabled(`Avatar found: ${imgElement.src}`);
  2267. return imgElement.src;
  2268. }
  2269. await new Promise(r => setTimeout(r, 1500));
  2270. }
  2271. ConsoleLogEnabled("Avatar not found, using fallback image.");
  2272. return fallbackImage;
  2273. }
  2274.  
  2275. let homeContainer = await observeElement("#HomeContainer .section:first-child");
  2276. ConsoleLogEnabled("Home container located.");
  2277.  
  2278. let userNameElement = document.querySelector("#navigation.rbx-left-col > ul > li > a .font-header-2");
  2279. ConsoleLogEnabled(`User name found: ${userNameElement ? userNameElement.innerText : "Unknown"}`);
  2280.  
  2281. let user = {
  2282. name: userNameElement ? `Hello, ${userNameElement.innerText}!` : "Hello, Roblox User!",
  2283. avatar: await fetchAvatar("#navigation.rbx-left-col > ul > li > a img", window.Base64Images.image_place_holder)
  2284. };
  2285.  
  2286. ConsoleLogEnabled(`Final user details: Name - ${user.name}, Avatar - ${user.avatar}`);
  2287.  
  2288. let headerContainer = document.createElement("div");
  2289. headerContainer.classList.add("new-header");
  2290. headerContainer.style.opacity = "0";
  2291.  
  2292. let profileFrame = document.createElement("div");
  2293. profileFrame.classList.add("profile-frame");
  2294.  
  2295. let profileImage = document.createElement("img");
  2296. profileImage.src = user.avatar;
  2297. profileImage.classList.add("profile-img");
  2298.  
  2299. profileFrame.appendChild(profileImage);
  2300.  
  2301. let userDetails = document.createElement("div");
  2302. userDetails.classList.add("user-details");
  2303.  
  2304. let userName = document.createElement("h1");
  2305. userName.classList.add("user-name");
  2306. userName.textContent = user.name;
  2307.  
  2308. userDetails.appendChild(userName);
  2309.  
  2310. headerContainer.appendChild(profileFrame);
  2311. headerContainer.appendChild(userDetails);
  2312.  
  2313. ConsoleLogEnabled("Replacing old home container with new header.");
  2314. homeContainer.replaceWith(headerContainer);
  2315.  
  2316. let styleTag = document.createElement("style");
  2317. styleTag.textContent = `
  2318. .new-header {
  2319. display: flex;
  2320. align-items: center;
  2321. margin-bottom: 30px;
  2322. transition: opacity 1.5s ease-in-out;
  2323. }
  2324. .profile-frame {
  2325. width: 150px;
  2326. height: 150px;
  2327. border-radius: 50%;
  2328. overflow: hidden;
  2329. border: 3px solid #121215;
  2330. display: flex;
  2331. justify-content: center;
  2332. align-items: center;
  2333. }
  2334. .profile-img {
  2335. width: 100%;
  2336. height: 100%;
  2337. object-fit: cover;
  2338. }
  2339. .user-details {
  2340. margin-left: 20px;
  2341. display: flex;
  2342. align-items: center;
  2343. }
  2344. .user-name {
  2345. font-size: 1.2em;
  2346. font-weight: bold;
  2347. color: white;
  2348. }
  2349. `;
  2350. document.head.appendChild(styleTag);
  2351. ConsoleLogEnabled("Style tag added.");
  2352.  
  2353. setTimeout(() => {
  2354. ConsoleLogEnabled("Fading in new header.");
  2355. headerContainer.style.opacity = "1";
  2356. }, 50);
  2357. }
  2358.  
  2359.  
  2360.  
  2361. let lastUrl = window.location.href.split("#")[0]; // Store only the base URL
  2362.  
  2363. function observeURLChanges() {
  2364. const observer = new MutationObserver(() => {
  2365. let currentUrl = window.location.href.split("#")[0]; // Ignore fragment changes
  2366.  
  2367. if (currentUrl !== lastUrl) {
  2368. ConsoleLogEnabled(`URL changed from ${lastUrl} to ${currentUrl}`);
  2369. lastUrl = currentUrl; // Update the stored URL
  2370.  
  2371. // Re-run functions when going back to home
  2372. if (currentUrl.includes("roblox.com/home")) {
  2373. ConsoleLogEnabled("Detected return to home page. Reloading greeting.");
  2374. showOldRobloxGreeting();
  2375. }
  2376. }
  2377. });
  2378.  
  2379. observer.observe(document.body, {
  2380. childList: true,
  2381. subtree: true
  2382. });
  2383. }
  2384.  
  2385.  
  2386. function quicknavbutton() {
  2387. if (localStorage.getItem('ROLOCATE_quicknav') === 'true') {
  2388. const settingsRaw = localStorage.getItem('ROLOCATE_quicknav_settings');
  2389. if (!settingsRaw) return;
  2390.  
  2391. let settings;
  2392. try {
  2393. settings = JSON.parse(settingsRaw);
  2394. } catch (e) {
  2395. ConsoleLogEnabled('Failed to parse ROLOCATE_quicknav_settings:', e);
  2396. return;
  2397. }
  2398.  
  2399. const sidebar = document.querySelector('.left-col-list');
  2400. if (!sidebar) return;
  2401.  
  2402. const premiumButton = sidebar.querySelector('.rbx-upgrade-now');
  2403.  
  2404. const style = document.createElement('style');
  2405. style.textContent = `
  2406. .rolocate-icon-custom {
  2407. display: inline-block;
  2408. width: 24px;
  2409. height: 24px;
  2410. margin-left: 3px;
  2411. background-image: url("${window.Base64Images.quicknav}");
  2412. background-size: contain;
  2413. background-repeat: no-repeat;
  2414. }
  2415.  
  2416. `;
  2417. document.head.appendChild(style);
  2418.  
  2419.  
  2420.  
  2421. settings.forEach(({
  2422. name,
  2423. link
  2424. }) => {
  2425. const li = document.createElement('li');
  2426.  
  2427. const a = document.createElement('a');
  2428. a.className = 'dynamic-overflow-container text-nav';
  2429. a.href = link;
  2430. a.target = '_self';
  2431.  
  2432. const divIcon = document.createElement('div');
  2433. const spanIcon = document.createElement('span');
  2434. spanIcon.className = 'rolocate-icon-custom';
  2435. divIcon.appendChild(spanIcon);
  2436.  
  2437. const spanText = document.createElement('span');
  2438. spanText.className = 'font-header-2 dynamic-ellipsis-item';
  2439. spanText.title = name;
  2440. spanText.textContent = name;
  2441.  
  2442. a.appendChild(divIcon);
  2443. a.appendChild(spanText);
  2444. li.appendChild(a);
  2445.  
  2446. if (premiumButton && premiumButton.parentElement === sidebar) {
  2447. sidebar.insertBefore(li, premiumButton);
  2448. } else {
  2449. sidebar.appendChild(li);
  2450. }
  2451. });
  2452. }
  2453. }
  2454.  
  2455.  
  2456. function validateManualMode() {
  2457. // Check if in manual mode
  2458. if (localStorage.getItem("ROLOCATE_prioritylocation") === "manual") {
  2459. ConsoleLogEnabled("Manual mode detected");
  2460.  
  2461. try {
  2462. // Get stored coordinates
  2463. const coords = JSON.parse(GM_getValue("ROLOCATE_coordinates", '{"lat":"","lng":""}'));
  2464. ConsoleLogEnabled("Coordinates fetched:", coords);
  2465.  
  2466. // If coordinates are empty, switch to automatic
  2467. if (!coords.lat || !coords.lng) {
  2468. localStorage.setItem("ROLOCATE_prioritylocation", "automatic");
  2469. ConsoleLogEnabled("No coordinates set. Switched to automatic mode.");
  2470. return true; // Indicates that a switch occurred
  2471. }
  2472. } catch (e) {
  2473. ConsoleLogEnabled("Error checking coordinates:", e);
  2474. // If there's an error reading coordinates, switch to automatic
  2475. localStorage.setItem("ROLOCATE_prioritylocation", "automatic");
  2476. ConsoleLogEnabled("Error encountered while fetching coordinates. Switched to automatic mode.");
  2477. return true;
  2478. }
  2479. }
  2480.  
  2481. ConsoleLogEnabled("No Errors detected.");
  2482. return false; // No switch occurred
  2483. }
  2484.  
  2485.  
  2486.  
  2487.  
  2488. // Run the initial setup
  2489. window.addEventListener("load", () => {
  2490. loadBase64Library(() => {
  2491. ConsoleLogEnabled("Loaded Base64Images. It is ready to use!");
  2492. });
  2493.  
  2494. AddSettingsButton(() => {
  2495. ConsoleLogEnabled("Loaded Settings button!");
  2496. });
  2497.  
  2498. Update_Popup();
  2499. initializeLocalStorage();
  2500. removeAds();
  2501. showOldRobloxGreeting();
  2502. quicknavbutton();
  2503. ConsoleLogEnabled("Loaded Settings!");
  2504. validateManualMode();
  2505.  
  2506. // Start observing URL changes
  2507. observeURLChanges();
  2508. });
  2509.  
  2510.  
  2511.  
  2512.  
  2513. function loadBase64Library(callback, timeout = 5000) {
  2514. let elapsed = 0;
  2515. (function waitForLibrary() {
  2516. if (typeof window.Base64Images === "undefined") {
  2517. if (elapsed < timeout) {
  2518. elapsed += 50;
  2519. setTimeout(waitForLibrary, 50);
  2520. } else {
  2521. ConsoleLogEnabled("Base64Images did not load within the timeout.");
  2522. notifications('An error occurred! No icons will show. Please refresh the page.', 'error', '⚠️', '8000')
  2523. }
  2524. } else {
  2525. if (callback) callback();
  2526. }
  2527. })();
  2528. }
  2529.  
  2530.  
  2531. /*******************************************************
  2532. The code for the random hop button and the filter button on roblox.com/games/*
  2533. *******************************************************/
  2534.  
  2535. if (window.location.href.startsWith("https://www.roblox.com/games/") && (localStorage.getItem("ROLOCATE_togglefilterserversbutton") === "true" || localStorage.getItem("ROLOCATE_toggleserverhopbutton") === "true" || localStorage.getItem("ROLOCATE_togglerecentserverbutton") === "true")) {
  2536. let Isongamespage = false; // Initially false
  2537. /*********************************************************************************************************************************************************************************************************************************************
  2538. This is all of the functions for the filter button and the popup for the 7 buttons does not include the functions for the 8 buttons
  2539.  
  2540. *********************************************************************************************************************************************************************************************************************************************/
  2541. //Testing
  2542. //HandleRecentServersAddGames("126884695634066", "853e79a5-1a2b-4178-94bf-a242de1aecd6");
  2543. //HandleRecentServersAddGames("126884695634066", "a08849f1-40e32-4b3215c-31231231a268-e948519caf39");
  2544. //HandleRecentServersAddGames("126884695634066", "a08849f1-40e32-4b5c-31236541231a268-e948519caf39");
  2545. //HandleRecentServersAddGames("126884695634066", "a08849f1-40e32-4b5c-31231287631a268-e948519caf39");
  2546. //HandleRecentServersAddGames("126884695634066", "a08849f1-40e32-4b5c-31231231a268-87e948519caf39");
  2547. //HandleRecentServersAddGames("126884695634066", "a08849f1-40e32-4b5c-31231231a268089-e948519caf39");
  2548. //document.querySelector('.recent-servers-section')?.remove(); // remove old list
  2549. //HandleRecentServers(); // re-render with updated order
  2550.  
  2551. function InitRobloxLaunchHandler() {
  2552. if (!window.location.href.startsWith('https://www.roblox.com/games/')) return;
  2553. if (window._robloxJoinInterceptorInitialized) return;
  2554. window._robloxJoinInterceptorInitialized = true;
  2555.  
  2556. const originalJoin = Roblox.GameLauncher.joinGameInstance;
  2557.  
  2558. Roblox.GameLauncher.joinGameInstance = function(gameId, serverId) {
  2559. ConsoleLogEnabled(`Intercepted join: Game ID = ${gameId}, Server ID = ${serverId}`);
  2560. HandleRecentServersAddGames(gameId, serverId);
  2561. document.querySelector('.recent-servers-section')?.remove(); // remove old list
  2562. HandleRecentServers(); // re-render with updated order
  2563. return originalJoin.apply(this, arguments);
  2564. };
  2565. }
  2566.  
  2567.  
  2568.  
  2569.  
  2570. function HandleRecentServersAddGames(gameId, serverId) {
  2571. const storageKey = "ROLOCATE_recentservers_button";
  2572. const stored = JSON.parse(localStorage.getItem(storageKey) || "{}");
  2573. const key = `${gameId}_${serverId}`;
  2574. stored[key] = Date.now(); // Always update timestamp
  2575. localStorage.setItem(storageKey, JSON.stringify(stored));
  2576. }
  2577.  
  2578. function HandleRecentServersURL() {
  2579. // Static-like variable to remember if we've already found an invalid URL
  2580. if (HandleRecentServersURL.alreadyInvalid) {
  2581. return; // Skip if previously marked as invalid
  2582. }
  2583.  
  2584. const url = window.location.href;
  2585.  
  2586. // Regex pattern to match ROLOCATE_GAMEID and SERVERID from the hash
  2587. const match = url.match(/ROLOCATE_GAMEID=(\d+)_SERVERID=([a-f0-9-]+)/i);
  2588.  
  2589. if (match && match.length === 3) {
  2590. const gameId = match[1];
  2591. const serverId = match[2];
  2592.  
  2593. // Call the handler with extracted values
  2594. HandleRecentServersAddGames(gameId, serverId);
  2595. InitRobloxLaunchHandler();
  2596. } else {
  2597. ConsoleLogEnabled("No gameId and serverId found in URL.");
  2598. InitRobloxLaunchHandler();
  2599. HandleRecentServersURL.alreadyInvalid = true; // Set internal flag
  2600. }
  2601. }
  2602.  
  2603.  
  2604.  
  2605. function HandleRecentServers() {
  2606. const serverList = document.querySelector('.server-list-options');
  2607. if (!serverList || document.querySelector('.recent-servers-section')) return;
  2608.  
  2609. const match = window.location.href.match(/\/games\/(\d+)\//);
  2610. if (!match) return;
  2611. const currentGameId = match[1];
  2612.  
  2613. const allHeaders = document.querySelectorAll('.server-list-header');
  2614. let friendsSectionHeader = null;
  2615.  
  2616. allHeaders.forEach(header => {
  2617. if (header.textContent.trim() === 'Servers My Friends Are In') {
  2618. friendsSectionHeader = header.closest('.container-header');
  2619. }
  2620. });
  2621.  
  2622. if (!friendsSectionHeader) return;
  2623.  
  2624. // Custom premium dark theme CSS variables
  2625. const theme = {
  2626. bgDark: '#14161a',
  2627. bgCard: '#1c1f25',
  2628. bgCardHover: '#22262e',
  2629. bgGradient: 'linear-gradient(145deg, #1e2228, #18191e)',
  2630. bgGradientHover: 'linear-gradient(145deg, #23272f, #1c1f25)',
  2631. accentPrimary: '#4d85ee',
  2632. accentSecondary: '#3464c9',
  2633. accentGradient: 'linear-gradient(to bottom, #4d85ee, #3464c9)',
  2634. accentGradientHover: 'linear-gradient(to bottom, #5990ff, #3b6fdd)',
  2635. textPrimary: '#e8ecf3',
  2636. textSecondary: '#a0a8b8',
  2637. textMuted: '#6c7484',
  2638. borderLight: 'rgba(255, 255, 255, 0.06)',
  2639. borderLightHover: 'rgba(255, 255, 255, 0.12)',
  2640. shadow: '0 5px 15px rgba(0, 0, 0, 0.25)',
  2641. shadowHover: '0 8px 25px rgba(0, 0, 0, 0.3)',
  2642. dangerColor: '#ff5b5b',
  2643. dangerColorHover: '#ff7575',
  2644. dangerGradient: 'linear-gradient(to bottom, #ff5b5b, #e04444)',
  2645. dangerGradientHover: 'linear-gradient(to bottom, #ff7575, #f55)'
  2646. };
  2647.  
  2648. const recentSection = document.createElement('div');
  2649. recentSection.className = 'recent-servers-section premium-dark';
  2650. recentSection.style.marginBottom = '24px';
  2651.  
  2652. const headerContainer = document.createElement('div');
  2653. headerContainer.className = 'container-header';
  2654.  
  2655. const headerInner = document.createElement('div');
  2656. headerInner.className = 'server-list-container-header';
  2657. headerInner.style.padding = '0 4px';
  2658.  
  2659. const headerTitle = document.createElement('h2');
  2660. headerTitle.className = 'server-list-header';
  2661. headerTitle.textContent = 'Recent Servers';
  2662. headerTitle.style.cssText = `
  2663. font-weight: 600;
  2664. color: ${theme.textPrimary};
  2665. letter-spacing: 0.5px;
  2666. position: relative;
  2667. display: inline-block;
  2668. padding-bottom: 4px;
  2669. `;
  2670.  
  2671. // Add premium underline accent to header
  2672. const headerAccent = document.createElement('span');
  2673. headerAccent.style.cssText = `
  2674. position: absolute;
  2675. bottom: 0;
  2676. left: 0;
  2677. width: 40px;
  2678. height: 2px;
  2679. background: ${theme.accentGradient};
  2680. border-radius: 2px;
  2681. `;
  2682. headerTitle.appendChild(headerAccent);
  2683.  
  2684. headerInner.appendChild(headerTitle);
  2685. headerContainer.appendChild(headerInner);
  2686.  
  2687. const contentContainer = document.createElement('div');
  2688. contentContainer.className = 'section-content-off empty-game-instances-container';
  2689. contentContainer.style.padding = '8px 4px';
  2690.  
  2691. const storageKey = "ROLOCATE_recentservers_button";
  2692. let stored = JSON.parse(localStorage.getItem(storageKey) || "{}");
  2693.  
  2694. // Auto-remove servers older than 3 days
  2695. const currentTime = Date.now();
  2696. const threeDaysInMs = 3 * 24 * 60 * 60 * 1000; // 3days in miliseconds
  2697. let storageUpdated = false;
  2698.  
  2699. Object.keys(stored).forEach(key => {
  2700. const serverTime = stored[key];
  2701. if (currentTime - serverTime > threeDaysInMs) {
  2702. delete stored[key];
  2703. storageUpdated = true;
  2704. }
  2705. });
  2706.  
  2707. if (storageUpdated) {
  2708. localStorage.setItem(storageKey, JSON.stringify(stored));
  2709. }
  2710.  
  2711. const keys = Object.keys(stored).filter(key => key.startsWith(`${currentGameId}_`));
  2712. if (keys.length === 0) {
  2713. const emptyMessage = document.createElement('div');
  2714. emptyMessage.className = 'no-servers-message';
  2715. emptyMessage.innerHTML = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="opacity: 0.7; margin-right: 10px;">
  2716. <path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="${theme.accentPrimary}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  2717. <path d="M9.09 9C9.3251 8.33167 9.78915 7.76811 10.4 7.40913C11.0108 7.05016 11.7289 6.91894 12.4272 7.03871C13.1255 7.15849 13.7588 7.52152 14.2151 8.06353C14.6713 8.60553 14.9211 9.29152 14.92 10C14.92 12 11.92 13 11.92 13" stroke="${theme.accentPrimary}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  2718. <path d="M12 17H12.01" stroke="${theme.accentPrimary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
  2719. </svg>No Recent Servers Found`;
  2720. emptyMessage.style.cssText = `
  2721. color: ${theme.textSecondary};
  2722. text-align: center;
  2723. padding: 28px 0;
  2724. font-size: 14px;
  2725. letter-spacing: 0.3px;
  2726. font-weight: 500;
  2727. display: flex;
  2728. align-items: center;
  2729. justify-content: center;
  2730. background: rgba(20, 22, 26, 0.4);
  2731. backdrop-filter: blur(5px);
  2732. border-radius: 12px;
  2733. border: 1px solid rgba(77, 133, 238, 0.15);
  2734. box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
  2735. `;
  2736. contentContainer.appendChild(emptyMessage);
  2737. } else {
  2738. keys.sort((a, b) => stored[b] - stored[a]);
  2739.  
  2740. // Create server cards wrapper
  2741. const cardsWrapper = document.createElement('div');
  2742. cardsWrapper.style.cssText = `
  2743. display: flex;
  2744. flex-direction: column;
  2745. gap: 12px;
  2746. margin: 2px 0;
  2747. `;
  2748.  
  2749. keys.forEach((key, index) => {
  2750. const [gameId, serverId] = key.split("_");
  2751. const timeStored = stored[key];
  2752. const date = new Date(timeStored);
  2753. const formattedTime = date.toLocaleString(undefined, {
  2754. hour: '2-digit',
  2755. minute: '2-digit',
  2756. year: 'numeric',
  2757. month: 'short',
  2758. day: 'numeric'
  2759. });
  2760.  
  2761. const serverCard = document.createElement('div');
  2762. serverCard.className = 'recent-server-card premium-dark';
  2763. serverCard.dataset.serverKey = key;
  2764. serverCard.style.cssText = `
  2765. display: flex;
  2766. justify-content: space-between;
  2767. align-items: center;
  2768. padding: 16px 22px;
  2769. height: 76px;
  2770. border-radius: 14px;
  2771. background: ${theme.bgGradient};
  2772. box-shadow: ${theme.shadow};
  2773. color: ${theme.textPrimary};
  2774. font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  2775. font-size: 14px;
  2776. box-sizing: border-box;
  2777. width: 100%;
  2778. position: relative;
  2779. overflow: hidden;
  2780. border: 1px solid ${theme.borderLight};
  2781. transition: all 0.2s ease-out;
  2782. `;
  2783.  
  2784. // Add hover effect
  2785. serverCard.onmouseover = function() {
  2786. this.style.boxShadow = theme.shadowHover;
  2787. this.style.transform = 'translateY(-2px)';
  2788. this.style.borderColor = theme.borderLightHover;
  2789. this.style.background = theme.bgGradientHover;
  2790. };
  2791.  
  2792. serverCard.onmouseout = function() {
  2793. this.style.boxShadow = theme.shadow;
  2794. this.style.transform = 'translateY(0)';
  2795. this.style.borderColor = theme.borderLight;
  2796. this.style.background = theme.bgGradient;
  2797. };
  2798.  
  2799. // Add glass effect overlay
  2800. const glassOverlay = document.createElement('div');
  2801. glassOverlay.style.cssText = `
  2802. position: absolute;
  2803. left: 0;
  2804. top: 0;
  2805. right: 0;
  2806. height: 50%;
  2807. background: linear-gradient(to bottom, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
  2808. border-radius: 14px 14px 0 0;
  2809. pointer-events: none;
  2810. `;
  2811. serverCard.appendChild(glassOverlay);
  2812.  
  2813. // Server icon with glow
  2814. const serverIconWrapper = document.createElement('div');
  2815. serverIconWrapper.style.cssText = `
  2816. position: absolute;
  2817. left: 14px;
  2818. display: flex;
  2819. align-items: center;
  2820. justify-content: center;
  2821. width: 32px;
  2822. height: 32px;
  2823. `;
  2824.  
  2825. const serverIcon = document.createElement('div');
  2826. serverIcon.innerHTML = `
  2827. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  2828. <path d="M2 17L12 22L22 17" stroke="${theme.accentPrimary}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  2829. <path d="M2 12L12 17L22 12" stroke="${theme.accentPrimary}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  2830. <path d="M2 7L12 12L22 7L12 2L2 7Z" stroke="${theme.accentPrimary}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  2831. </svg>
  2832. `;
  2833. serverIconWrapper.appendChild(serverIcon);
  2834.  
  2835. // Add subtle glow to the server icon
  2836. const iconGlow = document.createElement('div');
  2837. iconGlow.style.cssText = `
  2838. position: absolute;
  2839. width: 24px;
  2840. height: 24px;
  2841. border-radius: 50%;
  2842. background: ${theme.accentPrimary};
  2843. opacity: 0.15;
  2844. filter: blur(8px);
  2845. z-index: -1;
  2846. `;
  2847. serverIconWrapper.appendChild(iconGlow);
  2848.  
  2849. const left = document.createElement('div');
  2850. left.style.cssText = `
  2851. display: flex;
  2852. flex-direction: column;
  2853. justify-content: center;
  2854. margin-left: 12px;
  2855. `;
  2856.  
  2857. const lastPlayed = document.createElement('div');
  2858. lastPlayed.textContent = `Last Played: ${formattedTime}`;
  2859. lastPlayed.style.cssText = `
  2860. font-weight: 600;
  2861. font-size: 14px;
  2862. color: ${theme.textPrimary};
  2863. line-height: 1.3;
  2864. letter-spacing: 0.3px;
  2865. margin-left: 40px;
  2866. text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  2867. `;
  2868.  
  2869. const metaInfo = document.createElement('div');
  2870. metaInfo.innerHTML = `<span style="color: ${theme.accentPrimary};">Game ID:</span> ${gameId} <span style="color: ${theme.textMuted};">•</span> <span style="color: ${theme.accentPrimary};">Server ID:</span> ${serverId}`;
  2871. metaInfo.style.cssText = `
  2872. font-size: 12px;
  2873. color: ${theme.textSecondary};
  2874. margin-top: 5px;
  2875. opacity: 0.9;
  2876. margin-left: 40px;
  2877. `;
  2878.  
  2879. left.appendChild(lastPlayed);
  2880. left.appendChild(metaInfo);
  2881. serverCard.appendChild(serverIconWrapper);
  2882.  
  2883. const buttonGroup = document.createElement('div');
  2884. buttonGroup.style.cssText = `
  2885. display: flex;
  2886. gap: 12px;
  2887. align-items: center;
  2888. z-index: 2;
  2889. `;
  2890.  
  2891. // Create the smaller remove button to be positioned on the left
  2892. const removeButton = document.createElement('button');
  2893. removeButton.innerHTML = `
  2894. <svg width="12" height="12" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  2895. <path d="M18 6L6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
  2896. <path d="M6 6L18 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
  2897. </svg>
  2898. `;
  2899. removeButton.className = 'btn-control-xs remove-button';
  2900. removeButton.style.cssText = `
  2901. background: ${theme.dangerGradient};
  2902. color: white;
  2903. border: none;
  2904. padding: 6px;
  2905. border-radius: 8px;
  2906. font-size: 13px;
  2907. font-weight: 600;
  2908. cursor: pointer;
  2909. transition: all 0.15s ease;
  2910. letter-spacing: 0.4px;
  2911. box-shadow: 0 2px 8px rgba(255, 91, 91, 0.3);
  2912. display: flex;
  2913. align-items: center;
  2914. justify-content: center;
  2915. width: 30px;
  2916. height: 30px;
  2917. `;
  2918.  
  2919. // Add remove button hover effect
  2920. removeButton.onmouseover = function() {
  2921. this.style.background = theme.dangerGradientHover;
  2922. this.style.boxShadow = '0 4px 10px rgba(255, 91, 91, 0.4)';
  2923. this.style.transform = 'translateY(-1px)';
  2924. };
  2925.  
  2926. removeButton.onmouseout = function() {
  2927. this.style.background = theme.dangerGradient;
  2928. this.style.boxShadow = '0 2px 8px rgba(255, 91, 91, 0.3)';
  2929. this.style.transform = 'translateY(0)';
  2930. };
  2931.  
  2932. // Add remove button functionality
  2933. removeButton.addEventListener('click', function(e) {
  2934. e.stopPropagation();
  2935. const serverKey = this.closest('.recent-server-card').dataset.serverKey;
  2936.  
  2937. // Animate removal
  2938. serverCard.style.transition = 'all 0.3s ease-out';
  2939. serverCard.style.opacity = '0';
  2940. serverCard.style.height = '0';
  2941. serverCard.style.margin = '0';
  2942. serverCard.style.padding = '0';
  2943.  
  2944. setTimeout(() => {
  2945. serverCard.remove();
  2946.  
  2947. // Update localStorage
  2948. const storedData = JSON.parse(localStorage.getItem(storageKey) || "{}");
  2949. delete storedData[serverKey];
  2950. localStorage.setItem(storageKey, JSON.stringify(storedData));
  2951.  
  2952. // If no servers left, show empty message
  2953. if (document.querySelectorAll('.recent-server-card').length === 0) {
  2954. const emptyMessage = document.createElement('div');
  2955. emptyMessage.className = 'no-servers-message';
  2956. emptyMessage.innerHTML = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="opacity: 0.7; margin-right: 10px;">
  2957. <path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="${theme.accentPrimary}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  2958. <path d="M9.09 9C9.3251 8.33167 9.78915 7.76811 10.4 7.40913C11.0108 7.05016 11.7289 6.91894 12.4272 7.03871C13.1255 7.15849 13.7588 7.52152 14.2151 8.06353C14.6713 8.60553 14.9211 9.29152 14.92 10C14.92 12 11.92 13 11.92 13" stroke="${theme.accentPrimary}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  2959. <path d="M12 17H12.01" stroke="${theme.accentPrimary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
  2960. </svg>No Recent Servers Found`;
  2961. emptyMessage.style.cssText = `
  2962. color: ${theme.textSecondary};
  2963. text-align: center;
  2964. padding: 28px 0;
  2965. font-size: 14px;
  2966. letter-spacing: 0.3px;
  2967. font-weight: 500;
  2968. display: flex;
  2969. align-items: center;
  2970. justify-content: center;
  2971. background: rgba(20, 22, 26, 0.4);
  2972. backdrop-filter: blur(5px);
  2973. border-radius: 12px;
  2974. border: 1px solid rgba(77, 133, 238, 0.15);
  2975. box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
  2976. `;
  2977. cardsWrapper.appendChild(emptyMessage);
  2978. }
  2979. }, 300);
  2980. });
  2981.  
  2982. // Create a separator element
  2983. const separator = document.createElement('div');
  2984. separator.style.cssText = `
  2985. height: 24px;
  2986. width: 1px;
  2987. background-color: rgba(255, 255, 255, 0.15);
  2988. margin: 0 2px;
  2989. `;
  2990.  
  2991. const joinButton = document.createElement('button');
  2992. joinButton.innerHTML = `
  2993. <svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin-right: 6px;">
  2994. <path d="M5 12H19" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
  2995. <path d="M12 5L19 12L12 19" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
  2996. </svg>
  2997. Join
  2998. `;
  2999. joinButton.className = 'btn-control-xs join-button';
  3000. joinButton.style.cssText = `
  3001. background: ${theme.accentGradient};
  3002. color: white;
  3003. border: none;
  3004. padding: 8px 18px;
  3005. border-radius: 10px;
  3006. font-size: 13px;
  3007. font-weight: 600;
  3008. cursor: pointer;
  3009. transition: all 0.15s ease;
  3010. letter-spacing: 0.4px;
  3011. box-shadow: 0 2px 10px rgba(52, 100, 201, 0.3);
  3012. display: flex;
  3013. align-items: center;
  3014. justify-content: center;
  3015. `;
  3016.  
  3017. // Add join button functionality
  3018. joinButton.addEventListener('click', function() {
  3019. try {
  3020. Roblox.GameLauncher.joinGameInstance(gameId, serverId);
  3021. } catch (error) {
  3022. ConsoleLogEnabled("Error joining game:", error);
  3023. }
  3024. });
  3025.  
  3026. // Add hover effect for join button
  3027. joinButton.onmouseover = function() {
  3028. this.style.background = theme.accentGradientHover;
  3029. this.style.boxShadow = '0 4px 12px rgba(77, 133, 238, 0.4)';
  3030. this.style.transform = 'translateY(-1px)';
  3031. };
  3032.  
  3033. joinButton.onmouseout = function() {
  3034. this.style.background = theme.accentGradient;
  3035. this.style.boxShadow = '0 2px 10px rgba(52, 100, 201, 0.3)';
  3036. this.style.transform = 'translateY(0)';
  3037. };
  3038.  
  3039. const inviteButton = document.createElement('button');
  3040. inviteButton.innerHTML = `
  3041. <svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin-right: 6px;">
  3042. <path d="M16 18L18 20L22 16" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  3043. <path d="M20 12V13.4C20 13.4 19.5 13 19 13C18.5 13 18 13.5 18 14C18 14.5 18.5 15 19 15C19.5 15 20 14.6 20 14.6V16" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  3044. <path d="M4 20C4 17 7 17 8 17C9 17 13 17 13 17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
  3045. <path d="M9.5 10C10.8807 10 12 8.88071 12 7.5C12 6.11929 10.8807 5 9.5 5C8.11929 5 7 6.11929 7 7.5C7 8.88071 8.11929 10 9.5 10Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  3046. </svg>
  3047. Invite
  3048. `;
  3049. inviteButton.className = 'btn-control-xs invite-button';
  3050. inviteButton.style.cssText = `
  3051. background: rgba(28, 31, 37, 0.6);
  3052. color: ${theme.textPrimary};
  3053. border: 1px solid rgba(255, 255, 255, 0.12);
  3054. padding: 8px 18px;
  3055. border-radius: 10px;
  3056. font-size: 13px;
  3057. font-weight: 500;
  3058. cursor: pointer;
  3059. transition: all 0.15s ease;
  3060. display: flex;
  3061. align-items: center;
  3062. justify-content: center;
  3063. backdrop-filter: blur(4px);
  3064. `;
  3065.  
  3066. // Add invite button functionality
  3067. inviteButton.addEventListener('click', function() {
  3068. const inviteUrl = `https://oqarshi.github.io/Invite/?placeid=${gameId}&serverid=${serverId}`;
  3069.  
  3070. // Copy to clipboard
  3071. navigator.clipboard.writeText(inviteUrl).then(
  3072. function() {
  3073. // Show feedback that URL was copied
  3074. const originalText = inviteButton.innerHTML;
  3075. inviteButton.innerHTML = `
  3076. <svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin-right: 6px;">
  3077. <path d="M20 6L9 17L4 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
  3078. </svg>
  3079. Copied!
  3080. `;
  3081. ConsoleLogEnabled(`Invite link copied to clipboard`);
  3082. notifications('Success! Invite link copied to clipboard!', 'success', '🎉', ' 2000');
  3083. // Reset button after 2 seconds
  3084. setTimeout(() => {
  3085. inviteButton.innerHTML = originalText;
  3086. }, 2000);
  3087. },
  3088. function(err) {
  3089. ConsoleLogEnabled('Could not copy text: ', err);
  3090. }
  3091. );
  3092. });
  3093.  
  3094. // Add hover effect for invite button
  3095. inviteButton.onmouseover = function() {
  3096. this.style.background = 'rgba(35, 39, 46, 0.8)';
  3097. this.style.borderColor = 'rgba(255, 255, 255, 0.18)';
  3098. this.style.transform = 'translateY(-1px)';
  3099. };
  3100.  
  3101. inviteButton.onmouseout = function() {
  3102. this.style.background = 'rgba(28, 31, 37, 0.6)';
  3103. this.style.borderColor = 'rgba(255, 255, 255, 0.12)';
  3104. this.style.transform = 'translateY(0)';
  3105. };
  3106.  
  3107. // MODIFIED: Now add buttons in the new order: Remove, Separator, Join, Invite
  3108. buttonGroup.appendChild(removeButton);
  3109. buttonGroup.appendChild(separator);
  3110. buttonGroup.appendChild(joinButton);
  3111. buttonGroup.appendChild(inviteButton);
  3112.  
  3113. serverCard.appendChild(left);
  3114. serverCard.appendChild(buttonGroup);
  3115. cardsWrapper.appendChild(serverCard);
  3116.  
  3117. // Add subtle line accent
  3118. const lineAccent = document.createElement('div');
  3119. lineAccent.style.cssText = `
  3120. position: absolute;
  3121. left: 0;
  3122. top: 16px;
  3123. bottom: 16px;
  3124. width: 3px;
  3125. background: ${theme.accentGradient};
  3126. border-radius: 0 2px 2px 0;
  3127. `;
  3128. serverCard.appendChild(lineAccent);
  3129.  
  3130. // Add subtle corner accent
  3131. if (index === 0) {
  3132. const cornerAccent = document.createElement('div');
  3133. cornerAccent.style.cssText = `
  3134. position: absolute;
  3135. right: 0;
  3136. top: 0;
  3137. width: 40px;
  3138. height: 40px;
  3139. overflow: hidden;
  3140. pointer-events: none;
  3141. `;
  3142.  
  3143. const cornerInner = document.createElement('div');
  3144. cornerInner.style.cssText = `
  3145. position: absolute;
  3146. right: -20px;
  3147. top: -20px;
  3148. width: 40px;
  3149. height: 40px;
  3150. background: ${theme.accentPrimary};
  3151. transform: rotate(45deg);
  3152. opacity: 0.15;
  3153. `;
  3154.  
  3155. cornerAccent.appendChild(cornerInner);
  3156. serverCard.appendChild(cornerAccent);
  3157. }
  3158. });
  3159.  
  3160. contentContainer.appendChild(cardsWrapper);
  3161. }
  3162.  
  3163. recentSection.appendChild(headerContainer);
  3164. recentSection.appendChild(contentContainer);
  3165. friendsSectionHeader.parentNode.insertBefore(recentSection, friendsSectionHeader);
  3166. }
  3167.  
  3168.  
  3169.  
  3170.  
  3171. /*******************************************************
  3172. name of function: createPopup
  3173. description: Creates a popup with server filtering options and interactive buttons.
  3174. *******************************************************/
  3175.  
  3176. function createPopup() {
  3177. const popup = document.createElement('div');
  3178. popup.className = 'server-filters-dropdown-box'; // Unique class name
  3179. popup.style.cssText = `
  3180. position: absolute;
  3181. width: 210px;
  3182. height: 382px;
  3183. right: 0px;
  3184. top: 30px;
  3185. z-index: 1000;
  3186. border-radius: 5px;
  3187. background-color: rgb(30, 32, 34);
  3188. display: flex;
  3189. flex-direction: column;
  3190. padding: 5px;
  3191. `;
  3192.  
  3193. // Create the header section
  3194. const header = document.createElement('div');
  3195. header.style.cssText = `
  3196. display: flex;
  3197. align-items: center;
  3198. padding: 10px;
  3199. border-bottom: 1px solid #444;
  3200. margin-bottom: 5px;
  3201. `;
  3202.  
  3203. // Add the logo (base64 image)
  3204. const logo = document.createElement('img');
  3205. logo.src = window.Base64Images.logo;
  3206. logo.style.cssText = `
  3207. width: 24px;
  3208. height: 24px;
  3209. margin-right: 10px;
  3210. `;
  3211.  
  3212. // Add the title
  3213. const title = document.createElement('span');
  3214. title.textContent = 'RoLocate';
  3215. title.style.cssText = `
  3216. color: white;
  3217. font-size: 18px;
  3218. font-weight: bold;
  3219. `;
  3220.  
  3221. // Append logo and title to the header
  3222. header.appendChild(logo);
  3223. header.appendChild(title);
  3224.  
  3225. // Append the header to the popup
  3226. popup.appendChild(header);
  3227.  
  3228. // Define unique names, tooltips, experimental status, and explanations for each button
  3229. const buttonData = [{
  3230. name: "Smallest Servers",
  3231. tooltip: "**Reverses the order of the server list.** The emptiest servers will be displayed first.",
  3232. experimental: false
  3233. },
  3234. {
  3235. name: "Available Space",
  3236. tooltip: "**Filters out servers which are full.** Servers with space will only be shown.",
  3237. experimental: false
  3238. },
  3239. {
  3240. name: "Player Count",
  3241. tooltip: "**Rolocate will find servers with your specified player count or fewer.** Searching for up to 3 minutes. If no exact match is found, it shows servers closest to the target.",
  3242. experimental: false
  3243. },
  3244. {
  3245. name: "Random Shuffle",
  3246. tooltip: "**Display servers in a completely random order.** Shows servers with space and servers with low player counts in a randomized order.",
  3247. experimental: false
  3248. },
  3249. {
  3250. name: "Server Region",
  3251. tooltip: "**Filters servers by region.** Offering more accuracy than 'Best Connection' in areas with fewer Roblox servers, like India, or in games with high player counts.",
  3252. experimental: true,
  3253. experimentalExplanation: "**Experimental**: Still in development and testing. Sometimes user location cannot be detected."
  3254. },
  3255. {
  3256. name: "Best Connection",
  3257. tooltip: "**Automatically joins the fastest servers for you.** However, it may be less accurate in regions with fewer Roblox servers, like India, or in games with large player counts.",
  3258. experimental: true,
  3259. experimentalExplanation: "**Experimental**: Still in development and testing. it may be less accurate in regions with fewer Roblox servers"
  3260. },
  3261. {
  3262. name: "Join Small Server",
  3263. tooltip: "**Automatically tries to join a server with a very low population.** On popular games servers may fill up very fast so you might not always get in alone.",
  3264. experimental: false
  3265. },
  3266. {
  3267. name: "Locate Player",
  3268. tooltip: "**Finds and joins the server a user is playing on if they are playing this particular game.** Note: May take a while for very popular games.",
  3269. experimental: false,
  3270. disabled: true,
  3271. disabledExplanation: "**Disabled**: Due to the recent Roblox update, this feature no longer works. :("
  3272. }
  3273. ];
  3274.  
  3275. // Create buttons with unique names, tooltips, experimental status, and explanations
  3276. buttonData.forEach((data, index) => {
  3277. const buttonContainer = document.createElement('div');
  3278. buttonContainer.className = 'server-filter-option';
  3279. buttonContainer.classList.add(data.disabled ? "disabled" : "enabled");
  3280.  
  3281. // Create a wrapper for the button content that can have opacity applied
  3282. const buttonContentWrapper = document.createElement('div');
  3283. buttonContentWrapper.style.cssText = `
  3284. width: 100%;
  3285. height: 100%;
  3286. display: flex;
  3287. align-items: center;
  3288. justify-content: center;
  3289. ${data.disabled ? 'opacity: 0.7;' : ''}
  3290. `;
  3291.  
  3292. buttonContainer.style.cssText = `
  3293. width: 190px;
  3294. height: 30px;
  3295. background-color: ${data.disabled ? '#2c2c2c' : '#393B3D'};
  3296. margin: 5px;
  3297. border-radius: 5px;
  3298. padding: 3.5px;
  3299. position: relative;
  3300. cursor: ${data.disabled ? 'not-allowed' : 'pointer'};
  3301. display: flex;
  3302. align-items: center;
  3303. justify-content: center;
  3304. transition: background-color 0.3s ease;
  3305. `;
  3306.  
  3307. const tooltip = document.createElement('div');
  3308. tooltip.className = 'filter-tooltip';
  3309. tooltip.style.cssText = `
  3310. display: none;
  3311. position: absolute;
  3312. top: -10px;
  3313. left: 200px;
  3314. width: auto;
  3315. inline-size: 200px;
  3316. height: auto;
  3317. background-color: #191B1D;
  3318. color: white;
  3319. padding: 5px;
  3320. border-radius: 5px;
  3321. white-space: pre-wrap;
  3322. font-size: 14px;
  3323. opacity: 1;
  3324. z-index: 1001;
  3325. `;
  3326.  
  3327. // Parse tooltip text and replace **...** with bold HTML tags
  3328. tooltip.innerHTML = data.tooltip.replace(/\*\*(.*?)\*\*/g, "<b style='color: #068f00;'>$1</b>");
  3329.  
  3330. const buttonText = document.createElement('p');
  3331. buttonText.style.cssText = `
  3332. margin: 0;
  3333. color: white;
  3334. font-size: 16px;
  3335. `;
  3336. buttonText.textContent = data.name;
  3337.  
  3338. // Add "DISABLED" style if the button is disabled
  3339. if (data.disabled) {
  3340. // Show explanation tooltip (left side like experimental)
  3341. const disabledTooltip = document.createElement('div');
  3342. disabledTooltip.className = 'disabled-tooltip';
  3343. disabledTooltip.style.cssText = `
  3344. display: none;
  3345. position: absolute;
  3346. top: 0;
  3347. right: 200px;
  3348. width: 200px;
  3349. background-color: #191B1D;
  3350. color: white;
  3351. padding: 5px;
  3352. border-radius: 5px;
  3353. font-size: 14px;
  3354. white-space: pre-wrap;
  3355. z-index: 1001;
  3356. opacity: 1;
  3357. `;
  3358. disabledTooltip.innerHTML = data.disabledExplanation.replace(/\*\*(.*?)\*\*/g, '<span style="font-weight: bold; color: #ff5555;">$1</span>');
  3359.  
  3360. buttonContainer.appendChild(disabledTooltip);
  3361.  
  3362. // Add disabled indicator
  3363. const disabledIndicator = document.createElement('span');
  3364. disabledIndicator.textContent = 'DISABLED';
  3365. disabledIndicator.style.cssText = `
  3366. margin-left: 8px;
  3367. color: #ff5555;
  3368. font-size: 10px;
  3369. font-weight: bold;
  3370. background-color: rgba(255, 85, 85, 0.1);
  3371. padding: 1px 4px;
  3372. border-radius: 3px;
  3373. `;
  3374. buttonText.appendChild(disabledIndicator);
  3375.  
  3376. // Show on hover
  3377. buttonContainer.addEventListener('mouseenter', () => {
  3378. disabledTooltip.style.display = 'block';
  3379. });
  3380. buttonContainer.addEventListener('mouseleave', () => {
  3381. disabledTooltip.style.display = 'none';
  3382. });
  3383. }
  3384.  
  3385. // Add "EXP" label if the button is experimental
  3386. if (data.experimental) {
  3387. const expLabel = document.createElement('span');
  3388. expLabel.textContent = 'EXP';
  3389. expLabel.style.cssText = `
  3390. margin-left: 8px;
  3391. color: gold;
  3392. font-size: 12px;
  3393. font-weight: bold;
  3394. background-color: rgba(255, 215, 0, 0.1);
  3395. padding: 2px 6px;
  3396. border-radius: 3px;
  3397. `;
  3398. buttonText.appendChild(expLabel);
  3399. }
  3400.  
  3401. // Add experimental explanation tooltip (left side)
  3402. let experimentalTooltip = null;
  3403. if (data.experimental) {
  3404. experimentalTooltip = document.createElement('div');
  3405. experimentalTooltip.className = 'experimental-tooltip';
  3406. experimentalTooltip.style.cssText = `
  3407. display: none;
  3408. position: absolute;
  3409. top: 0;
  3410. right: 200px;
  3411. width: 200px;
  3412. background-color: #191B1D;
  3413. color: white;
  3414. padding: 5px;
  3415. border-radius: 5px;
  3416. font-size: 14px;
  3417. white-space: pre-wrap;
  3418. z-index: 1001;
  3419. opacity: 1;
  3420. `;
  3421.  
  3422. // Function to replace **text** with bold and gold styled text
  3423. const formatText = (text) => {
  3424. return text.replace(/\*\*(.*?)\*\*/g, '<span style="font-weight: bold; color: gold;">$1</span>');
  3425. };
  3426.  
  3427. // Apply the formatting to the experimental explanation
  3428. experimentalTooltip.innerHTML = formatText(data.experimentalExplanation);
  3429.  
  3430. buttonContainer.appendChild(experimentalTooltip);
  3431. }
  3432.  
  3433. // Append tooltip directly to button container so it won't inherit opacity
  3434. buttonContainer.appendChild(tooltip);
  3435.  
  3436. // Append button text to content wrapper
  3437. buttonContentWrapper.appendChild(buttonText);
  3438.  
  3439. // Append content wrapper to button container
  3440. buttonContainer.appendChild(buttonContentWrapper);
  3441.  
  3442. buttonContainer.addEventListener('mouseover', () => {
  3443. tooltip.style.display = 'block';
  3444. if (data.experimental) {
  3445. experimentalTooltip.style.display = 'block';
  3446. }
  3447. // Only change background color on hover if the button is not disabled
  3448. if (!data.disabled) {
  3449. buttonContainer.style.backgroundColor = '#4A4C4E'; // Hover effect
  3450. }
  3451. });
  3452. buttonContainer.addEventListener('mouseout', () => {
  3453. tooltip.style.display = 'none';
  3454. if (data.experimental) {
  3455. experimentalTooltip.style.display = 'none';
  3456. }
  3457. // Only revert background color if the button is not disabled
  3458. if (!data.disabled) {
  3459. buttonContainer.style.backgroundColor = '#393B3D'; // Revert to original color
  3460. }
  3461. });
  3462.  
  3463. buttonContainer.addEventListener('click', () => {
  3464. // Prevent click functionality for disabled buttons
  3465. if (data.disabled) {
  3466. return;
  3467. }
  3468.  
  3469. switch (index) {
  3470. case 0:
  3471. smallest_servers();
  3472. break;
  3473. case 1:
  3474. available_space_servers();
  3475. break;
  3476. case 2:
  3477. player_count_tab();
  3478. break;
  3479. case 3:
  3480. random_servers();
  3481. break;
  3482. case 4:
  3483. createServerCountPopup((totalLimit) => {
  3484. rebuildServerList(gameId, totalLimit);
  3485. });
  3486. break;
  3487. case 5:
  3488. rebuildServerList(gameId, 50, true);
  3489. break;
  3490. case 6:
  3491. auto_join_small_server();
  3492. break;
  3493. case 7:
  3494. find_user_server_tab();
  3495. break;
  3496. }
  3497. });
  3498.  
  3499. popup.appendChild(buttonContainer);
  3500. });
  3501.  
  3502. return popup;
  3503. }
  3504.  
  3505. /*******************************************************
  3506. name of function: ServerHop
  3507. description: Handles server hopping by fetching and joining a random server, excluding recently joined servers.
  3508. *******************************************************/
  3509. // Main function to handle the server hopping
  3510. function ServerHop() {
  3511. ConsoleLogEnabled("Starting server hop...");
  3512. showLoadingOverlay();
  3513.  
  3514. // Extract the game ID from the URL
  3515. const url = window.location.href;
  3516. const gameId = url.split("/")[4]; // Extracts the game ID, assuming URL is in the format: /games/{gameId}/Title
  3517.  
  3518. ConsoleLogEnabled(`Game ID: ${gameId}`);
  3519.  
  3520. // Array to store server IDs
  3521. let serverIds = [];
  3522. let nextPageCursor = null;
  3523. let pagesRequested = 0;
  3524.  
  3525. // Get the list of all recently joined servers in localStorage
  3526. const allStoredServers = Object.keys(localStorage)
  3527. .filter(key => key.startsWith("ROLOCATE_recentServers_"))
  3528. .map(key => JSON.parse(localStorage.getItem(key)));
  3529.  
  3530. // Remove any expired servers for all games (older than 15 minutes)
  3531. const currentTime = new Date().getTime();
  3532. allStoredServers.forEach(storedServers => {
  3533. const validServers = storedServers.filter(server => {
  3534. const lastJoinedTime = new Date(server.timestamp).getTime();
  3535. return (currentTime - lastJoinedTime) <= 15 * 60 * 1000; // 15 minutes
  3536. });
  3537.  
  3538. // Update localStorage with the valid (non-expired) servers
  3539. localStorage.setItem(`ROLOCATE_recentServers_${gameId}`, JSON.stringify(validServers));
  3540. });
  3541.  
  3542. // Get the list of recently joined servers for the current game
  3543. const storedServers = JSON.parse(localStorage.getItem(`ROLOCATE_recentServers_${gameId}`)) || [];
  3544.  
  3545. // Check if there are any recently joined servers and exclude them from selection
  3546. const validServers = storedServers.filter(server => {
  3547. const lastJoinedTime = new Date(server.timestamp).getTime();
  3548. return (currentTime - lastJoinedTime) <= 15 * 60 * 1000; // 15 minutes
  3549. });
  3550.  
  3551. if (validServers.length > 0) {
  3552. ConsoleLogEnabled(`Excluding servers joined in the last 15 minutes: ${validServers.map(s => s.serverId).join(', ')}`);
  3553. } else {
  3554. ConsoleLogEnabled("No recently joined servers within the last 15 minutes. Proceeding to pick a new server.");
  3555. }
  3556.  
  3557. // Function to fetch servers
  3558. function fetchServers(cursor) {
  3559. const url = `https://games.roblox.com/v1/games/${gameId}/servers/0?sortOrder=2&excludeFullGames=true&limit=100${cursor ? `&cursor=${cursor}` : ""}`;
  3560.  
  3561. GM_xmlhttpRequest({
  3562. method: "GET",
  3563. url: url,
  3564. onload: function(response) {
  3565. ConsoleLogEnabled("API Response:", response.responseText);
  3566.  
  3567. try {
  3568. const data = JSON.parse(response.responseText);
  3569.  
  3570. // If there's an error, log it and return without processing
  3571. if (data.errors) {
  3572. ConsoleLogEnabled("Skipping unreadable response:", data.errors[0].message);
  3573. return;
  3574. }
  3575.  
  3576. // After a successful request, wait 0.15 seconds before proceeding
  3577. setTimeout(() => {
  3578. if (!data || !data.data) {
  3579. ConsoleLogEnabled("Invalid response structure: 'data' is missing or undefined", data);
  3580. return;
  3581. }
  3582.  
  3583. data.data.forEach(server => {
  3584. if (validServers.some(vs => vs.serverId === server.id)) {
  3585. ConsoleLogEnabled(`Skipping previously joined server ${server.id}.`);
  3586. } else {
  3587. serverIds.push(server.id);
  3588. }
  3589. });
  3590.  
  3591. // Fetch next page if available and within limit
  3592. if (data.nextPageCursor && pagesRequested < 4) {
  3593. pagesRequested++;
  3594. ConsoleLogEnabled(`Fetching page ${pagesRequested}...`);
  3595. fetchServers(data.nextPageCursor);
  3596. } else {
  3597. pickRandomServer();
  3598. }
  3599. }, 150);
  3600.  
  3601. } catch (error) {
  3602. ConsoleLogEnabled("Error parsing response:", error);
  3603. }
  3604. },
  3605. onerror: function(error) {
  3606. ConsoleLogEnabled("Error fetching server data:", error);
  3607. }
  3608. });
  3609. }
  3610.  
  3611. // Function to pick a random server and join it
  3612. function pickRandomServer() {
  3613. if (serverIds.length > 0) {
  3614. const randomServerId = serverIds[Math.floor(Math.random() * serverIds.length)];
  3615. ConsoleLogEnabled(`Joining server: ${randomServerId}`);
  3616.  
  3617. // Join the game instance with the selected server ID
  3618. Roblox.GameLauncher.joinGameInstance(gameId, randomServerId);
  3619.  
  3620. // Store the selected server ID with the time and date in localStorage
  3621. const timestamp = new Date().toISOString();
  3622. const newServer = {
  3623. serverId: randomServerId,
  3624. timestamp
  3625. };
  3626. validServers.push(newServer);
  3627.  
  3628. // Save the updated list of recently joined servers to localStorage
  3629. localStorage.setItem(`ROLOCATE_recentServers_${gameId}`, JSON.stringify(validServers));
  3630.  
  3631. ConsoleLogEnabled(`Server ${randomServerId} stored with timestamp ${timestamp}`);
  3632. } else {
  3633. ConsoleLogEnabled("No servers found to join.");
  3634. notifications("You have joined all the servers recently. No servers found to join.", "error", "⚠️", "5000");
  3635. }
  3636. }
  3637.  
  3638. // Start the fetching process
  3639. fetchServers();
  3640. }
  3641.  
  3642.  
  3643. if (window.location.href.startsWith("https://www.roblox.com/games/")) {
  3644.  
  3645. window.addEventListener("load", () => {
  3646. // Extract game ID from URL
  3647. function findGameId() {
  3648. const match = window.location.href.match(/games\/(\d+)/);
  3649. return match ? match[1] : null;
  3650. }
  3651.  
  3652. // Auto-click "Servers" tab if enabled in localStorage
  3653. if (localStorage.ROLOCATE_AutoRunServerRegions === "true") {
  3654. setTimeout(() => {
  3655. const serversTab = document.querySelector("#tab-game-instances a");
  3656. if (serversTab) {
  3657. serversTab.click();
  3658. }
  3659. }, 1000);
  3660. }
  3661.  
  3662. // Auto-run server regions if enabled in localStorage
  3663. if (localStorage.ROLOCATE_AutoRunServerRegions === "true") {
  3664. setTimeout(() => {
  3665. const gameId = findGameId();
  3666. if (gameId) {
  3667. Loadingbar(true);
  3668. disableFilterButton(true);
  3669. disableLoadMoreButton();
  3670. rebuildServerList(gameId, 16);
  3671. }
  3672. }, 2000);
  3673. }
  3674. });
  3675.  
  3676.  
  3677.  
  3678.  
  3679. Isongamespage = true;
  3680.  
  3681. const observer = new MutationObserver((mutations, obs) => {
  3682. const serverListOptions = document.querySelector('.server-list-options');
  3683. const playButton = document.querySelector('.btn-common-play-game-lg.btn-primary-md');
  3684.  
  3685. if (serverListOptions && !document.querySelector('.RL-filter-button') && localStorage.getItem("ROLOCATE_togglefilterserversbutton") === "true") {
  3686. ConsoleLogEnabled("Added Filter Button");
  3687. const filterButton = document.createElement('a');
  3688. filterButton.className = 'RL-filter-button';
  3689. filterButton.style.cssText = `
  3690. color: white;
  3691. font-weight: bold;
  3692. text-decoration: none;
  3693. cursor: pointer;
  3694. margin-left: 10px;
  3695. padding: 5px 10px;
  3696. display: flex;
  3697. align-items: center;
  3698. gap: 5px;
  3699. position: relative;
  3700. margin-top: 4px;
  3701. `;
  3702.  
  3703. filterButton.addEventListener('mouseover', () => {
  3704. filterButton.style.textDecoration = 'underline';
  3705. });
  3706. filterButton.addEventListener('mouseout', () => {
  3707. filterButton.style.textDecoration = 'none';
  3708. });
  3709.  
  3710. const buttonText = document.createElement('span');
  3711. buttonText.className = 'RL-filter-text';
  3712. buttonText.textContent = 'Filters';
  3713. filterButton.appendChild(buttonText);
  3714.  
  3715. const icon = document.createElement('span');
  3716. icon.className = 'RL-filter-icon';
  3717. icon.textContent = '≡';
  3718. icon.style.cssText = `font-size: 18px;`;
  3719. filterButton.appendChild(icon);
  3720.  
  3721. serverListOptions.appendChild(filterButton);
  3722.  
  3723. let popup = null;
  3724. filterButton.addEventListener('click', (event) => {
  3725. event.stopPropagation();
  3726. if (popup) {
  3727. popup.remove();
  3728. popup = null;
  3729. } else {
  3730. popup = createPopup();
  3731. popup.style.top = `${filterButton.offsetHeight}px`;
  3732. popup.style.left = '0';
  3733. filterButton.appendChild(popup);
  3734. }
  3735. });
  3736.  
  3737. document.addEventListener('click', (event) => {
  3738. if (popup && !filterButton.contains(event.target)) {
  3739. popup.remove();
  3740. popup = null;
  3741. }
  3742. });
  3743. }
  3744. // new condition to trigger recent server logic
  3745. if (localStorage.getItem("ROLOCATE_togglerecentserverbutton") === "true") {
  3746. HandleRecentServers();
  3747. HandleRecentServersURL();
  3748. }
  3749.  
  3750. if (playButton && !document.querySelector('.custom-play-button') && localStorage.getItem("ROLOCATE_toggleserverhopbutton") === "true") {
  3751. ConsoleLogEnabled("Added Server Hop Button");
  3752. const buttonContainer = document.createElement('div');
  3753. buttonContainer.style.cssText = `
  3754. display: flex;
  3755. gap: 10px;
  3756. align-items: center;
  3757. width: 100%;
  3758. `;
  3759.  
  3760. playButton.style.cssText += `
  3761. flex: 3;
  3762. padding: 10px 12px;
  3763. text-align: center;
  3764. `;
  3765.  
  3766. const serverHopButton = document.createElement('button');
  3767. serverHopButton.className = 'custom-play-button';
  3768. serverHopButton.style.cssText = `
  3769. background-color: #335fff;
  3770. color: white;
  3771. border: none;
  3772. padding: 7.5px 12px;
  3773. cursor: pointer;
  3774. font-weight: bold;
  3775. border-radius: 8px;
  3776. flex: 1;
  3777. text-align: center;
  3778. display: flex;
  3779. align-items: center;
  3780. justify-content: center;
  3781. position: relative;
  3782. `;
  3783.  
  3784. const tooltip = document.createElement('div');
  3785. tooltip.textContent = 'Join Random Server / Server Hop';
  3786. tooltip.style.cssText = `
  3787. position: absolute;
  3788. background-color: rgba(51, 95, 255, 0.8);
  3789. color: white;
  3790. padding: 5px 10px;
  3791. border-radius: 5px;
  3792. font-size: 12px;
  3793. visibility: hidden;
  3794. opacity: 0;
  3795. transition: opacity 0.2s ease-in-out;
  3796. bottom: 100%;
  3797. left: 50%;
  3798. transform: translateX(-50%);
  3799. white-space: nowrap;
  3800. `;
  3801. serverHopButton.appendChild(tooltip);
  3802.  
  3803. serverHopButton.addEventListener('mouseover', () => {
  3804. tooltip.style.visibility = 'visible';
  3805. tooltip.style.opacity = '1';
  3806. });
  3807.  
  3808. serverHopButton.addEventListener('mouseout', () => {
  3809. tooltip.style.visibility = 'hidden';
  3810. tooltip.style.opacity = '0';
  3811. });
  3812.  
  3813. const logo = document.createElement('img');
  3814. logo.src = window.Base64Images.icon_serverhop;
  3815. logo.style.cssText = `
  3816. width: 45px;
  3817. height: 45px;
  3818. `;
  3819. serverHopButton.appendChild(logo);
  3820.  
  3821. playButton.parentNode.insertBefore(buttonContainer, playButton);
  3822. buttonContainer.appendChild(playButton);
  3823. buttonContainer.appendChild(serverHopButton);
  3824.  
  3825. serverHopButton.addEventListener('click', () => {
  3826. ServerHop();
  3827. });
  3828. }
  3829.  
  3830. const filterEnabled = localStorage.getItem("ROLOCATE_togglefilterserversbutton") === "true";
  3831. const hopEnabled = localStorage.getItem("ROLOCATE_toggleserverhopbutton") === "true";
  3832. const recentEnabled = localStorage.getItem("ROLOCATE_togglerecentserverbutton") === "true";
  3833.  
  3834. const filterPresent = !filterEnabled || document.querySelector('.RL-filter-button');
  3835. const hopPresent = !hopEnabled || document.querySelector('.custom-play-button');
  3836. const recentPresent = !recentEnabled || document.querySelector('.recent-servers-section');
  3837.  
  3838. if (filterPresent && hopPresent && recentPresent) {
  3839. obs.disconnect();
  3840. ConsoleLogEnabled("Disconnected Observer");
  3841. }
  3842. });
  3843.  
  3844. observer.observe(document.body, {
  3845. childList: true,
  3846. subtree: true
  3847. });
  3848. }
  3849.  
  3850.  
  3851.  
  3852.  
  3853. /*********************************************************************************************************************************************************************************************************************************************
  3854. The End of: This is all of the functions for the filter button and the popup for the 8 buttons does not include the functions for the 8 buttons
  3855.  
  3856. *********************************************************************************************************************************************************************************************************************************************/
  3857.  
  3858.  
  3859. /*********************************************************************************************************************************************************************************************************************************************
  3860. Functions for the 1st button
  3861.  
  3862. *********************************************************************************************************************************************************************************************************************************************/
  3863.  
  3864.  
  3865. /*******************************************************
  3866. name of function: smallest_servers
  3867. description: Fetches the smallest servers, disables the "Load More" button, shows a loading bar, and recreates the server cards.
  3868. *******************************************************/
  3869. async function smallest_servers() {
  3870. // Disable the "Load More" button and show the loading bar
  3871. Loadingbar(true);
  3872. disableFilterButton(true);
  3873. disableLoadMoreButton();
  3874. notifications("Finding small servers...", "success", "🧐");
  3875.  
  3876. // Get the game ID from the URL
  3877. const gameId = window.location.pathname.split('/')[2];
  3878.  
  3879. // Retry mechanism
  3880. let retries = 3;
  3881. let success = false;
  3882.  
  3883. while (retries > 0 && !success) {
  3884. try {
  3885. // Use GM_xmlhttpRequest to fetch server data from the Roblox API
  3886. const response = await new Promise((resolve, reject) => {
  3887. GM_xmlhttpRequest({
  3888. method: "GET",
  3889. url: `https://games.roblox.com/v1/games/${gameId}/servers/0?sortOrder=1&excludeFullGames=true&limit=100`,
  3890. onload: function(response) {
  3891. if (response.status === 429) {
  3892. reject(new Error('429: Too Many Requests'));
  3893. } else if (response.status >= 200 && response.status < 300) {
  3894. resolve(response);
  3895. } else {
  3896. reject(new Error(`HTTP error! status: ${response.status}`));
  3897. }
  3898. },
  3899. onerror: function(error) {
  3900. reject(error);
  3901. }
  3902. });
  3903. });
  3904.  
  3905. const data = JSON.parse(response.responseText);
  3906.  
  3907. // Process each server
  3908. for (const server of data.data) {
  3909. const {
  3910. id: serverId,
  3911. playerTokens,
  3912. maxPlayers,
  3913. playing
  3914. } = server;
  3915.  
  3916. // Pass the server data to the card creation function
  3917. await rbx_card(serverId, playerTokens, maxPlayers, playing, gameId);
  3918. }
  3919.  
  3920. success = true; // Mark as successful if no errors occurred
  3921. } catch (error) {
  3922. retries--; // Decrement the retry count
  3923.  
  3924. if (error.message === '429: Too Many Requests' && retries > 0) {
  3925. ConsoleLogEnabled('Encountered a 429 error. Retrying in 5 seconds...');
  3926. await new Promise(resolve => setTimeout(resolve, 5000)); // Wait for 5 seconds
  3927. } else {
  3928. ConsoleLogEnabled('Error fetching server data:', error);
  3929. notifications('Error: Failed to fetch server data. Please try again later.', 'error', '⚠️', '5000');
  3930. Loadingbar(false);
  3931. break; // Exit the loop if it's not a 429 error or no retries left
  3932. }
  3933. } finally {
  3934. if (success || retries === 0) {
  3935. // Hide the loading bar and enable the filter button
  3936. Loadingbar(false);
  3937. disableFilterButton(false);
  3938. }
  3939. }
  3940. }
  3941. }
  3942.  
  3943.  
  3944.  
  3945. /*********************************************************************************************************************************************************************************************************************************************
  3946. Functions for the 2nd button
  3947.  
  3948. *********************************************************************************************************************************************************************************************************************************************/
  3949.  
  3950.  
  3951. /*******************************************************
  3952. name of function: available_space_servers
  3953. description: Fetches servers with available space, disables the "Load More" button, shows a loading bar, and recreates the server cards.
  3954. *******************************************************/
  3955. async function available_space_servers() {
  3956. // Disable the "Load More" button and show the loading bar
  3957. Loadingbar(true);
  3958. disableLoadMoreButton();
  3959. disableFilterButton(true);
  3960. notifications("Finding servers with space...", "success", "🧐");
  3961.  
  3962. // Get the game ID from the URL
  3963. const gameId = window.location.pathname.split('/')[2];
  3964.  
  3965. // Retry mechanism
  3966. let retries = 3;
  3967. let success = false;
  3968.  
  3969. while (retries > 0 && !success) {
  3970. try {
  3971. // Use GM_xmlhttpRequest to fetch server data from the Roblox API
  3972. const response = await new Promise((resolve, reject) => {
  3973. GM_xmlhttpRequest({
  3974. method: "GET",
  3975. url: `https://games.roblox.com/v1/games/${gameId}/servers/0?sortOrder=2&excludeFullGames=true&limit=100`,
  3976. onload: function(response) {
  3977. if (response.status === 429) {
  3978. reject(new Error('429: Too Many Requests'));
  3979. } else if (response.status >= 200 && response.status < 300) {
  3980. resolve(response);
  3981. } else {
  3982. reject(new Error(`HTTP error! status: ${response.status}`));
  3983. }
  3984. },
  3985. onerror: function(error) {
  3986. reject(error);
  3987. }
  3988. });
  3989. });
  3990.  
  3991. const data = JSON.parse(response.responseText);
  3992.  
  3993. // Process each server
  3994. for (const server of data.data) {
  3995. const {
  3996. id: serverId,
  3997. playerTokens,
  3998. maxPlayers,
  3999. playing
  4000. } = server;
  4001.  
  4002. // Pass the server data to the card creation function
  4003. await rbx_card(serverId, playerTokens, maxPlayers, playing, gameId);
  4004. }
  4005.  
  4006. success = true; // Mark as successful if no errors occurred
  4007. } catch (error) {
  4008. retries--; // Decrement the retry count
  4009.  
  4010. if (error.message === '429: Too Many Requests' && retries > 0) {
  4011. ConsoleLogEnabled('Encountered a 429 error. Retrying in 10 seconds...');
  4012. await new Promise(resolve => setTimeout(resolve, 10000)); // Wait for 10 seconds
  4013. } else {
  4014. ConsoleLogEnabled('Error fetching server data:', error);
  4015. break; // Exit the loop if it's not a 429 error or no retries left
  4016. }
  4017. } finally {
  4018. if (success || retries === 0) {
  4019. // Hide the loading bar and enable the filter button
  4020. Loadingbar(false);
  4021. disableFilterButton(false);
  4022. }
  4023. }
  4024. }
  4025. }
  4026.  
  4027. /*********************************************************************************************************************************************************************************************************************************************
  4028. Functions for the 3rd button
  4029.  
  4030. *********************************************************************************************************************************************************************************************************************************************/
  4031.  
  4032.  
  4033. /*******************************************************
  4034. name of function: player_count_tab
  4035. description: Opens a popup for the user to select the max player count using a slider and filters servers accordingly.
  4036. *******************************************************/
  4037. function player_count_tab() {
  4038. // Check if the max player count has already been determined
  4039. if (!player_count_tab.maxPlayers) {
  4040. // Try to find the element containing the player count information
  4041. const playerCountElement = document.querySelector('.text-info.rbx-game-status.rbx-game-server-status.text-overflow');
  4042. if (playerCountElement) {
  4043. const playerCountText = playerCountElement.textContent.trim();
  4044. const match = playerCountText.match(/(\d+) of (\d+) people max/);
  4045. if (match) {
  4046. const maxPlayers = parseInt(match[2], 10);
  4047. if (!isNaN(maxPlayers) && maxPlayers > 1) {
  4048. player_count_tab.maxPlayers = maxPlayers;
  4049. ConsoleLogEnabled("Found text element with max playercount");
  4050. }
  4051. }
  4052. } else {
  4053. // If the element is not found, extract the gameId from the URL
  4054. const gameIdMatch = window.location.href.match(/games\/(\d+)/);
  4055. if (gameIdMatch && gameIdMatch[1]) {
  4056. const gameId = gameIdMatch[1];
  4057. // Send a request to the Roblox API to get server information
  4058. GM_xmlhttpRequest({
  4059. method: 'GET',
  4060. url: `https://games.roblox.com/v1/games/${gameId}/servers/public?sortOrder=1&excludeFullGames=true&limit=100`,
  4061. onload: function(response) {
  4062. try {
  4063. if (response.status === 429) {
  4064. // Rate limit error, default to 100
  4065. ConsoleLogEnabled("Rate limited defaulting to 100.");
  4066. player_count_tab.maxPlayers = 100;
  4067. } else {
  4068. ConsoleLogEnabled("Valid api response");
  4069. const data = JSON.parse(response.responseText);
  4070. if (data.data && data.data.length > 0) {
  4071. const maxPlayers = data.data[0].maxPlayers;
  4072. if (!isNaN(maxPlayers) && maxPlayers > 1) {
  4073. player_count_tab.maxPlayers = maxPlayers;
  4074. }
  4075. }
  4076. }
  4077. // Update the slider range if the popup is already created
  4078. const slider = document.querySelector('.player-count-popup input[type="range"]');
  4079. if (slider) {
  4080. slider.max = player_count_tab.maxPlayers ? (player_count_tab.maxPlayers - 1).toString() : '100';
  4081. slider.style.background = `
  4082. linear-gradient(
  4083. to right,
  4084. #00A2FF 0%,
  4085. #00A2FF ${slider.value}%,
  4086. #444 ${slider.value}%,
  4087. #444 100%
  4088. );
  4089. `;
  4090. }
  4091. } catch (error) {
  4092. ConsoleLogEnabled('Failed to parse API response:', error);
  4093. // Default to 100 if parsing fails
  4094. player_count_tab.maxPlayers = 100;
  4095. const slider = document.querySelector('.player-count-popup input[type="range"]');
  4096. if (slider) {
  4097. slider.max = '100';
  4098. slider.style.background = `
  4099. linear-gradient(
  4100. to right,
  4101. #00A2FF 0%,
  4102. #00A2FF ${slider.value}%,
  4103. #444 ${slider.value}%,
  4104. #444 100%
  4105. );
  4106. `;
  4107. }
  4108. }
  4109. },
  4110. onerror: function(error) {
  4111. ConsoleLogEnabled('Failed to fetch server information:', error);
  4112. ConsoleLogEnabled('Fallback to 100 players.');
  4113. // Default to 100 if the request fails
  4114. player_count_tab.maxPlayers = 100;
  4115. const slider = document.querySelector('.player-count-popup input[type="range"]');
  4116. if (slider) {
  4117. slider.max = '100';
  4118. slider.style.background = `
  4119. linear-gradient(
  4120. to right,
  4121. #00A2FF 0%,
  4122. #00A2FF ${slider.value}%,
  4123. #444 ${slider.value}%,
  4124. #444 100%
  4125. );
  4126. `;
  4127. }
  4128. }
  4129. });
  4130. }
  4131. }
  4132. }
  4133. // Create the overlay (backdrop)
  4134. const overlay = document.createElement('div');
  4135. overlay.style.cssText = `
  4136. position: fixed;
  4137. top: 0;
  4138. left: 0;
  4139. width: 100%;
  4140. height: 100%;
  4141. background-color: rgba(0, 0, 0, 0.5);
  4142. z-index: 9999;
  4143. opacity: 0;
  4144. transition: opacity 0.3s ease;
  4145. `;
  4146. document.body.appendChild(overlay);
  4147.  
  4148. // Create the popup container
  4149. const popup = document.createElement('div');
  4150. popup.className = 'player-count-popup';
  4151. popup.style.cssText = `
  4152. position: fixed;
  4153. top: 50%;
  4154. left: 50%;
  4155. transform: translate(-50%, -50%);
  4156. background-color: rgb(30, 32, 34);
  4157. padding: 20px;
  4158. border-radius: 10px;
  4159. z-index: 10000;
  4160. box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
  4161. display: flex;
  4162. flex-direction: column;
  4163. align-items: center;
  4164. gap: 15px;
  4165. width: 300px;
  4166. opacity: 0;
  4167. transition: opacity 0.3s ease, transform 0.3s ease;
  4168. `;
  4169.  
  4170. // Add a close button in the top-right corner (bigger size)
  4171. const closeButton = document.createElement('button');
  4172. closeButton.innerHTML = '&times;'; // Using '×' for the close icon
  4173. closeButton.style.cssText = `
  4174. position: absolute;
  4175. top: 10px;
  4176. right: 10px;
  4177. background: transparent;
  4178. border: none;
  4179. color: #ffffff;
  4180. font-size: 24px; /* Increased font size */
  4181. cursor: pointer;
  4182. width: 36px; /* Increased size */
  4183. height: 36px; /* Increased size */
  4184. border-radius: 50%;
  4185. display: flex;
  4186. align-items: center;
  4187. justify-content: center;
  4188. transition: background-color 0.3s ease, color 0.3s ease;
  4189. `;
  4190. closeButton.addEventListener('mouseenter', () => {
  4191. closeButton.style.backgroundColor = 'rgba(255, 255, 255, 0.1)';
  4192. closeButton.style.color = '#ff4444';
  4193. });
  4194. closeButton.addEventListener('mouseleave', () => {
  4195. closeButton.style.backgroundColor = 'transparent';
  4196. closeButton.style.color = '#ffffff';
  4197. });
  4198.  
  4199. // Add a title
  4200. const title = document.createElement('h3');
  4201. title.textContent = 'Select Max Player Count';
  4202. title.style.cssText = `
  4203. color: white;
  4204. margin: 0;
  4205. font-size: 18px;
  4206. font-weight: 500;
  4207. `;
  4208. popup.appendChild(title);
  4209.  
  4210. // Add a slider with improved functionality and styling
  4211. const slider = document.createElement('input');
  4212. slider.type = 'range';
  4213. slider.min = '1';
  4214. slider.max = player_count_tab.maxPlayers ? (player_count_tab.maxPlayers - 1).toString() : '100';
  4215. slider.value = '1'; // Default value
  4216. slider.step = '1'; // Step for better accuracy
  4217. slider.style.cssText = `
  4218. width: 80%;
  4219. cursor: pointer;
  4220. margin: 10px 0;
  4221. -webkit-appearance: none; /* Remove default styling */
  4222. background: transparent;
  4223. `;
  4224. // Custom slider track
  4225. slider.style.background = `
  4226. linear-gradient(
  4227. to right,
  4228. #00A2FF 0%,
  4229. #00A2FF ${slider.value}%,
  4230. #444 ${slider.value}%,
  4231. #444 100%
  4232. );
  4233. border-radius: 5px;
  4234. height: 6px;
  4235. `;
  4236. // Custom slider thumb
  4237. slider.style.setProperty('--thumb-size', '20px'); /* Larger thumb */
  4238. slider.style.setProperty('--thumb-color', '#00A2FF');
  4239. slider.style.setProperty('--thumb-hover-color', '#0088cc');
  4240. slider.style.setProperty('--thumb-border', '2px solid #fff');
  4241. slider.style.setProperty('--thumb-shadow', '0 0 5px rgba(0, 0, 0, 0.5)');
  4242. slider.addEventListener('input', () => {
  4243. slider.style.background = `
  4244. linear-gradient(
  4245. to right,
  4246. #00A2FF 0%,
  4247. #00A2FF ${slider.value}%,
  4248. #444 ${slider.value}%,
  4249. #444 100%
  4250. );
  4251. `;
  4252. sliderValue.textContent = slider.value; // Update the displayed value
  4253. });
  4254. // Keyboard support for better accuracy (fixed to increment/decrement by 1)
  4255. slider.addEventListener('keydown', (e) => {
  4256. e.preventDefault(); // Prevent default behavior (which might cause jumps)
  4257. let newValue = parseInt(slider.value, 10);
  4258. if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {
  4259. newValue = Math.max(1, newValue - 1); // Decrease by 1
  4260. } else if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {
  4261. newValue = Math.min(100, newValue + 1); // Increase by 1
  4262. }
  4263. slider.value = newValue;
  4264. slider.dispatchEvent(new Event('input')); // Trigger input event to update UI
  4265. });
  4266. popup.appendChild(slider);
  4267.  
  4268. // Add a display for the slider value
  4269. const sliderValue = document.createElement('span');
  4270. sliderValue.textContent = slider.value;
  4271. sliderValue.style.cssText = `
  4272. color: white;
  4273. font-size: 16px;
  4274. font-weight: bold;
  4275. `;
  4276. popup.appendChild(sliderValue);
  4277.  
  4278. // Add a submit button with dark, blackish style
  4279. const submitButton = document.createElement('button');
  4280. submitButton.textContent = 'Search';
  4281. submitButton.style.cssText = `
  4282. padding: 8px 20px;
  4283. font-size: 16px;
  4284. background-color: #1a1a1a; /* Dark blackish color */
  4285. color: white;
  4286. border: none;
  4287. border-radius: 5px;
  4288. cursor: pointer;
  4289. transition: background-color 0.3s ease, transform 0.2s ease;
  4290. `;
  4291. submitButton.addEventListener('mouseenter', () => {
  4292. submitButton.style.backgroundColor = '#333'; /* Slightly lighter on hover */
  4293. submitButton.style.transform = 'scale(1.05)';
  4294. });
  4295. submitButton.addEventListener('mouseleave', () => {
  4296. submitButton.style.backgroundColor = '#1a1a1a';
  4297. submitButton.style.transform = 'scale(1)';
  4298. });
  4299.  
  4300. // Add a yellow box with a tip under the submit button
  4301. const tipBox = document.createElement('div');
  4302. tipBox.style.cssText = `
  4303. width: 100%;
  4304. padding: 10px;
  4305. background-color: rgba(255, 204, 0, 0.15);
  4306. border-radius: 5px;
  4307. text-align: center;
  4308. font-size: 14px;
  4309. color: #ffcc00;
  4310. transition: background-color 0.3s ease;
  4311. `;
  4312. tipBox.textContent = 'Tip: Click the slider and use the arrow keys for more accuracy.';
  4313. tipBox.addEventListener('mouseenter', () => {
  4314. tipBox.style.backgroundColor = 'rgba(255, 204, 0, 0.25)';
  4315. });
  4316. tipBox.addEventListener('mouseleave', () => {
  4317. tipBox.style.backgroundColor = 'rgba(255, 204, 0, 0.15)';
  4318. });
  4319. popup.appendChild(tipBox);
  4320.  
  4321. // Append the popup to the body
  4322. document.body.appendChild(popup);
  4323.  
  4324. // Fade in the overlay and popup
  4325. setTimeout(() => {
  4326. overlay.style.opacity = '1';
  4327. popup.style.opacity = '1';
  4328. popup.style.transform = 'translate(-50%, -50%) scale(1)';
  4329. }, 10);
  4330.  
  4331. /*******************************************************
  4332. name of function: fadeOutAndRemove
  4333. description: Fades out and removes the popup and overlay.
  4334. *******************************************************/
  4335. function fadeOutAndRemove(popup, overlay) {
  4336. popup.style.opacity = '0';
  4337. popup.style.transform = 'translate(-50%, -50%) scale(0.9)';
  4338. overlay.style.opacity = '0';
  4339. setTimeout(() => {
  4340. popup.remove();
  4341. overlay.remove();
  4342. }, 300); // Match the duration of the transition
  4343. }
  4344.  
  4345. // Close the popup when clicking outside
  4346. overlay.addEventListener('click', () => {
  4347. fadeOutAndRemove(popup, overlay);
  4348. });
  4349.  
  4350. // Close the popup when the close button is clicked
  4351. closeButton.addEventListener('click', () => {
  4352. fadeOutAndRemove(popup, overlay);
  4353. });
  4354.  
  4355. // Handle submit button click
  4356. submitButton.addEventListener('click', () => {
  4357. const maxPlayers = parseInt(slider.value, 10);
  4358. if (!isNaN(maxPlayers) && maxPlayers > 0) {
  4359. filterServersByPlayerCount(maxPlayers);
  4360. fadeOutAndRemove(popup, overlay);
  4361. } else {
  4362. notifications('Error: Please enter a number greater than 0', 'error', '⚠️', '5000');
  4363. }
  4364. });
  4365.  
  4366. popup.appendChild(submitButton);
  4367. popup.appendChild(closeButton);
  4368. }
  4369. /*******************************************************
  4370. name of function: fetchServersWithRetry
  4371. description: Fetches server data with retry logic and a delay between requests to avoid rate-limiting.
  4372. Uses GM_xmlhttpRequest instead of fetch.
  4373. *******************************************************/
  4374. async function fetchServersWithRetry(url, retries = 15, currentDelay = 750) {
  4375. return new Promise((resolve, reject) => {
  4376. GM_xmlhttpRequest({
  4377. method: 'GET',
  4378. url: url,
  4379. onload: function(response) {
  4380. // Check for 429 Rate Limit error
  4381. if (response.status === 429) {
  4382. if (retries > 0) {
  4383. const newDelay = currentDelay * 1; // Exponential backoff
  4384. ConsoleLogEnabled(`[DEBUG] Rate limited. Waiting ${newDelay / 1000} seconds before retrying...`);
  4385. setTimeout(() => {
  4386. resolve(fetchServersWithRetry(url, retries - 1, newDelay)); // Retry with increased delay
  4387. }, newDelay);
  4388. } else {
  4389. ConsoleLogEnabled('[DEBUG] Rate limit retries exhausted.');
  4390. notifications('Error: Rate limited please try again later.', 'error', '⚠️', '5000')
  4391. reject(new Error('RateLimit'));
  4392. }
  4393. return;
  4394. }
  4395.  
  4396. // Handle other HTTP errors
  4397. if (response.status < 200 || response.status >= 300) {
  4398. ConsoleLogEnabled('[DEBUG] HTTP error:', response.status, response.statusText);
  4399. reject(new Error(`HTTP error: ${response.status}`));
  4400. return;
  4401. }
  4402.  
  4403. // Parse and return the JSON data
  4404. try {
  4405. const data = JSON.parse(response.responseText);
  4406. ConsoleLogEnabled('[DEBUG] Fetched data successfully:', data);
  4407. resolve(data);
  4408. } catch (error) {
  4409. ConsoleLogEnabled('[DEBUG] Error parsing JSON:', error);
  4410. reject(error);
  4411. }
  4412. },
  4413. onerror: function(error) {
  4414. ConsoleLogEnabled('[DEBUG] Error in GM_xmlhttpRequest:', error);
  4415. reject(error);
  4416. }
  4417. });
  4418. });
  4419. }
  4420.  
  4421. /*******************************************************
  4422. name of function: filterServersByPlayerCount
  4423. description: Filters servers to show only those with a player count equal to or below the specified max.
  4424. If no exact matches are found, prioritizes servers with player counts lower than the input.
  4425. Keeps fetching until at least 8 servers are found, with a dynamic delay between requests.
  4426. *******************************************************/
  4427. async function filterServersByPlayerCount(maxPlayers) {
  4428. // Validate maxPlayers before proceeding
  4429. if (isNaN(maxPlayers) || maxPlayers < 1 || !Number.isInteger(maxPlayers)) {
  4430. ConsoleLogEnabled('[DEBUG] Invalid input for maxPlayers.');
  4431. notifications('Error: Please input a valid whole number greater than or equal to 1.', 'error', '⚠️', '5000');
  4432. return;
  4433. }
  4434.  
  4435. // Disable UI elements and clear the server list
  4436. Loadingbar(true);
  4437. disableLoadMoreButton();
  4438. disableFilterButton(true);
  4439. const serverList = document.querySelector('#rbx-public-game-server-item-container');
  4440. serverList.innerHTML = '';
  4441.  
  4442. const gameId = window.location.pathname.split('/')[2];
  4443. let cursor = null;
  4444. let serversFound = 0;
  4445. let serverMaxPlayers = null;
  4446. let isCloserToOne = null;
  4447. let topDownServers = []; // Servers collected during top-down search
  4448. let bottomUpServers = []; // Servers collected during bottom-up search
  4449. let currentDelay = 500; // Initial delay of 0.5 seconds
  4450. const timeLimit = 3 * 60 * 1000; // 3 minutes in milliseconds
  4451. const startTime = Date.now(); // Record the start time
  4452. notifications('Will search for a maximum of 3 minutes to find a server.', 'success', '🔎', '5000');
  4453.  
  4454.  
  4455. try {
  4456. while (serversFound < 16) {
  4457. // Check if the time limit has been exceeded
  4458. if (Date.now() - startTime > timeLimit) {
  4459. ConsoleLogEnabled('[DEBUG] Time limit reached. Proceeding to fallback servers.');
  4460. notifications('Warning: Time limit reached. Proceeding to fallback servers.', 'warning', '❗', '5000');
  4461. break;
  4462. }
  4463.  
  4464. // Fetch initial data to determine serverMaxPlayers and isCloserToOne
  4465. if (!serverMaxPlayers) {
  4466. const initialUrl = cursor ?
  4467. `https://games.roblox.com/v1/games/${gameId}/servers/public?excludeFullGames=true&limit=100&cursor=${cursor}` :
  4468. `https://games.roblox.com/v1/games/${gameId}/servers/public?excludeFullGames=true&limit=100`;
  4469.  
  4470. const initialData = await fetchServersWithRetry(initialUrl);
  4471. if (initialData.data.length > 0) {
  4472. serverMaxPlayers = initialData.data[0].maxPlayers;
  4473. isCloserToOne = maxPlayers <= (serverMaxPlayers / 2);
  4474. } else {
  4475. notifications("No servers found in initial fetch.", "error", "⚠️", "5000")
  4476. ConsoleLogEnabled('[DEBUG] No servers found in initial fetch.', 'warning', '❗');
  4477. break;
  4478. }
  4479. }
  4480.  
  4481. // Validate maxPlayers against serverMaxPlayers
  4482. if (maxPlayers >= serverMaxPlayers) {
  4483. ConsoleLogEnabled('[DEBUG] Invalid input: maxPlayers is greater than or equal to serverMaxPlayers.');
  4484. notifications(`Error: Please input a number between 1 through ${serverMaxPlayers - 1}`, 'error', '⚠️', '5000');
  4485. return;
  4486. }
  4487.  
  4488. // Adjust the URL based on isCloserToOne
  4489. const baseUrl = isCloserToOne ?
  4490. `https://games.roblox.com/v1/games/${gameId}/servers/public?sortOrder=1&excludeFullGames=true&limit=100` :
  4491. `https://games.roblox.com/v1/games/${gameId}/servers/public?excludeFullGames=true&limit=100`; // why does this work lmao
  4492.  
  4493. const url = cursor ? `${baseUrl}&cursor=${cursor}` : baseUrl;
  4494. const data = await fetchServersWithRetry(url);
  4495.  
  4496. // Safety check: Ensure the server list is valid and iterable
  4497. if (!Array.isArray(data.data)) {
  4498. ConsoleLogEnabled('[DEBUG] Invalid server list received. Waiting 1 second before retrying...');
  4499. await delay(1000); // Wait 1 second before retrying
  4500. continue; // Skip the rest of the loop and retry
  4501. }
  4502.  
  4503. // Filter and process servers
  4504. for (const server of data.data) {
  4505. if (server.playing === maxPlayers) {
  4506. await rbx_card(server.id, server.playerTokens, server.maxPlayers, server.playing, gameId);
  4507. serversFound++;
  4508.  
  4509. if (serversFound >= 16) {
  4510. break;
  4511. }
  4512. } else if (!isCloserToOne && server.playing > maxPlayers) {
  4513. topDownServers.push(server); // Add to top-down fallback list
  4514. } else if (isCloserToOne && server.playing < maxPlayers) {
  4515. bottomUpServers.push(server); // Add to bottom-up fallback list
  4516. }
  4517. }
  4518.  
  4519. // Exit if no more servers are available
  4520. if (!data.nextPageCursor) {
  4521. break;
  4522. }
  4523.  
  4524. cursor = data.nextPageCursor;
  4525.  
  4526. // Adjust delay dynamically
  4527. if (currentDelay > 150) {
  4528. currentDelay = Math.max(150, currentDelay / 2); // Gradually reduce delay
  4529. }
  4530. ConsoleLogEnabled(`[DEBUG] Waiting ${currentDelay / 1000} seconds before next request...`);
  4531. await delay(currentDelay);
  4532. }
  4533.  
  4534. // If no exact matches were found or time limit reached, use fallback servers
  4535. if (serversFound === 0 && (topDownServers.length > 0 || bottomUpServers.length > 0)) {
  4536. notifications(`There are no servers with ${maxPlayers} players. Showing servers closest to ${maxPlayers} players.`, 'warning', '😔', '8000');
  4537. // Sort top-down servers by player count (ascending)
  4538. topDownServers.sort((a, b) => a.playing - b.playing);
  4539.  
  4540. // Sort bottom-up servers by player count (descending)
  4541. bottomUpServers.sort((a, b) => b.playing - a.playing);
  4542.  
  4543. // Combine both fallback lists (prioritize top-down servers first)
  4544. const combinedFallback = [...topDownServers, ...bottomUpServers];
  4545.  
  4546. for (const server of combinedFallback) {
  4547. await rbx_card(server.id, server.playerTokens, server.maxPlayers, server.playing, gameId);
  4548. serversFound++;
  4549.  
  4550. if (serversFound >= 16) {
  4551. break;
  4552. }
  4553. }
  4554. }
  4555.  
  4556. if (serversFound <= 0) {
  4557. notifications('No Servers Found Within The Provided Criteria', 'info', '🔎', '5000');
  4558. }
  4559. } catch (error) {
  4560. ConsoleLogEnabled('[DEBUG] Error in filterServersByPlayerCount:', error);
  4561. } finally {
  4562. Loadingbar(false);
  4563. disableFilterButton(false);
  4564. }
  4565. }
  4566.  
  4567. /*********************************************************************************************************************************************************************************************************************************************
  4568. Functions for the 4th button
  4569.  
  4570. *********************************************************************************************************************************************************************************************************************************************/
  4571.  
  4572. /*******************************************************
  4573. name of function: random_servers
  4574. description: Fetches servers from two different URLs, combines the results, ensures no duplicates, shuffles the list, and passes the server information to the rbx_card function in a random order. Handles 429 errors with retries.
  4575. *******************************************************/
  4576. async function random_servers() {
  4577. notifications('Finding Random Servers. Please wait 2-5 seconds', 'success', '🔎', '5000');
  4578. // Disable the "Load More" button and show the loading bar
  4579. Loadingbar(true);
  4580. disableFilterButton(true);
  4581. disableLoadMoreButton();
  4582.  
  4583. // Get the game ID from the URL
  4584. const gameId = window.location.pathname.split('/')[2];
  4585.  
  4586. try {
  4587. // Fetch servers from the first URL with retry logic
  4588. const firstUrl = `https://games.roblox.com/v1/games/${gameId}/servers/public?excludeFullGames=true&limit=10`;
  4589. const firstData = await fetchWithRetry(firstUrl, 10); // Retry up to 3 times
  4590.  
  4591. // Wait for 5 seconds
  4592. await delay(1500);
  4593.  
  4594. // Fetch servers from the second URL with retry logic
  4595. const secondUrl = `https://games.roblox.com/v1/games/${gameId}/servers/public?sortOrder=1&excludeFullGames=true&limit=10`;
  4596. const secondData = await fetchWithRetry(secondUrl, 10); // Retry up to 3 times
  4597.  
  4598. // Combine the servers from both URLs
  4599. const combinedServers = [...firstData.data, ...secondData.data];
  4600.  
  4601. // Remove duplicates by server ID
  4602. const uniqueServers = [];
  4603. const seenServerIds = new Set();
  4604.  
  4605. for (const server of combinedServers) {
  4606. if (!seenServerIds.has(server.id)) {
  4607. seenServerIds.add(server.id);
  4608. uniqueServers.push(server);
  4609. }
  4610. }
  4611.  
  4612. // Shuffle the unique servers array
  4613. const shuffledServers = shuffleArray(uniqueServers);
  4614.  
  4615. // Get the first 16 shuffled servers
  4616. const selectedServers = shuffledServers.slice(0, 16);
  4617.  
  4618. // Process each server in random order
  4619. for (const server of selectedServers) {
  4620. const {
  4621. id: serverId,
  4622. playerTokens,
  4623. maxPlayers,
  4624. playing
  4625. } = server;
  4626.  
  4627. // Pass the server data to the card creation function
  4628. await rbx_card(serverId, playerTokens, maxPlayers, playing, gameId);
  4629. }
  4630. } catch (error) {
  4631. ConsoleLogEnabled('Error fetching server data:', error);
  4632. notifications('Error: Failed to fetch server data. Please try again later.', 'error', '⚠️', '5000');
  4633. } finally {
  4634. // Hide the loading bar and enable the filter button
  4635. Loadingbar(false);
  4636. disableFilterButton(false);
  4637. }
  4638. }
  4639.  
  4640. /*******************************************************
  4641. name of function: fetchWithRetry
  4642. description: Fetches data from a URL with retry logic for 429 errors using GM_xmlhttpRequest.
  4643. *******************************************************/
  4644. function fetchWithRetry(url, retries) {
  4645. return new Promise((resolve, reject) => {
  4646. const attemptFetch = (attempt = 0) => {
  4647. GM_xmlhttpRequest({
  4648. method: "GET",
  4649. url: url,
  4650. onload: function(response) {
  4651. if (response.status === 429) {
  4652. if (attempt < retries) {
  4653. ConsoleLogEnabled(`Rate limited. Retrying in 2.5 seconds... (Attempt ${attempt + 1}/${retries})`);
  4654. setTimeout(() => attemptFetch(attempt + 1), 1500); // Wait 1.5 seconds and retry
  4655. } else {
  4656. reject(new Error('Rate limit exceeded after retries'));
  4657. }
  4658. } else if (response.status >= 200 && response.status < 300) {
  4659. try {
  4660. const data = JSON.parse(response.responseText);
  4661. resolve(data);
  4662. } catch (error) {
  4663. reject(new Error('Failed to parse JSON response'));
  4664. }
  4665. } else {
  4666. reject(new Error(`HTTP error: ${response.status}`));
  4667. }
  4668. },
  4669. onerror: function(error) {
  4670. if (attempt < retries) {
  4671. ConsoleLogEnabled(`Error occurred. Retrying in 10 seconds... (Attempt ${attempt + 1}/${retries})`);
  4672. setTimeout(() => attemptFetch(attempt + 1), 10000); // Wait 10 seconds and retry
  4673. } else {
  4674. reject(error);
  4675. }
  4676. }
  4677. });
  4678. };
  4679.  
  4680. attemptFetch();
  4681. });
  4682. }
  4683.  
  4684. /*******************************************************
  4685. name of function: shuffleArray
  4686. description: Shuffles an array using the Fisher-Yates algorithm.
  4687. *******************************************************/
  4688. function shuffleArray(array) {
  4689. for (let i = array.length - 1; i > 0; i--) {
  4690. const j = Math.floor(Math.random() * (i + 1)); // Random index from 0 to i
  4691. [array[i], array[j]] = [array[j], array[i]]; // Swap elements
  4692. }
  4693. return array;
  4694. }
  4695.  
  4696.  
  4697. /*********************************************************************************************************************************************************************************************************************************************
  4698. Functions for the 5th button. taken from my other project
  4699.  
  4700. *********************************************************************************************************************************************************************************************************************************************/
  4701.  
  4702. if (Isongamespage) {
  4703. // Create a <style> element
  4704. const style = document.createElement('style');
  4705. style.textContent = `
  4706. /* Overlay for the modal background */
  4707. .overlay {
  4708. position: fixed;
  4709. top: 0;
  4710. left: 0;
  4711. width: 100%;
  4712. height: 100%;
  4713. background-color: rgba(0, 0, 0, 0.85); /* Solid black overlay */
  4714. z-index: 1000; /* Ensure overlay is below the popup */
  4715. opacity: 0; /* Start invisible */
  4716. animation: fadeIn 0.3s ease forwards; /* Fade-in animation */
  4717. }
  4718.  
  4719. @keyframes fadeIn {
  4720. from {
  4721. opacity: 0;
  4722. }
  4723. to {
  4724. opacity: 1;
  4725. }
  4726. }
  4727.  
  4728. /* Popup Container for the server region */
  4729. .filter-popup {
  4730. background-color: #1e1e1e; /* Darker background */
  4731. color: #ffffff; /* White text */
  4732. padding: 25px;
  4733. border-radius: 12px;
  4734. box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  4735. width: 320px;
  4736. max-width: 90%;
  4737. position: fixed; /* Fixed positioning */
  4738. top: 50%; /* Center vertically */
  4739. left: 50%; /* Center horizontally */
  4740. transform: translate(-50%, -50%); /* Offset to truly center */
  4741. text-align: center;
  4742. z-index: 1001; /* Ensure popup is above the overlay */
  4743. border: 1px solid #444; /* Subtle border */
  4744. opacity: 0; /* Start invisible */
  4745. animation: fadeInPopup 0.3s ease 0.1s forwards; /* Fade-in animation with delay */
  4746. }
  4747.  
  4748. @keyframes fadeInPopup {
  4749. from {
  4750. opacity: 0;
  4751. transform: translate(-50%, -55%); /* Slight upward offset */
  4752. }
  4753. to {
  4754. opacity: 1;
  4755. transform: translate(-50%, -50%); /* Center position */
  4756. }
  4757. }
  4758.  
  4759. /* Fade-out animation for overlay and popup */
  4760. .overlay.fade-out {
  4761. animation: fadeOut 0.3s ease forwards;
  4762. }
  4763.  
  4764. .filter-popup.fade-out {
  4765. animation: fadeOutPopup 0.3s ease forwards;
  4766. }
  4767.  
  4768. @keyframes fadeOut {
  4769. from {
  4770. opacity: 1;
  4771. }
  4772. to {
  4773. opacity: 0;
  4774. }
  4775. }
  4776.  
  4777. @keyframes fadeOutPopup {
  4778. from {
  4779. opacity: 1;
  4780. transform: translate(-50%, -50%); /* Center position */
  4781. }
  4782. to {
  4783. opacity: 0;
  4784. transform: translate(-50%, -55%); /* Slight upward offset */
  4785. }
  4786. }
  4787.  
  4788. /* Close Button for the server selector */
  4789. #closePopup {
  4790. position: absolute;
  4791. top: 5px; /* Reduced from 12px to 5px */
  4792. right: 1px; /* Reduced from 12px to 5px */
  4793. background: transparent; /* Transparent background */
  4794. border: none;
  4795. color: #ffffff; /* White color */
  4796. font-size: 20px;
  4797. cursor: pointer;
  4798. width: 28px;
  4799. height: 28px;
  4800. border-radius: 50%;
  4801. display: flex;
  4802. align-items: center;
  4803. justify-content: center;
  4804. transition: background-color 0.3s ease, color 0.3s ease;
  4805. }
  4806.  
  4807. #closePopup:hover {
  4808. background-color: rgba(255, 255, 255, 0.1); /* Light hover effect */
  4809. color: #ff4444; /* Red color on hover */
  4810. }
  4811.  
  4812. /* Label */
  4813. .filter-popup label {
  4814. display: block;
  4815. margin-bottom: 12px;
  4816. font-size: 16px;
  4817. color: #ffffff;
  4818. font-weight: 500; /* Slightly bolder text */
  4819. }
  4820.  
  4821. /* Dropdown */
  4822. .filter-popup select {
  4823. background-color: #333; /* Darker gray background */
  4824. color: #ffffff; /* White text */
  4825. padding: 10px;
  4826. border-radius: 6px;
  4827. border: 1px solid #555; /* Darker border */
  4828. width: 100%;
  4829. margin-bottom: 12px;
  4830. font-size: 14px;
  4831. transition: border-color 0.3s ease;
  4832. }
  4833.  
  4834. .filter-popup select:focus {
  4835. border-color: #888; /* Lighter border on focus */
  4836. outline: none;
  4837. }
  4838.  
  4839. /* Custom Input */
  4840. .filter-popup input[type="number"] {
  4841. background-color: #333; /* Darker gray background */
  4842. color: #ffffff; /* White text */
  4843. padding: 10px;
  4844. border-radius: 6px;
  4845. border: 1px solid #555; /* Darker border */
  4846. width: 100%;
  4847. margin-bottom: 12px;
  4848. font-size: 14px;
  4849. transition: border-color 0.3s ease;
  4850. }
  4851.  
  4852. .filter-popup input[type="number"]:focus {
  4853. border-color: #888; /* Lighter border on focus */
  4854. outline: none;
  4855. }
  4856.  
  4857. /* Confirm Button */
  4858. #confirmServerCount {
  4859. background-color: #444; /* Dark gray background */
  4860. color: #ffffff; /* White text */
  4861. padding: 10px 20px;
  4862. border: 1px solid #666; /* Gray border */
  4863. border-radius: 6px;
  4864. cursor: pointer;
  4865. font-size: 14px;
  4866. width: 100%;
  4867. transition: background-color 0.3s ease, transform 0.2s ease;
  4868. }
  4869.  
  4870. #confirmServerCount:hover {
  4871. background-color: #555; /* Lighter gray on hover */
  4872. transform: translateY(-1px); /* Slight lift effect */
  4873. }
  4874.  
  4875. #confirmServerCount:active {
  4876. transform: translateY(0); /* Reset lift effect on click */
  4877. }
  4878.  
  4879. /* Highlighted server item */
  4880. .rbx-game-server-item.highlighted {
  4881. border: 2px solid #4caf50; /* Green border */
  4882. border-radius: 8px;
  4883. background-color: rgba(76, 175, 80, 0.1); /* Subtle green background */
  4884. }
  4885.  
  4886. /* Disabled fetch button */
  4887. .fetch-button:disabled {
  4888. opacity: 0.5;
  4889. cursor: not-allowed;
  4890. }
  4891.  
  4892. /* Popup Header */
  4893. .popup-header {
  4894. margin-bottom: 24px;
  4895. text-align: left;
  4896. padding: 16px;
  4897. background-color: rgba(255, 255, 255, 0.05); /* Subtle background for contrast */
  4898. border-radius: 8px;
  4899. border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
  4900. transition: background-color 0.3s ease, border-color 0.3s ease;
  4901. }
  4902.  
  4903. .popup-header:hover {
  4904. background-color: rgba(255, 255, 255, 0.08); /* Slightly brighter on hover */
  4905. border-color: rgba(255, 255, 255, 0.2);
  4906. }
  4907.  
  4908. .popup-header h3 {
  4909. margin: 0 0 12px 0;
  4910. font-size: 22px;
  4911. color: #ffffff;
  4912. font-weight: 700; /* Bolder for emphasis */
  4913. letter-spacing: -0.5px; /* Tighter letter spacing for modern look */
  4914. }
  4915.  
  4916. .popup-header p {
  4917. margin: 0;
  4918. font-size: 14px;
  4919. color: #cccccc;
  4920. line-height: 1.6; /* Improved line height for readability */
  4921. opacity: 0.9; /* Slightly transparent for a softer look */
  4922. }
  4923.  
  4924. /* Popup Footer */
  4925. .popup-footer {
  4926. margin-top: 20px;
  4927. text-align: left;
  4928. font-size: 14px;
  4929. color: #ffcc00; /* Yellow color for warnings */
  4930. background-color: rgba(255, 204, 0, 0.15); /* Lighter yellow background */
  4931. padding: 12px;
  4932. border-radius: 8px;
  4933. border: 1px solid rgba(255, 204, 0, 0.15); /* Subtle border */
  4934. transition: background-color 0.3s ease, border-color 0.3s ease;
  4935. }
  4936.  
  4937. .popup-footer:hover {
  4938. background-color: rgba(255, 204, 0, 0.25); /* Slightly brighter on hover */
  4939. border-color: rgba(255, 204, 0, 0.25);
  4940. }
  4941.  
  4942. .popup-footer p {
  4943. margin: 0;
  4944. line-height: 1.5;
  4945. font-weight: 500; /* Slightly bolder for emphasis */
  4946. }
  4947.  
  4948. /* Label */
  4949. .filter-popup label {
  4950. display: block;
  4951. margin-bottom: 12px;
  4952. font-size: 15px;
  4953. color: #ffffff;
  4954. font-weight: 500;
  4955. text-align: left;
  4956. opacity: 0.9; /* Slightly transparent for a softer look */
  4957. transition: opacity 0.3s ease;
  4958. }
  4959.  
  4960. .filter-popup label:hover {
  4961. opacity: 1; /* Fully opaque on hover */
  4962. }
  4963.  
  4964. select:hover, select:focus {
  4965. border-color: #ffffff;
  4966. outline: none;
  4967. }
  4968.  
  4969.  
  4970. `;
  4971. // Append the <style> element to the document head
  4972. document.head.appendChild(style);
  4973. }
  4974.  
  4975.  
  4976. function showMessage(message) {
  4977. const loadMoreButtonContainer = document.querySelector('.rbx-public-running-games-footer');
  4978.  
  4979. if (!loadMoreButtonContainer) {
  4980. ConsoleLogEnabled("Error: 'Load More' button container not found! Ensure the element exists in the DOM.");
  4981. return;
  4982. }
  4983.  
  4984. const existingMessage = loadMoreButtonContainer.querySelector('.premium-message-container');
  4985.  
  4986. // If message is "END", remove any existing message and exit
  4987. if (message === "END") {
  4988. if (existingMessage) {
  4989. existingMessage.remove();
  4990. ConsoleLogEnabled("Message container removed.");
  4991. } else {
  4992. ConsoleLogEnabled("No message container found to remove.");
  4993. }
  4994. return;
  4995. }
  4996.  
  4997. // Remove existing message if present before showing a new one
  4998. if (existingMessage) {
  4999. existingMessage.remove();
  5000. ConsoleLogEnabled("Warning: An existing message was found and replaced.");
  5001. }
  5002.  
  5003. // Inject CSS only once
  5004. if (!document.getElementById('premium-message-styles')) {
  5005. const style = document.createElement('style');
  5006. style.id = 'premium-message-styles';
  5007. style.textContent = `
  5008. .premium-message-container {
  5009. margin-top: 20px;
  5010. padding: 18px 26px;
  5011. background: linear-gradient(145deg, #2b0000, #1a0000);
  5012. border-radius: 14px;
  5013. box-shadow: 0 6px 20px rgba(255, 0, 0, 0.2);
  5014. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  5015. font-size: 16px;
  5016. color: #ffdddd;
  5017. transition: all 0.3s ease-in-out, transform 0.3s ease, box-shadow 0.3s ease;
  5018. opacity: 0;
  5019. animation: fadeIn 0.6s ease forwards;
  5020. border: 1px solid #440000;
  5021. backdrop-filter: blur(6px);
  5022. display: flex;
  5023. align-items: center;
  5024. gap: 16px;
  5025. cursor: default;
  5026. user-select: none;
  5027. }
  5028.  
  5029. .premium-message-container:hover {
  5030. transform: scale(1.015);
  5031. box-shadow: 0 8px 24px rgba(255, 0, 0, 0.25);
  5032. background: linear-gradient(145deg, #330000, #220000);
  5033. color: #ffe5e5;
  5034. }
  5035.  
  5036. .premium-message-logo {
  5037. width: 28px;
  5038. height: 28px;
  5039. border-radius: 6px;
  5040. object-fit: contain;
  5041. box-shadow: 0 0 8px rgba(255, 0, 0, 0.2);
  5042. background-color: #000;
  5043. }
  5044.  
  5045. .premium-message-text {
  5046. flex: 1;
  5047. text-align: left;
  5048. font-weight: 500;
  5049. letter-spacing: 0.3px;
  5050. }
  5051.  
  5052. @keyframes fadeIn {
  5053. to { opacity: 1; }
  5054. }
  5055. `;
  5056. document.head.appendChild(style);
  5057. }
  5058.  
  5059. // Create the message container
  5060. const container = document.createElement('div');
  5061. container.className = 'premium-message-container';
  5062.  
  5063. // Create and insert the logo
  5064. const logo = document.createElement('img');
  5065. logo.className = 'premium-message-logo';
  5066. logo.src = window.Base64Images.logo;
  5067.  
  5068. // Create and insert the message text
  5069. const messageText = document.createElement('div');
  5070. messageText.className = 'premium-message-text';
  5071. messageText.textContent = message;
  5072.  
  5073. // Build the full component
  5074. container.appendChild(logo);
  5075. container.appendChild(messageText);
  5076. loadMoreButtonContainer.appendChild(container);
  5077.  
  5078. ConsoleLogEnabled("Message displayed successfully:", message);
  5079. return container;
  5080. }
  5081.  
  5082.  
  5083.  
  5084.  
  5085. // Function to show the popup for random stuff
  5086. function showPopup() {
  5087. const overlay = document.createElement('div');
  5088. overlay.className = 'overlay';
  5089.  
  5090. const popup = document.createElement('div');
  5091. popup.className = 'filter-popup';
  5092. popup.textContent = 'Uh somethings wrong if you see this message. Please report to the greasyfork issues page!';
  5093.  
  5094. document.body.appendChild(overlay);
  5095. document.body.appendChild(popup);
  5096.  
  5097. return popup;
  5098. }
  5099.  
  5100. // Function to hide the popup for the stuff
  5101. function hidePopup() {
  5102. const popup = document.querySelector('.filter-popup');
  5103. const overlay = document.querySelector('.overlay');
  5104.  
  5105. if (popup) popup.remove();
  5106. if (overlay) overlay.remove();
  5107. }
  5108.  
  5109. // Function to fetch server details so game id and job id. yea!
  5110. async function fetchServerDetails(gameId, jobId) {
  5111. const useBatching = localStorage.ROLOCATE_fastservers === "true";
  5112.  
  5113. if (!useBatching) {
  5114. return new Promise((resolve, reject) => {
  5115. GM_xmlhttpRequest({
  5116. method: "POST",
  5117. url: "https://gamejoin.roblox.com/v1/join-game-instance",
  5118. headers: {
  5119. "Content-Type": "application/json",
  5120. "User-Agent": "Roblox/WinInet",
  5121. },
  5122. data: JSON.stringify({
  5123. placeId: gameId,
  5124. gameId: jobId
  5125. }),
  5126. onload: function(response) {
  5127. const json = JSON.parse(response.responseText);
  5128. ConsoleLogEnabled("API Response:", json);
  5129.  
  5130. if (json.status === 12 && json.message === 'You need to purchase access to this game before you can play.') {
  5131. reject('purchase_required');
  5132. return;
  5133. }
  5134.  
  5135. if (json.status === 12 && json.message === 'Cannot join this non-root place due to join restrictions') {
  5136. reject('subplace_join_restriction');
  5137. return;
  5138. }
  5139.  
  5140. const address = json?.joinScript?.UdmuxEndpoints?.[0]?.Address ?? json?.joinScript?.MachineAddress;
  5141. if (!address) {
  5142. ConsoleLogEnabled("API Response (Unknown Location) Which means Full Server!:", json);
  5143. reject(`Unable to fetch server location: Status ${json.status}`);
  5144. return;
  5145. }
  5146.  
  5147. const location = serverRegionsByIp[address.replace(/^(128\.116\.\d+)\.\d+$/, "$1.0")];
  5148. if (!location) {
  5149. ConsoleLogEnabled("API Response (Unknown Location):", json);
  5150. reject(`Unknown server address ${address}`);
  5151. return;
  5152. }
  5153.  
  5154. resolve(location);
  5155. },
  5156. onerror: function(error) {
  5157. ConsoleLogEnabled("API Request Failed:", error);
  5158. reject(`Failed to fetch server details: ${error}`);
  5159. },
  5160. });
  5161. });
  5162. }
  5163.  
  5164. // Batching logic
  5165. const queue = fetchServerDetails._queue || [];
  5166. const concurrencyLimit = 10;
  5167.  
  5168. if (!fetchServerDetails._queue) {
  5169. fetchServerDetails._queue = queue;
  5170. fetchServerDetails._activeCount = 0;
  5171. }
  5172.  
  5173. return new Promise((resolve, reject) => {
  5174. const task = async () => {
  5175. try {
  5176. fetchServerDetails._activeCount++;
  5177. const result = await new Promise((innerResolve, innerReject) => {
  5178. GM_xmlhttpRequest({
  5179. method: "POST",
  5180. url: "https://gamejoin.roblox.com/v1/join-game-instance",
  5181. headers: {
  5182. "Content-Type": "application/json",
  5183. "User-Agent": "Roblox/WinInet",
  5184. },
  5185. data: JSON.stringify({
  5186. placeId: gameId,
  5187. gameId: jobId
  5188. }),
  5189. onload: function(response) {
  5190. const json = JSON.parse(response.responseText);
  5191. ConsoleLogEnabled("API Response:", json);
  5192.  
  5193. if (json.status === 12 && json.message === 'You need to purchase access to this game before you can play.') {
  5194. innerReject('purchase_required');
  5195. return;
  5196. }
  5197.  
  5198. if (json.status === 12 && json.message === 'Cannot join this non-root place due to join restrictions') {
  5199. innerReject('subplace_join_restriction');
  5200. return;
  5201. }
  5202.  
  5203. const address = json?.joinScript?.UdmuxEndpoints?.[0]?.Address ?? json?.joinScript?.MachineAddress;
  5204. if (!address) {
  5205. ConsoleLogEnabled("API Response (Unknown Location) Which means Full Server!:", json);
  5206. innerReject(`Unable to fetch server location: Status ${json.status}`);
  5207. return;
  5208. }
  5209.  
  5210. const location = serverRegionsByIp[address.replace(/^(128\.116\.\d+)\.\d+$/, "$1.0")];
  5211. if (!location) {
  5212. ConsoleLogEnabled("API Response (Unknown Location):", json);
  5213. innerReject(`Unknown server address ${address}`);
  5214. return;
  5215. }
  5216.  
  5217. innerResolve(location);
  5218. },
  5219. onerror: function(error) {
  5220. ConsoleLogEnabled("API Request Failed:", error);
  5221. innerReject(`Failed to fetch server details: ${error}`);
  5222. },
  5223. });
  5224. });
  5225. resolve(result);
  5226. } catch (err) {
  5227. reject(err);
  5228. } finally {
  5229. fetchServerDetails._activeCount--;
  5230. if (queue.length > 0) {
  5231. const next = queue.shift();
  5232. next();
  5233. }
  5234. }
  5235. };
  5236.  
  5237. if (fetchServerDetails._activeCount < concurrencyLimit) {
  5238. task();
  5239. } else {
  5240. queue.push(task);
  5241. }
  5242. });
  5243. }
  5244.  
  5245.  
  5246. // cusomt delay also known as sleep fucntion in js cause this language sucks and doesent have a default function
  5247. function delay(ms) {
  5248. return new Promise(resolve => setTimeout(resolve, ms));
  5249. }
  5250.  
  5251. // Function to create a popup for selecting the number of servers
  5252. // basically yea thats what it doesent
  5253. function createServerCountPopup(callback) {
  5254. const overlay = document.createElement('div');
  5255. overlay.className = 'overlay';
  5256.  
  5257. const popup = document.createElement('div');
  5258. popup.className = 'filter-popup';
  5259.  
  5260. // Inject styles for dropdown icon
  5261. const style = document.createElement('style');
  5262. style.textContent = `
  5263. .dropdown-wrapper {
  5264. position: relative;
  5265. display: inline-block;
  5266. width: 100%;
  5267. }
  5268.  
  5269. .dropdown-wrapper select {
  5270. width: 100%;
  5271. padding-right: 30px;
  5272. appearance: none;
  5273. -webkit-appearance: none;
  5274. -moz-appearance: none;
  5275. }
  5276.  
  5277. .dropdown-wrapper .dropdown-icon {
  5278. position: absolute;
  5279. right: 10px;
  5280. top: 40%;
  5281. transform: translateY(-50%);
  5282. pointer-events: none;
  5283. font-size: 12px;
  5284. color: #fff;
  5285.  
  5286. }
  5287. `;
  5288. document.head.appendChild(style);
  5289.  
  5290. popup.innerHTML = `
  5291. <button id="closePopup">X</button>
  5292. <div class="popup-header">
  5293. <h3>Select Number of Servers</h3>
  5294. <p>Choose how many servers you want to search. Higher values will provide more location variety but may take longer to process.</p>
  5295. <div class="popup-footer">
  5296. <p><strong>Note:</strong> Searching over 500 servers may take longer and could result in rate limiting. It is rare though.</p>
  5297. </div>
  5298. </div>
  5299. <label for="serverCount">Select Number of Servers:</label>
  5300. <div class="dropdown-wrapper">
  5301. <select id="serverCount">
  5302. <option value="10">10 Servers</option>
  5303. <option value="25" selected>25 Servers</option>
  5304. <option value="50">50 Servers</option>
  5305. <option value="100">100 Servers</option>
  5306. <option value="200">200 Servers</option>
  5307. <option value="500">500 Servers</option>
  5308. <option value="1000">1000 Servers</option>
  5309. <option value="custom">Custom</option>
  5310. </select>
  5311. <span class="dropdown-icon">▼</span>
  5312. </div>
  5313. <input id="customServerCount" type="number" min="1" max="1000" placeholder="Enter a number (1-1000)" style="display: none;">
  5314. <button id="confirmServerCount">Confirm</button>
  5315. `;
  5316.  
  5317. document.body.appendChild(overlay);
  5318. document.body.appendChild(popup);
  5319.  
  5320. const serverCountDropdown = popup.querySelector('#serverCount');
  5321. const customServerCountInput = popup.querySelector('#customServerCount');
  5322. const confirmButton = popup.querySelector('#confirmServerCount');
  5323. const closeButton = popup.querySelector('#closePopup');
  5324.  
  5325. serverCountDropdown.addEventListener('change', () => {
  5326. if (serverCountDropdown.value === 'custom') {
  5327. customServerCountInput.style.display = 'block';
  5328. } else {
  5329. customServerCountInput.style.display = 'none';
  5330. }
  5331. });
  5332.  
  5333. confirmButton.addEventListener('click', () => {
  5334. let serverCount;
  5335.  
  5336. if (serverCountDropdown.value === 'custom') {
  5337. serverCount = parseInt(customServerCountInput.value);
  5338. if (isNaN(serverCount) || serverCount < 1 || serverCount > 1000) {
  5339. notifications('Error: Please enter a valid number between 1 and 1000.', 'error', '⚠️', '5000');
  5340. return;
  5341. }
  5342. } else {
  5343. serverCount = parseInt(serverCountDropdown.value);
  5344. }
  5345.  
  5346. if (serverCount > 500) {
  5347. notifications('Searching over 500 servers may take some time and you might get rate limited!', 'info', '⌛', '8000');
  5348. }
  5349.  
  5350. callback(serverCount);
  5351. disableFilterButton(true);
  5352. disableLoadMoreButton(true);
  5353. hidePopup();
  5354. Loadingbar(true);
  5355. });
  5356.  
  5357. closeButton.addEventListener('click', () => {
  5358. hidePopup();
  5359. });
  5360.  
  5361. function hidePopup() {
  5362. const overlay = document.querySelector('.overlay');
  5363. const popup = document.querySelector('.filter-popup');
  5364.  
  5365. overlay.classList.add('fade-out');
  5366. popup.classList.add('fade-out');
  5367.  
  5368. setTimeout(() => {
  5369. overlay.remove();
  5370. popup.remove();
  5371. }, 300);
  5372. }
  5373. }
  5374.  
  5375.  
  5376. // Function to fetch public servers with adaptive rate limiting and logging
  5377. async function fetchPublicServers(gameId, totalLimit) {
  5378. let servers = [];
  5379. let cursor = null;
  5380. let delayTime = 250; // Start with 0.25 seconds
  5381. let retryingDueToRateLimit = false;
  5382. let pageCount = 0;
  5383.  
  5384. ConsoleLogEnabled(`Starting to fetch up to ${totalLimit} public servers for game ${gameId}...`);
  5385.  
  5386. while (servers.length < totalLimit) {
  5387. const url = `https://games.roblox.com/v1/games/${gameId}/servers/public?excludeFullGames=true&limit=100${cursor ? `&cursor=${cursor}` : ''}`;
  5388. pageCount++;
  5389. ConsoleLogEnabled(`Fetching page ${pageCount}... (Current delay: ${delayTime}ms)`);
  5390.  
  5391. let responseData;
  5392. try {
  5393. responseData = await new Promise((resolve, reject) => {
  5394. GM_xmlhttpRequest({
  5395. method: "GET",
  5396. url: url,
  5397. onload: function (response) {
  5398. if (response.status === 429 || !response.responseText) {
  5399. reject({ rateLimited: true });
  5400. } else {
  5401. try {
  5402. const json = JSON.parse(response.responseText);
  5403. resolve(json);
  5404. } catch (err) {
  5405. reject({ rateLimited: true });
  5406. }
  5407. }
  5408. },
  5409. onerror: function (error) {
  5410. reject({ rateLimited: false, error });
  5411. },
  5412. });
  5413. });
  5414.  
  5415. // Recovered from rate limit
  5416. if (retryingDueToRateLimit) {
  5417. delayTime = 250;
  5418. retryingDueToRateLimit = false;
  5419. ConsoleLogEnabled(`Rate limit cleared. Resuming normal delay (${delayTime}ms).`);
  5420. }
  5421.  
  5422. const newServers = responseData.data || [];
  5423. servers = servers.concat(newServers);
  5424. ConsoleLogEnabled(`Fetched ${newServers.length} servers (Total: ${servers.length}/${totalLimit})`);
  5425.  
  5426. if (!responseData.nextPageCursor || servers.length >= totalLimit) {
  5427. ConsoleLogEnabled("No more pages or reached limit.");
  5428. break;
  5429. }
  5430.  
  5431. cursor = responseData.nextPageCursor;
  5432.  
  5433. } catch (err) {
  5434. if (err.rateLimited) {
  5435. delayTime = 750;
  5436. retryingDueToRateLimit = true;
  5437. ConsoleLogEnabled("⚠️ Rate limited. Increasing delay to 0.75s...");
  5438. } else {
  5439. ConsoleLogEnabled("❌ Failed to fetch due to error:", err.error);
  5440. break;
  5441. }
  5442. }
  5443.  
  5444. await delay(delayTime);
  5445. }
  5446.  
  5447. ConsoleLogEnabled(`✅ Done. Fetched ${servers.length} servers in total.`);
  5448. return servers.slice(0, totalLimit);
  5449. }
  5450. function createFilterDropdowns(servers) {
  5451. // Create the main filter container
  5452. const filterContainer = document.createElement('div');
  5453. Object.assign(filterContainer.style, {
  5454. display: 'flex',
  5455. gap: '28px',
  5456. alignItems: 'center',
  5457. padding: '32px 36px',
  5458. background: 'linear-gradient(145deg, rgba(18,18,18,0.98) 0%, rgba(10,10,10,0.98) 100%)',
  5459. borderRadius: '24px',
  5460. boxShadow: '0 20px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05)',
  5461. backdropFilter: 'blur(30px)',
  5462. opacity: '0',
  5463. transform: 'translateY(-40px) scale(0.95)',
  5464. transition: 'all 0.9s cubic-bezier(0.19, 1, 0.22, 1)',
  5465. position: 'relative',
  5466. border: '1px solid rgba(255,255,255,0.08)',
  5467. margin: '32px',
  5468. fontFamily: "'Inter', system-ui, -apple-system, sans-serif",
  5469. fontSize: '16px'
  5470. });
  5471.  
  5472. // Enhanced animated border glow with more effect
  5473. const borderGlow = document.createElement('div');
  5474. Object.assign(borderGlow.style, {
  5475. position: 'absolute',
  5476. inset: '-1px',
  5477. borderRadius: '24px',
  5478. pointerEvents: 'none',
  5479. background: 'linear-gradient(45deg, rgba(255,30,30,0.2), rgba(255,80,80,0.05), rgba(255,30,30,0.15), rgba(255,80,80,0.05))',
  5480. backgroundSize: '400% 400%',
  5481. zIndex: '-1',
  5482. animation: 'gradientFlow 15s ease infinite',
  5483. opacity: '0.8',
  5484. filter: 'blur(1px)'
  5485. });
  5486. filterContainer.appendChild(borderGlow);
  5487.  
  5488. // add CSS for animations and scrollbar styling
  5489. const style = document.createElement('style');
  5490. style.textContent = `
  5491. @keyframes gradientFlow {
  5492. 0% { background-position: 0% 50%; }
  5493. 50% { background-position: 100% 50%; }
  5494. 100% { background-position: 0% 50%; }
  5495. }
  5496.  
  5497. @keyframes pulse {
  5498. 0% { box-shadow: 0 0 0 0 rgba(255, 40, 40, 0.4); }
  5499. 70% { box-shadow: 0 0 0 12px rgba(255, 40, 40, 0); }
  5500. 100% { box-shadow: 0 0 0 0 rgba(255, 40, 40, 0); }
  5501. }
  5502.  
  5503. select::-webkit-scrollbar {
  5504. width: 8px;
  5505. }
  5506. select::-webkit-scrollbar-track {
  5507. background: rgba(20,20,20,0.6);
  5508. border-radius: 8px;
  5509. }
  5510. select::-webkit-scrollbar-thumb {
  5511. background: rgba(255,40,40,0.5);
  5512. border-radius: 8px;
  5513. border: 2px solid rgba(20,20,20,0.6);
  5514. }
  5515. select::-webkit-scrollbar-thumb:hover {
  5516. background: rgba(255,40,40,0.7);
  5517. }
  5518.  
  5519. .logo-pulse {
  5520. animation: pulse 2s infinite;
  5521. }
  5522. `;
  5523. document.head.appendChild(style);
  5524.  
  5525. // Enhanced logo with more sophisticated hover effects
  5526. const logoWrapper = document.createElement('div');
  5527. Object.assign(logoWrapper.style, {
  5528. position: 'relative',
  5529. marginRight: '24px',
  5530. });
  5531.  
  5532. const logo = document.createElement('img');
  5533. logo.src = window.Base64Images.logo;
  5534. Object.assign(logo.style, {
  5535. width: '60px',
  5536. height: '60px',
  5537. borderRadius: '16px',
  5538. transition: 'all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)',
  5539. filter: 'drop-shadow(0 8px 16px rgba(255,40,40,0.3))',
  5540. border: '2px solid rgba(255,40,40,0.3)',
  5541. });
  5542.  
  5543. const logoGlow = document.createElement('div');
  5544. Object.assign(logoGlow.style, {
  5545. position: 'absolute',
  5546. inset: '-4px',
  5547. borderRadius: '20px',
  5548. background: 'radial-gradient(circle at center, rgba(255,40,40,0.4) 0%, rgba(255,40,40,0) 70%)',
  5549. opacity: '0',
  5550. transition: 'opacity 0.5s ease',
  5551. pointerEvents: 'none',
  5552. zIndex: '-1',
  5553. });
  5554.  
  5555. logo.addEventListener('mouseover', () => {
  5556. logo.style.transform = 'rotate(-8deg) scale(1.15)';
  5557. logo.style.filter = 'drop-shadow(0 12px 24px rgba(255,40,40,0.5))';
  5558. logo.style.border = '2px solid rgba(255,40,40,0.6)';
  5559. logoGlow.style.opacity = '1';
  5560. logo.classList.add('logo-pulse');
  5561. });
  5562.  
  5563. logo.addEventListener('mouseout', () => {
  5564. logo.style.transform = 'rotate(0) scale(1)';
  5565. logo.style.filter = 'drop-shadow(0 8px 16px rgba(255,40,40,0.3))';
  5566. logo.style.border = '2px solid rgba(255,40,40,0.3)';
  5567. logoGlow.style.opacity = '0';
  5568. logo.classList.remove('logo-pulse');
  5569. });
  5570.  
  5571. logoWrapper.appendChild(logoGlow);
  5572. logoWrapper.appendChild(logo);
  5573. filterContainer.appendChild(logoWrapper);
  5574.  
  5575. // Function to create a premium dropdown with enhanced styling
  5576. const createDropdown = (id, placeholder) => {
  5577. const wrapper = document.createElement('div');
  5578. Object.assign(wrapper.style, {
  5579. position: 'relative',
  5580. minWidth: '240px',
  5581. flex: '1'
  5582. });
  5583.  
  5584. // Label for the dropdown with subtle animation
  5585. const label = document.createElement('div');
  5586. label.textContent = placeholder.replace('All ', '');
  5587. Object.assign(label.style, {
  5588. color: 'rgba(255,255,255,0.7)',
  5589. marginBottom: '10px',
  5590. fontSize: '14px',
  5591. fontWeight: '500',
  5592. letterSpacing: '0.5px',
  5593. transform: 'translateX(2px)',
  5594. transition: 'color 0.3s ease',
  5595. textTransform: 'uppercase'
  5596. });
  5597. wrapper.appendChild(label);
  5598.  
  5599. const dropdown = document.createElement('select');
  5600. dropdown.id = id;
  5601. dropdown.innerHTML = `<option value="">${placeholder}</option>`;
  5602. Object.assign(dropdown.style, {
  5603. width: '100%',
  5604. padding: '18px 56px 18px 24px',
  5605. fontSize: '16px',
  5606. fontWeight: '500',
  5607. background: 'linear-gradient(145deg, rgba(35,35,35,0.9), rgba(20,20,20,0.9))',
  5608. color: '#FF2828',
  5609. border: '1px solid rgba(255,255,255,0.1)',
  5610. borderRadius: '14px',
  5611. boxShadow: '0 8px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.05)',
  5612. appearance: 'none',
  5613. cursor: 'pointer',
  5614. transition: 'all 0.4s cubic-bezier(0.4, 0, 0.2, 1)',
  5615. opacity: '0',
  5616. transform: 'translateY(-20px)',
  5617. letterSpacing: '0.3px'
  5618. });
  5619.  
  5620. // Enhanced chevron icon with SVG
  5621. const chevron = document.createElement('div');
  5622. chevron.innerHTML = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>`;
  5623. Object.assign(chevron.style, {
  5624. position: 'absolute',
  5625. right: '22px',
  5626. bottom: '18px',
  5627. transform: 'translateY(0)',
  5628. pointerEvents: 'none',
  5629. transition: 'transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)',
  5630. color: 'rgba(255,40,40,0.9)',
  5631. display: 'flex',
  5632. alignItems: 'center',
  5633. justifyContent: 'center'
  5634. });
  5635.  
  5636. // Refined dropdown interactions
  5637. dropdown.addEventListener('mouseover', () => {
  5638. dropdown.style.background = 'linear-gradient(145deg, rgba(50,50,50,0.9), rgba(35,35,35,0.9))';
  5639. dropdown.style.boxShadow = '0 12px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08)';
  5640. dropdown.style.borderColor = 'rgba(255,40,40,0.3)';
  5641. label.style.color = 'rgba(255,40,40,0.9)';
  5642. chevron.style.transform = 'translateY(0) rotate(180deg)';
  5643. });
  5644.  
  5645. dropdown.addEventListener('mouseout', () => {
  5646. if (document.activeElement !== dropdown) {
  5647. dropdown.style.background = 'linear-gradient(145deg, rgba(35,35,35,0.9), rgba(20,20,20,0.9))';
  5648. dropdown.style.boxShadow = '0 8px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.05)';
  5649. dropdown.style.borderColor = 'rgba(255,255,255,0.1)';
  5650. label.style.color = 'rgba(255,255,255,0.7)';
  5651. chevron.style.transform = 'translateY(0) rotate(0deg)';
  5652. }
  5653. });
  5654.  
  5655. dropdown.addEventListener('focus', () => {
  5656. dropdown.style.outline = 'none';
  5657. dropdown.style.borderColor = 'rgba(255,40,40,0.5)';
  5658. dropdown.style.boxShadow = '0 12px 24px rgba(0,0,0,0.35), 0 0 0 3px rgba(255,40,40,0.2), inset 0 1px 0 rgba(255,255,255,0.08)';
  5659. label.style.color = 'rgba(255,40,40,0.9)';
  5660. chevron.style.transform = 'translateY(0) rotate(180deg)';
  5661. });
  5662.  
  5663. dropdown.addEventListener('blur', () => {
  5664. dropdown.style.borderColor = 'rgba(255,255,255,0.1)';
  5665. dropdown.style.boxShadow = '0 8px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.05)';
  5666. label.style.color = 'rgba(255,255,255,0.7)';
  5667. chevron.style.transform = 'translateY(0) rotate(0deg)';
  5668. });
  5669.  
  5670. dropdown.addEventListener('change', () => {
  5671. dropdown.style.transform = 'scale(0.97)';
  5672. setTimeout(() => dropdown.style.transform = 'scale(1)', 150);
  5673.  
  5674. // Add a subtle flash effect on change
  5675. const flash = document.createElement('div');
  5676. Object.assign(flash.style, {
  5677. position: 'absolute',
  5678. inset: '0',
  5679. borderRadius: '14px',
  5680. backgroundColor: 'rgba(255,40,40,0.15)',
  5681. pointerEvents: 'none',
  5682. opacity: '0',
  5683. transition: 'opacity 0.3s ease'
  5684. });
  5685. wrapper.appendChild(flash);
  5686. flash.style.opacity = '1';
  5687. setTimeout(() => {
  5688. flash.style.opacity = '0';
  5689. setTimeout(() => wrapper.removeChild(flash), 300);
  5690. }, 50);
  5691. });
  5692.  
  5693. // Enhanced fade-in animation with staggered timing
  5694. setTimeout(() => {
  5695. dropdown.style.opacity = '1';
  5696. dropdown.style.transform = 'translateY(0)';
  5697. }, 500);
  5698.  
  5699. wrapper.appendChild(dropdown);
  5700. wrapper.appendChild(chevron);
  5701. return wrapper;
  5702. };
  5703.  
  5704. // Create enhanced dropdowns
  5705. const countryDropdown = createDropdown('countryFilter', 'All Countries');
  5706. const cityDropdown = createDropdown('cityFilter', 'All Cities');
  5707.  
  5708. // Populate dropdowns with server data
  5709. const countryCounts = {};
  5710. servers.forEach(server => {
  5711. const country = server.location.country.name;
  5712. countryCounts[country] = (countryCounts[country] || 0) + 1;
  5713. });
  5714.  
  5715. // Sort countries alphabetically
  5716. const sortedCountries = Object.keys(countryCounts).sort();
  5717.  
  5718. sortedCountries.forEach(country => {
  5719. const option = document.createElement('option');
  5720. option.value = country;
  5721. option.textContent = `${country} (${countryCounts[country]})`;
  5722. countryDropdown.querySelector('select').appendChild(option);
  5723. });
  5724.  
  5725. // Add a subtle visual indicator
  5726. const separator = document.createElement('div');
  5727. Object.assign(separator.style, {
  5728. height: '65px',
  5729. width: '1px',
  5730. background: 'linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,40,40,0.3), rgba(255,255,255,0))',
  5731. margin: '0 4px'
  5732. });
  5733.  
  5734. countryDropdown.querySelector('select').addEventListener('change', () => {
  5735. const selectedCountry = countryDropdown.querySelector('select').value;
  5736. cityDropdown.querySelector('select').innerHTML = '<option value="">All Cities</option>';
  5737.  
  5738. if (selectedCountry) {
  5739. const cityCounts = {};
  5740. servers
  5741. .filter(server => server.location.country.name === selectedCountry)
  5742. .forEach(server => {
  5743. const city = server.location.city;
  5744. const region = server.location.region?.name;
  5745. const cityKey = region ? `${city}, ${region}` : city;
  5746. cityCounts[cityKey] = (cityCounts[cityKey] || 0) + 1;
  5747. });
  5748.  
  5749. // Sort cities alphabetically
  5750. const sortedCities = Object.keys(cityCounts).sort();
  5751.  
  5752. sortedCities.forEach(city => {
  5753. const option = document.createElement('option');
  5754. option.value = city;
  5755. option.textContent = `${city} (${cityCounts[city]})`;
  5756. cityDropdown.querySelector('select').appendChild(option);
  5757. });
  5758.  
  5759. // Enhanced animation for city dropdown update
  5760. cityDropdown.querySelector('select').style.opacity = '0.3';
  5761. cityDropdown.querySelector('select').style.transform = 'translateY(-10px)';
  5762. setTimeout(() => {
  5763. cityDropdown.querySelector('select').style.opacity = '1';
  5764. cityDropdown.querySelector('select').style.transform = 'translateY(0)';
  5765. }, 150);
  5766.  
  5767. // Visual indicator that cities were updated
  5768. cityDropdown.style.position = 'relative';
  5769. const updateFlash = document.createElement('div');
  5770. Object.assign(updateFlash.style, {
  5771. position: 'absolute',
  5772. inset: '30px 0 0 0',
  5773. borderRadius: '14px',
  5774. background: 'radial-gradient(circle at center, rgba(255,40,40,0.2) 0%, rgba(255,40,40,0) 70%)',
  5775. pointerEvents: 'none',
  5776. opacity: '1',
  5777. transition: 'opacity 0.8s ease'
  5778. });
  5779. cityDropdown.appendChild(updateFlash);
  5780. setTimeout(() => {
  5781. updateFlash.style.opacity = '0';
  5782. setTimeout(() => cityDropdown.removeChild(updateFlash), 800);
  5783. }, 100);
  5784. }
  5785. });
  5786.  
  5787. // Append dropdowns to container with separator
  5788. filterContainer.appendChild(countryDropdown);
  5789. filterContainer.appendChild(separator);
  5790. filterContainer.appendChild(cityDropdown);
  5791.  
  5792. // Enhanced fade-in container animation
  5793. setTimeout(() => {
  5794. filterContainer.style.opacity = '1';
  5795. filterContainer.style.transform = 'translateY(0) scale(1)';
  5796. }, 300);
  5797.  
  5798. return filterContainer;
  5799. }
  5800.  
  5801. // Function to filter servers based on selected country and city cause im lazy
  5802. function filterServers(servers, country, city) {
  5803. return servers.filter(server => {
  5804. const matchesCountry = !country || server.location.country.name === country;
  5805. const matchesCity = !city || `${server.location.city}${server.location.region?.name ? `, ${server.location.region.name}` : ''}` === city;
  5806. return matchesCountry && matchesCity;
  5807. });
  5808. }
  5809.  
  5810. // Function to sort servers by ping. maybe inaccurate but thats roblox's problem not mine
  5811. function sortServersByPing(servers) {
  5812. return servers.sort((a, b) => a.server.ping - b.server.ping);
  5813. }
  5814. const fetchPlayerThumbnails_servers = (() => {
  5815. const queue = [];
  5816. let processing = false;
  5817.  
  5818. // Simple transparent 1x1 base64 PNG
  5819. const randomBase64Image = () => {
  5820. const placeholders = [
  5821. window.Base64Images.roblox_avatar,
  5822. window.Base64Images.builderman_avatar,
  5823. ];
  5824. const index = Math.floor(Math.random() * placeholders.length);
  5825. return placeholders[index];
  5826. };
  5827.  
  5828. return async function(playerTokens) {
  5829. ConsoleLogEnabled("Function called with playerTokens:", playerTokens);
  5830.  
  5831. // Check if fast server mode is enabled
  5832. if (localStorage.getItem("ROLOCATE_fastservers") === "true") {
  5833. ConsoleLogEnabled("ROLOCATE_fastservers is enabled. Returning mock base64 images.");
  5834.  
  5835. const mockData = playerTokens.map(token => ({
  5836. requestId: `0:${token}:AvatarHeadshot:150x150:png:regular`,
  5837. targetId: 0,
  5838. state: "Completed",
  5839. imageUrl: randomBase64Image(),
  5840. }));
  5841.  
  5842. return mockData;
  5843. }
  5844.  
  5845. const waitHalfSecond = (ms = 250) => new Promise(res => setTimeout(res, ms));
  5846.  
  5847. return new Promise(resolve => {
  5848. ConsoleLogEnabled("Pushing to queue:", playerTokens);
  5849. queue.push({ playerTokens, resolve });
  5850.  
  5851. const processQueue = async () => {
  5852. if (processing) {
  5853. ConsoleLogEnabled("Already processing, exiting...");
  5854. return;
  5855. }
  5856. processing = true;
  5857. ConsoleLogEnabled("Started processing queue...");
  5858.  
  5859. while (queue.length > 0) {
  5860. const { playerTokens, resolve } = queue.shift();
  5861. ConsoleLogEnabled("Processing batch:", playerTokens);
  5862.  
  5863. const body = playerTokens.map(token => ({
  5864. requestId: `0:${token}:AvatarHeadshot:150x150:png:regular`,
  5865. type: "AvatarHeadShot",
  5866. targetId: 0,
  5867. token,
  5868. format: "png",
  5869. size: "150x150",
  5870. }));
  5871.  
  5872. let success = false;
  5873. let data = [];
  5874.  
  5875. while (!success) {
  5876. ConsoleLogEnabled("Sending request to thumbnails.roblox.com...");
  5877. const response = await fetch("https://thumbnails.roblox.com/v1/batch", {
  5878. method: "POST",
  5879. headers: {
  5880. "Content-Type": "application/json",
  5881. Accept: "application/json",
  5882. },
  5883. body: JSON.stringify(body),
  5884. });
  5885.  
  5886. ConsoleLogEnabled("Response status:", response.status);
  5887.  
  5888. if (response.status === 429) {
  5889. ConsoleLogEnabled("Rate limited. Waiting...");
  5890. await waitHalfSecond();
  5891. } else {
  5892. const json = await response.json();
  5893. data = json.data || [];
  5894. success = true;
  5895. ConsoleLogEnabled("Received data:", data);
  5896. }
  5897. }
  5898.  
  5899. resolve(data);
  5900. ConsoleLogEnabled("Resolved promise with data");
  5901. }
  5902.  
  5903. processing = false;
  5904. ConsoleLogEnabled("Finished processing queue.");
  5905. };
  5906.  
  5907. processQueue();
  5908. });
  5909. };
  5910. })();
  5911.  
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917. async function rebuildServerList(gameId, totalLimit, best_connection) {
  5918. const serverListContainer = document.getElementById("rbx-public-game-server-item-container");
  5919.  
  5920. // If "Best Connection" is enabled
  5921. // FUNCTION FOR THE 6TH BUTTON!
  5922. if (best_connection === true) {
  5923. disableLoadMoreButton(true);
  5924. disableFilterButton(true);
  5925. notifications("Retrieving Location...", "success", "🌎", '5000');
  5926.  
  5927. const userLocation = await getUserLocation();
  5928. if (!userLocation) {
  5929. notifications('Error: Unable to fetch your location. Please enable location access or set it to manual in settings.', 'error', '⚠️', '5000');
  5930. disableFilterButton(false);
  5931. return;
  5932. }
  5933.  
  5934. const servers = await fetchPublicServers(gameId, 50);
  5935. if (servers.length === 0) {
  5936. notifications('Error: No servers found. Please try again later.', 'error', '⚠️', '5000');
  5937. disableFilterButton(false);
  5938. return;
  5939. }
  5940.  
  5941. const isFastServers = localStorage.getItem("ROLOCATE_fastservers") === "true";
  5942. let closestServer = null;
  5943. let minDistance = Infinity;
  5944. let closestServerLocation = null;
  5945.  
  5946. if (isFastServers) {
  5947. // Parallel fetching of all server locations
  5948. const results = await Promise.allSettled(
  5949. servers.map(async server => {
  5950. const { id: serverId, maxPlayers, playing } = server;
  5951.  
  5952. if (playing >= maxPlayers) return null;
  5953.  
  5954. try {
  5955. const location = await fetchServerDetails(gameId, serverId);
  5956. const distance = calculateDistance(
  5957. userLocation.latitude,
  5958. userLocation.longitude,
  5959. location.latitude,
  5960. location.longitude
  5961. );
  5962.  
  5963. return { server, location, distance };
  5964. } catch (error) {
  5965. ConsoleLogEnabled(`Error fetching details for server ${serverId}:`, error);
  5966. return null;
  5967. }
  5968. })
  5969. );
  5970.  
  5971. for (const result of results) {
  5972. if (result.status === "fulfilled" && result.value) {
  5973. const { server, location, distance } = result.value;
  5974. if (distance < minDistance) {
  5975. minDistance = distance;
  5976. closestServer = server;
  5977. closestServerLocation = location;
  5978. }
  5979. }
  5980. }
  5981.  
  5982. } else {
  5983. // Sequential fetching (original behavior)
  5984. for (const server of servers) {
  5985. const { id: serverId, maxPlayers, playing } = server;
  5986. if (playing >= maxPlayers) continue;
  5987.  
  5988. try {
  5989. const location = await fetchServerDetails(gameId, serverId);
  5990. const distance = calculateDistance(
  5991. userLocation.latitude,
  5992. userLocation.longitude,
  5993. location.latitude,
  5994. location.longitude
  5995. );
  5996.  
  5997. if (distance < minDistance) {
  5998. minDistance = distance;
  5999. closestServer = server;
  6000. closestServerLocation = location;
  6001. }
  6002. } catch (error) {
  6003. ConsoleLogEnabled(`Error fetching details for server ${serverId}:`, error);
  6004. continue;
  6005. }
  6006. }
  6007. }
  6008.  
  6009. if (closestServer) {
  6010. showLoadingOverlay();
  6011. Roblox.GameLauncher.joinGameInstance(gameId, closestServer.id);
  6012. notifications(`Joining nearest server!
  6013. Server ID: ${closestServer.id}
  6014. Distance: ${(minDistance / 1.609).toFixed(2)} miles | ${minDistance.toFixed(2)} km
  6015. Location (Country): ${closestServerLocation.country.name}.`, 'success', '🚀', '5000');
  6016.  
  6017. disableFilterButton(false);
  6018. Loadingbar(false);
  6019. } else {
  6020. notifications('No valid servers found. Please try again later after refreshing the webpage. Filter button disabled.', 'error', '⚠️', '8000');
  6021. Loadingbar(false);
  6022. }
  6023.  
  6024. return;
  6025. }
  6026.  
  6027.  
  6028. // Rest of the original function (for non-"Best Connection" mode)
  6029. if (!serverListContainer) {
  6030. ConsoleLogEnabled("Server list container not found!");
  6031. notifications('Error: No Servers found. There is nobody playing this game. Please refresh the page.', 'error', '⚠️', '8000');
  6032. Loadingbar(false);
  6033. return;
  6034. }
  6035.  
  6036. const messageElement = showMessage("Just a moment — to detect your location accurately, please stay on this page...");
  6037. const premium_message = messageElement.querySelector('.premium-message-text');
  6038.  
  6039. try {
  6040. // Retrieve user's location for distance calculations
  6041. const userLocation = await getUserLocation(); // this should be useless because of the new manual feature.
  6042. if (!userLocation) {
  6043. notifications('Error: Unable to fetch your location. Please enable location access.', 'error', '⚠️', '5000');
  6044. disableFilterButton(false);
  6045. return;
  6046. }
  6047.  
  6048. const servers = await fetchPublicServers(gameId, totalLimit);
  6049. const totalServers = servers.length;
  6050. let skippedServers = 0;
  6051.  
  6052. if (premium_message) {
  6053. premium_message.textContent = `Filtering servers... Please stay on this page to ensure a faster and more accurate search. ${totalServers} servers found, 0 loaded so far.`;
  6054. }
  6055. notifications(`Please do not leave this page as it slows down the search. \nFound a total of ${totalServers} servers.`, 'success', '👍', '8000');
  6056.  
  6057. const serverDetails = [];
  6058. const useBatching = localStorage.ROLOCATE_fastservers === "true";
  6059.  
  6060. if (useBatching) {
  6061. // Process servers in batches of 100
  6062. const batchSize = 100;
  6063. let processedCount = 0;
  6064.  
  6065. for (let i = 0; i < servers.length; i += batchSize) {
  6066. const batch = servers.slice(i, i + batchSize);
  6067. const batchPromises = batch.map(async (server) => {
  6068. const {
  6069. id: serverId,
  6070. maxPlayers,
  6071. playing,
  6072. ping,
  6073. fps,
  6074. playerTokens
  6075. } = server;
  6076.  
  6077. // Skip full servers early to avoid unnecessary API calls
  6078. if (playing >= maxPlayers) {
  6079. skippedServers++;
  6080. return null;
  6081. }
  6082.  
  6083. try {
  6084. const location = await fetchServerDetails(gameId, serverId);
  6085.  
  6086. if (location.city === "Unknown") {
  6087. ConsoleLogEnabled(`Skipping server ${serverId} because location is unknown.`);
  6088. skippedServers++;
  6089. return null;
  6090. }
  6091.  
  6092. // Fetch player thumbnails
  6093. const playerThumbnails = playerTokens && playerTokens.length > 0 ?
  6094. await fetchPlayerThumbnails_servers(playerTokens) : [];
  6095.  
  6096. return {
  6097. server,
  6098. location,
  6099. playerThumbnails
  6100. };
  6101. } catch (error) {
  6102. if (error === 'purchase_required') {
  6103. throw error; // Rethrow specific errors to be caught in the outer try/catch
  6104. } else if (error === 'subplace_join_restriction') {
  6105. throw error;
  6106. } else {
  6107. ConsoleLogEnabled(error);
  6108. skippedServers++;
  6109. return null;
  6110. }
  6111. }
  6112. });
  6113.  
  6114. // function to smoothly update the processed count
  6115. function updateProcessedCountSmoothly(startCount, targetCount) {
  6116. const increment = 1; // count by 1 server
  6117. let currentCount = startCount;
  6118.  
  6119. const interval = setInterval(() => {
  6120. if (currentCount < targetCount) {
  6121. currentCount += increment;
  6122. if (premium_message) {
  6123. premium_message.textContent = `Filtering servers, please do not leave this page...\n${totalServers} servers found, ${currentCount} server locations found`;
  6124. }
  6125. } else {
  6126. clearInterval(interval);
  6127. }
  6128. }, 2); // Update every 2ms ik this is insanly fast god dayum
  6129. }
  6130.  
  6131. const batchResults = await Promise.all(batchPromises);
  6132. const previousProcessedCount = processedCount;
  6133.  
  6134. // Filter out null results and add valid ones to serverDetails
  6135. const validResults = batchResults.filter(result => result !== null);
  6136. serverDetails.push(...validResults);
  6137.  
  6138. // Gradually update processedCount after processing the batch
  6139. processedCount += batch.length;
  6140. updateProcessedCountSmoothly(previousProcessedCount, processedCount);
  6141.  
  6142. }
  6143. } else {
  6144. // Original sequential processing
  6145. for (let i = 0; i < servers.length; i++) {
  6146. const server = servers[i];
  6147. const {
  6148. id: serverId,
  6149. maxPlayers,
  6150. playing,
  6151. ping,
  6152. fps,
  6153. playerTokens
  6154. } = server;
  6155.  
  6156. let location;
  6157. try {
  6158. location = await fetchServerDetails(gameId, serverId);
  6159. } catch (error) {
  6160. if (error === 'purchase_required') {
  6161. if (premium_message) {
  6162. premium_message.textContent = "Error: Cannot access server regions because you have not purchased the game.";
  6163. }
  6164. notifications('Cannot access server regions because you have not purchased the game.', 'error', '⚠️', '15000');
  6165. Loadingbar(false); // disable loading bar
  6166. return;
  6167. } else if (error === 'subplace_join_restriction') {
  6168. if (premium_message) {
  6169. premium_message.textContent = "Error: This game requires users to teleport to a subplace. As a result, server regions cannot be retrieved.";
  6170. }
  6171. notifications('Error: This game requires users to teleport to a subplace. As a result, server regions cannot be retrieved.', 'error', '⚠️', '15000');
  6172. Loadingbar(false); // disable loading bar
  6173. return;
  6174. } else {
  6175. ConsoleLogEnabled(error);
  6176. location = {
  6177. city: "Unknown",
  6178. country: {
  6179. name: "Unknown",
  6180. code: "??"
  6181. }
  6182. };
  6183. }
  6184. }
  6185.  
  6186. if (location.city === "Unknown" || playing >= maxPlayers) {
  6187. ConsoleLogEnabled(`Skipping server ${serverId} because it is full or location is unknown.`);
  6188. skippedServers++;
  6189. continue;
  6190. }
  6191.  
  6192. // Fetch player thumbnails
  6193. const playerThumbnails = playerTokens && playerTokens.length > 0 ? await fetchPlayerThumbnails_servers(playerTokens) : [];
  6194.  
  6195. serverDetails.push({
  6196. server,
  6197. location,
  6198. playerThumbnails
  6199. });
  6200. if (premium_message) {
  6201. premium_message.textContent = `Filtering servers, please do not leave this page...\n${totalServers} servers found, ${i + 1} server locations found`;
  6202. }
  6203. }
  6204. }
  6205.  
  6206. if (serverDetails.length === 0) {
  6207. showMessage("END");
  6208. notifications('Error: No servers found. Please try again with an increase in the number of servers to search for.', 'error', '⚠️', '15000');
  6209. Loadingbar(false); // disable loading bar
  6210. return;
  6211. }
  6212.  
  6213. const loadedServers = totalServers - skippedServers;
  6214. notifications(`Filtering complete!\n${totalServers} servers found, ${loadedServers} servers loaded, ${skippedServers} servers skipped (full).`, 'success', '👍', '5000');
  6215. showMessage("END");
  6216. Loadingbar(false); // disable loading bar
  6217.  
  6218. // Add filter dropdowns
  6219. const filterContainer = createFilterDropdowns(serverDetails);
  6220. serverListContainer.parentNode.insertBefore(filterContainer, serverListContainer);
  6221.  
  6222. // Style the server list container to use a grid layout
  6223. serverListContainer.style.display = "grid";
  6224. serverListContainer.style.gridTemplateColumns = "repeat(4, 1fr)"; // 4 columns
  6225. serverListContainer.style.gap = "0px"; // Set gap to 0px to remove the gap between grid items
  6226.  
  6227. const displayFilteredServers = (country, city) => {
  6228. serverListContainer.innerHTML = "";
  6229.  
  6230. const filteredServers = filterServers(serverDetails, country, city);
  6231. // Sort servers by distance from the user (fastest first)
  6232. const sortedServers = filteredServers.sort((a, b) => {
  6233. const distanceA = calculateDistance(userLocation.latitude, userLocation.longitude, a.location.latitude, a.location.longitude);
  6234. const distanceB = calculateDistance(userLocation.latitude, userLocation.longitude, b.location.latitude, b.location.longitude);
  6235. return distanceA - distanceB;
  6236. });
  6237.  
  6238. sortedServers.forEach(({
  6239. server,
  6240. location,
  6241. playerThumbnails
  6242. }) => {
  6243. const serverCard = document.createElement("li");
  6244. serverCard.className = "rbx-game-server-item col-md-3 col-sm-4 col-xs-6";
  6245. serverCard.style.width = "100%";
  6246. serverCard.style.minHeight = "400px";
  6247. serverCard.style.display = "flex";
  6248. serverCard.style.flexDirection = "column";
  6249. serverCard.style.justifyContent = "space-between";
  6250. serverCard.style.boxSizing = "border-box";
  6251. serverCard.style.outline = 'none';
  6252. serverCard.style.padding = '6px';
  6253. serverCard.style.borderRadius = '8px';
  6254.  
  6255. // Create label (now based on distance)
  6256. const pingLabel = document.createElement("div");
  6257. pingLabel.style.marginBottom = "5px"; // Adds spacing above label
  6258. pingLabel.style.padding = "5px 10px";
  6259. pingLabel.style.borderRadius = "8px";
  6260. pingLabel.style.fontWeight = "bold";
  6261. pingLabel.style.textAlign = "center"; // Centers the label
  6262.  
  6263. // Calculate distance from user to server
  6264. const distance = calculateDistance(
  6265. userLocation.latitude,
  6266. userLocation.longitude,
  6267. location.latitude,
  6268. location.longitude
  6269. );
  6270.  
  6271. // Calculate ping using the advanced formula
  6272. const calculatedPing = 2 * (distance / 180000) * 1000 * 1.8 + (20 + 0.04 * distance);
  6273.  
  6274. if (distance < 1250) {
  6275. pingLabel.textContent = "⚡ Fast";
  6276. pingLabel.style.backgroundColor = "#014737";
  6277. pingLabel.style.color = "#73e1bc";
  6278. } else if (distance < 5000) {
  6279. pingLabel.textContent = "⏳ OK";
  6280. pingLabel.style.backgroundColor = "#c75a00";
  6281. pingLabel.style.color = "#ffe8c2";
  6282. } else {
  6283. pingLabel.textContent = "🐌 Slow";
  6284. pingLabel.style.backgroundColor = "#771d1d";
  6285. pingLabel.style.color = "#fcc468";
  6286. }
  6287.  
  6288. // Create a container for player thumbnails
  6289. const thumbnailsContainer = document.createElement("div");
  6290. thumbnailsContainer.className = "player-thumbnails-container";
  6291. thumbnailsContainer.style.display = "grid";
  6292. thumbnailsContainer.style.gridTemplateColumns = "repeat(3, 60px)";
  6293. thumbnailsContainer.style.gridTemplateRows = "repeat(2, 60px)";
  6294. thumbnailsContainer.style.gap = "5px";
  6295. thumbnailsContainer.style.marginBottom = "10px";
  6296.  
  6297. // Add player thumbnails to the container (max 5)
  6298. const maxThumbnails = 5;
  6299. const displayedThumbnails = playerThumbnails.slice(0, maxThumbnails);
  6300. displayedThumbnails.forEach(thumb => {
  6301. if (thumb && thumb.imageUrl) {
  6302. const img = document.createElement("img");
  6303. img.src = thumb.imageUrl;
  6304. img.className = "avatar-card-image";
  6305. img.style.width = "60px";
  6306. img.style.height = "60px";
  6307. img.style.borderRadius = "50%";
  6308. thumbnailsContainer.appendChild(img);
  6309. }
  6310. });
  6311.  
  6312. // Add a placeholder for hidden players
  6313. const hiddenPlayers = server.playing - displayedThumbnails.length;
  6314. if (hiddenPlayers > 0) {
  6315. const placeholder = document.createElement("div");
  6316. placeholder.className = "avatar-card-image";
  6317. placeholder.style.width = "60px";
  6318. placeholder.style.height = "60px";
  6319. placeholder.style.borderRadius = "50%";
  6320. placeholder.style.backgroundColor = "#6a6f81";
  6321. placeholder.style.display = "flex";
  6322. placeholder.style.alignItems = "center";
  6323. placeholder.style.justifyContent = "center";
  6324. placeholder.style.color = "#fff";
  6325. placeholder.style.fontSize = "14px";
  6326. placeholder.textContent = `+${hiddenPlayers}`;
  6327. thumbnailsContainer.appendChild(placeholder);
  6328. }
  6329.  
  6330. // Server card content with both distance and calculated ping, with line spacers between each info
  6331. const cardItem = document.createElement("div");
  6332. cardItem.className = "card-item";
  6333. cardItem.style.display = "flex";
  6334. cardItem.style.flexDirection = "column";
  6335. cardItem.style.justifyContent = "space-between";
  6336. cardItem.style.height = "100%";
  6337.  
  6338. cardItem.innerHTML = `
  6339. ${thumbnailsContainer.outerHTML}
  6340. <div class="rbx-game-server-details game-server-details">
  6341. <div class="text-info rbx-game-status rbx-game-server-status text-overflow">
  6342. ${server.playing} of ${server.maxPlayers} people max
  6343. </div>
  6344. <div class="server-player-count-gauge border">
  6345. <div class="gauge-inner-bar border" style="width: ${(server.playing / server.maxPlayers) * 100}%;"></div>
  6346. </div>
  6347. <span data-placeid="${gameId}">
  6348. <button type="button" class="btn-full-width btn-control-xs rbx-game-server-join game-server-join-btn btn-primary-md btn-min-width">Join</button>
  6349. </span>
  6350. </div>
  6351. <div style="margin-top: 10px; text-align: center;">
  6352. ${pingLabel.outerHTML}
  6353. <div class="info-lines" style="margin-top: 8px;">
  6354. <div class="ping-info">Ping: ${calculatedPing.toFixed(2)} ms</div>
  6355. <hr style="margin: 6px 0;">
  6356. <div class="ping-info">Distance: ${distance.toFixed(2)} km</div>
  6357. <hr style="margin: 6px 0;">
  6358. <div class="location-info">${location.city}, ${location.country.name}</div>
  6359. <hr style="margin: 6px 0;">
  6360. <div class="fps-info">FPS: ${Math.round(server.fps)}</div>
  6361. </div>
  6362. </div>
  6363. `;
  6364.  
  6365. const joinButton = cardItem.querySelector(".rbx-game-server-join");
  6366. joinButton.addEventListener("click", () => {
  6367. ConsoleLogEnabled(`Roblox.GameLauncher.joinGameInstance(${gameId}, "${server.id}")`);
  6368. showLoadingOverlay();
  6369. Roblox.GameLauncher.joinGameInstance(gameId, server.id);
  6370. });
  6371.  
  6372. const container = adjustJoinButtonContainer(joinButton);
  6373. const inviteButton = createInviteButton(gameId, server.id);
  6374. container.appendChild(inviteButton);
  6375.  
  6376. serverCard.appendChild(cardItem);
  6377. serverListContainer.appendChild(serverCard);
  6378. });
  6379. };
  6380.  
  6381. // Add event listeners to dropdowns
  6382. const countryFilter = document.getElementById('countryFilter');
  6383. const cityFilter = document.getElementById('cityFilter');
  6384.  
  6385. countryFilter.addEventListener('change', () => {
  6386. displayFilteredServers(countryFilter.value, cityFilter.value);
  6387. });
  6388.  
  6389. cityFilter.addEventListener('change', () => {
  6390. displayFilteredServers(countryFilter.value, cityFilter.value);
  6391. });
  6392.  
  6393. // Display all servers initially
  6394. displayFilteredServers("", "");
  6395. } catch (error) {
  6396. ConsoleLogEnabled("Error rebuilding server list:", error);
  6397. notifications('Filtering Error: Failed to obtain permission to send API requests to the Roblox API. Please allow the script to enable request sending.', 'error', '⚠️ ', '8000');
  6398. if (premium_message) {
  6399. premium_message.textContent = "Filtering Error: Failed to obtain permission to send API requests to the Roblox API. Please allow the script to enable request sending.";
  6400. }
  6401. Loadingbar(false); // enable loading bar
  6402. } finally {
  6403. Loadingbar(false); // omg bruh i just realzed i could put this here but now im too lazy to thorugh the code to remove all of the loading bar disabl functions
  6404. disableFilterButton(false); // beta test filter button
  6405. //notifications('Note: The filter button is disabled while using server regions. Refresh to enable it.', 'info', '🔄', '15000') // old stuff not needed anymore
  6406. }
  6407. }
  6408.  
  6409.  
  6410.  
  6411. // Function to extract the game ID from the URL
  6412. function extractGameId() {
  6413. const url = window.location.href;
  6414. const match = url.match(/roblox\.com\/games\/(\d+)/);
  6415.  
  6416. if (match && match[1]) {
  6417. return match[1]; // Return the game ID
  6418. }
  6419. return null; // Return null if no game ID is found
  6420. }
  6421.  
  6422. // Log the game ID to the console
  6423. const gameId = extractGameId();
  6424.  
  6425. // Function to create and append the Invite button
  6426. function createInviteButton(placeId, serverId) { // too lazy to comment this function tbh just ready the name
  6427. const inviteButton = document.createElement('button');
  6428. inviteButton.textContent = 'Invite';
  6429. inviteButton.className = 'btn-control-xs btn-primary-md btn-min-width btn-full-width';
  6430. inviteButton.style.width = '25%';
  6431. inviteButton.style.marginLeft = '5px';
  6432.  
  6433. inviteButton.style.padding = '4px 8px';
  6434. inviteButton.style.fontSize = '12px';
  6435. inviteButton.style.borderRadius = '8px';
  6436. inviteButton.style.backgroundColor = '#3b3e49';
  6437. inviteButton.style.borderColor = '#3b3e49';
  6438. inviteButton.style.color = '#ffffff';
  6439. inviteButton.style.cursor = 'pointer';
  6440. inviteButton.style.fontWeight = '500';
  6441. inviteButton.style.textAlign = 'center';
  6442. inviteButton.style.whiteSpace = 'nowrap';
  6443. inviteButton.style.verticalAlign = 'middle';
  6444. inviteButton.style.lineHeight = '100%';
  6445. inviteButton.style.fontFamily = 'Builder Sans, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif';
  6446. inviteButton.style.textRendering = 'auto';
  6447. inviteButton.style.webkitFontSmoothing = 'antialiased';
  6448. inviteButton.style.mozOsxFontSmoothing = 'grayscale';
  6449.  
  6450. inviteButton.addEventListener('click', () => {
  6451. const inviteLink = `https://oqarshi.github.io/Invite/?placeid=${placeId}&serverid=${serverId}`;
  6452. navigator.clipboard.writeText(inviteLink).then(() => {
  6453. ConsoleLogEnabled(`Invite link copied to clipboard: ${inviteLink}`);
  6454. notifications('Success! Invite link copied to clipboard!', 'success', '🎉', ' 2000');
  6455. }).catch(() => {
  6456. ConsoleLogEnabled('Failed to copy invite link.');
  6457. notifications('Error: Failed to copy invite link', 'error', '😔', '2000');
  6458. });
  6459. });
  6460.  
  6461. return inviteButton;
  6462. }
  6463.  
  6464. // Function to adjust the Join button and its container
  6465. function adjustJoinButtonContainer(joinButton) {
  6466. const container = document.createElement('div');
  6467. container.style.display = 'flex';
  6468. container.style.width = '100%';
  6469.  
  6470. joinButton.style.width = '75%';
  6471.  
  6472. joinButton.parentNode.insertBefore(container, joinButton);
  6473. container.appendChild(joinButton);
  6474.  
  6475. return container;
  6476. }
  6477.  
  6478.  
  6479.  
  6480.  
  6481. /*********************************************************************************************************************************************************************************************************************************************
  6482. Functions for the 6th button.
  6483.  
  6484. *********************************************************************************************************************************************************************************************************************************************/
  6485.  
  6486.  
  6487.  
  6488.  
  6489. function calculateDistance(lat1, lon1, lat2, lon2) {
  6490. const R = 6371; // Radius of the Earth in kilometers
  6491. const dLat = (lat2 - lat1) * (Math.PI / 180);
  6492. const dLon = (lon2 - lon1) * (Math.PI / 180);
  6493. const a =
  6494. Math.sin(dLat / 2) * Math.sin(dLat / 2) +
  6495. Math.cos(lat1 * (Math.PI / 180)) * Math.cos(lat2 * (Math.PI / 180)) *
  6496. Math.sin(dLon / 2) * Math.sin(dLon / 2);
  6497. const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
  6498. return R * c; // Distance in kilometers
  6499. }
  6500.  
  6501.  
  6502.  
  6503. // Fallback location resolver with timezone-based estimation
  6504. function resolveOfflineFallbackLocation(resolve) {
  6505. ConsoleLogEnabled("Attempting offline location estimation...");
  6506.  
  6507. let guessedLocation = null;
  6508. let closestLocation = null;
  6509. let closestDistance = Infinity;
  6510.  
  6511. const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone || "";
  6512. const timezoneMap = {
  6513. "America/Los_Angeles": {
  6514. lat: 34.0522,
  6515. lon: -118.2437
  6516. },
  6517. "America/Denver": {
  6518. lat: 39.7392,
  6519. lon: -104.9903
  6520. },
  6521. "America/Chicago": {
  6522. lat: 41.8781,
  6523. lon: -87.6298
  6524. },
  6525. "America/New_York": {
  6526. lat: 40.7128,
  6527. lon: -74.006
  6528. },
  6529. "Europe/London": {
  6530. lat: 51.5074,
  6531. lon: -0.1278
  6532. },
  6533. "Europe/Berlin": {
  6534. lat: 52.52,
  6535. lon: 13.405
  6536. },
  6537. "Europe/Paris": {
  6538. lat: 48.8566,
  6539. lon: 2.3522
  6540. },
  6541. "Asia/Tokyo": {
  6542. lat: 35.6895,
  6543. lon: 139.6917
  6544. },
  6545. "Asia/Kolkata": {
  6546. lat: 28.6139,
  6547. lon: 77.209
  6548. },
  6549. "Australia/Sydney": {
  6550. lat: -33.8688,
  6551. lon: 151.2093
  6552. },
  6553. "America/Argentina/Buenos_Aires": {
  6554. lat: -34.6037,
  6555. lon: -58.3816
  6556. },
  6557. "Africa/Nairobi": {
  6558. lat: -1.286389,
  6559. lon: 36.817223
  6560. },
  6561. "Asia/Singapore": {
  6562. lat: 1.3521,
  6563. lon: 103.8198
  6564. },
  6565. "America/Toronto": {
  6566. lat: 43.65107,
  6567. lon: -79.347015
  6568. },
  6569. "Europe/Moscow": {
  6570. lat: 55.7558,
  6571. lon: 37.6173
  6572. },
  6573. "Europe/Madrid": {
  6574. lat: 40.4168,
  6575. lon: -3.7038
  6576. },
  6577. "Asia/Shanghai": {
  6578. lat: 31.2304,
  6579. lon: 121.4737
  6580. },
  6581. "Africa/Cairo": {
  6582. lat: 30.0444,
  6583. lon: 31.2357
  6584. },
  6585. "Africa/Johannesburg": {
  6586. lat: -26.2041,
  6587. lon: 28.0473
  6588. },
  6589. "Europe/Amsterdam": {
  6590. lat: 52.3676,
  6591. lon: 4.9041
  6592. },
  6593. "Asia/Manila": {
  6594. lat: 14.5995,
  6595. lon: 120.9842
  6596. },
  6597. "Asia/Seoul": {
  6598. lat: 37.5665,
  6599. lon: 126.978
  6600. }
  6601. };
  6602.  
  6603.  
  6604. // If user's timezone is available in the map
  6605. if (timezoneMap[timezone]) {
  6606. guessedLocation = timezoneMap[timezone];
  6607. ConsoleLogEnabled("User's timezone found:", timezone);
  6608. }
  6609.  
  6610. // If the timezone is not found, find the closest match
  6611. if (!guessedLocation) {
  6612. ConsoleLogEnabled("User's timezone not found. Finding closest match...");
  6613. Object.keys(timezoneMap).forEach((tz) => {
  6614. const location = timezoneMap[tz];
  6615. const distance = calculateDistance(location.lat, location.lon, 0, 0); // Distance from the equator (0,0)
  6616. if (distance < closestDistance) {
  6617. closestDistance = distance;
  6618. closestLocation = location;
  6619. }
  6620. });
  6621. guessedLocation = closestLocation;
  6622. }
  6623.  
  6624. // If we found a location, return it, otherwise default to New York
  6625. if (guessedLocation) {
  6626. notifications("Estimated location based on timezone. Please allow location access to see what servers are closest to you or change to manual in settings.", "info", "🕒", "6000");
  6627. resolve({
  6628. latitude: guessedLocation.lat,
  6629. longitude: guessedLocation.lon
  6630. });
  6631. } else {
  6632. notifications("Could not estimate location. Fatal error, please report on Greasyfork. Using default (New York).", "error", "⚠️", "6000");
  6633. resolve({
  6634. latitude: 40.7128,
  6635. longitude: -74.0060
  6636. }); // Default to NYC
  6637. }
  6638. }
  6639.  
  6640.  
  6641.  
  6642. function getUserLocation() {
  6643. return new Promise((resolve, reject) => {
  6644. // Check priority location setting
  6645. const priorityLocation = localStorage.getItem("ROLOCATE_prioritylocation") || "automatic";
  6646.  
  6647. // If in manual mode, use stored coordinates
  6648. if (priorityLocation === "manual") {
  6649. try {
  6650. const coords = JSON.parse(GM_getValue("ROLOCATE_coordinates", '{"lat":"","lng":""}'));
  6651. if (coords.lat && coords.lng) {
  6652. ConsoleLogEnabled("Using manual location from storage");
  6653. notifications("We successfully detected your location.", "success", "🌎", "2000");
  6654. return resolve({
  6655. latitude: parseFloat(coords.lat), // Changed to match automatic mode
  6656. longitude: parseFloat(coords.lng), // Changed to match automatic mode
  6657. source: "manual",
  6658. accuracy: 0 // Manual coordinates have no accuracy metric
  6659. });
  6660. } else {
  6661. ConsoleLogEnabled("Manual mode selected but no coordinates set - falling back to automatic behavior");
  6662. notifications("Manual mode selected but no coordinates set. Fatal error: Report on greasyfork. Using Automatic Mode.", "error", "", "2000");
  6663. // Fall through to automatic behavior
  6664. }
  6665. } catch (e) {
  6666. ConsoleLogEnabled("Error reading manual coordinates:", e);
  6667. notifications("Error reading manual coordinates. Fatal error: Report on greasyfork. Using Automatic Mode.", "error", "", "2000");
  6668. // Fall through to automatic behavior
  6669. }
  6670. }
  6671.  
  6672. // Automatic mode behavior
  6673. if (!navigator.geolocation) {
  6674. ConsoleLogEnabled("Geolocation not supported.");
  6675. notifications("Geolocation is not supported by your browser.", "error", "⚠️", "15000");
  6676. return resolveOfflineFallbackLocation(resolve);
  6677. }
  6678.  
  6679. navigator.geolocation.getCurrentPosition(
  6680. (position) => resolveSuccess(position, resolve),
  6681. async (error) => {
  6682. ConsoleLogEnabled("Geolocation error:", error);
  6683.  
  6684. // Attempt to inspect geolocation permission state
  6685. try {
  6686. if (navigator.permissions && navigator.permissions.query) {
  6687. const permissionStatus = await navigator.permissions.query({
  6688. name: "geolocation"
  6689. });
  6690. ConsoleLogEnabled("Geolocation permission status:", permissionStatus.state);
  6691.  
  6692. if (permissionStatus.state === "denied") {
  6693. return resolveOfflineFallbackLocation(resolve);
  6694. }
  6695. }
  6696. } catch (permError) {
  6697. ConsoleLogEnabled("Permission check failed:", permError);
  6698. }
  6699.  
  6700. // Retry geolocation once with a slightly relaxed setting
  6701. navigator.geolocation.getCurrentPosition(
  6702. (position) => resolveSuccess(position, resolve),
  6703. (retryError) => {
  6704. ConsoleLogEnabled("Second geolocation attempt failed:", retryError);
  6705. notifications("Could not get your location. Using fallback.", "error", "⚠️", "15000");
  6706. resolveOfflineFallbackLocation(resolve);
  6707. }, {
  6708. maximumAge: 5000,
  6709. timeout: 10000,
  6710. }
  6711. );
  6712. }, {
  6713. timeout: 10000,
  6714. maximumAge: 0,
  6715. }
  6716. );
  6717. });
  6718. }
  6719.  
  6720.  
  6721. // Success Handler (unchanged)
  6722. function resolveSuccess(position, resolve) {
  6723. notifications("We successfully detected your location.", "success", "🌎", "2000");
  6724. disableLoadMoreButton(true);
  6725. disableFilterButton(true);
  6726. Loadingbar(true);
  6727. resolve({
  6728. latitude: position.coords.latitude,
  6729. longitude: position.coords.longitude,
  6730. source: "geolocation",
  6731. accuracy: position.coords.accuracy
  6732. });
  6733. }
  6734.  
  6735.  
  6736.  
  6737. /*********************************************************************************************************************************************************************************************************************************************
  6738. Functions for the 7th button.
  6739.  
  6740. *********************************************************************************************************************************************************************************************************************************************/
  6741. async function auto_join_small_server() {
  6742. // Disable the "Load More" button and show the loading bar
  6743. Loadingbar(true);
  6744. disableFilterButton(true);
  6745. disableLoadMoreButton();
  6746.  
  6747. // Get the game ID from the URL
  6748. const gameId = window.location.pathname.split('/')[2];
  6749.  
  6750. // Retry mechanism for 429 errors
  6751. let retries = 3; // Number of retries
  6752. let success = false;
  6753.  
  6754. while (retries > 0 && !success) {
  6755. try {
  6756. // Fetch server data using GM_xmlhttpRequest
  6757. const data = await new Promise((resolve, reject) => {
  6758. GM_xmlhttpRequest({
  6759. method: "GET",
  6760. url: `https://games.roblox.com/v1/games/${gameId}/servers/public?sortOrder=1&excludeFullGames=true&limit=100`,
  6761. onload: function(response) {
  6762. if (response.status === 429) {
  6763. reject('429: Too Many Requests');
  6764. } else if (response.status >= 200 && response.status < 300) {
  6765. resolve(JSON.parse(response.responseText));
  6766. } else {
  6767. reject(`HTTP error: ${response.status}`);
  6768. }
  6769. },
  6770. onerror: function(error) {
  6771. reject(error);
  6772. },
  6773. });
  6774. });
  6775.  
  6776. // Find the server with the lowest player count
  6777. let minPlayers = Infinity;
  6778. let targetServer = null;
  6779.  
  6780. for (const server of data.data) {
  6781. if (server.playing < minPlayers) {
  6782. minPlayers = server.playing;
  6783. targetServer = server;
  6784. }
  6785. }
  6786.  
  6787. if (targetServer) {
  6788. // Join the server with the lowest player count
  6789. showLoadingOverlay();
  6790. Roblox.GameLauncher.joinGameInstance(gameId, targetServer.id);
  6791. notifications(`Joining a server with ${targetServer.playing} player(s).`, 'success', '🚀');
  6792. success = true; // Mark as successful
  6793. } else {
  6794. notifications('No available servers found.', 'error', '⚠️');
  6795. break; // Exit the loop if no servers are found
  6796. }
  6797. } catch (error) {
  6798. if (error === '429: Too Many Requests' && retries > 0) {
  6799. ConsoleLogEnabled('Rate limited. Retrying in 10 seconds...');
  6800. notifications('Rate limited. Retrying in 10 seconds...', 'warning', '⏳', '10000');
  6801. await delay(10000); // Wait 10 seconds before retrying
  6802. retries--;
  6803. } else {
  6804. ConsoleLogEnabled('Error fetching server data:', error);
  6805. notifications('Error: Failed to fetch server data. Please try again later.', 'error', '⚠️', '5000');
  6806. Loadingbar(false);
  6807. break; // Exit the loop if it's not a 429 error or no retries left
  6808. }
  6809. }
  6810. }
  6811.  
  6812. // Hide the loading bar and enable the filter button
  6813. Loadingbar(false);
  6814. disableFilterButton(false);
  6815. }
  6816. /*********************************************************************************************************************************************************************************************************************************************
  6817. Functions for the 8th button.
  6818.  
  6819. *********************************************************************************************************************************************************************************************************************************************/
  6820.  
  6821. // Enhanced popup styling for the username input dialog
  6822. function find_user_server_tab() {
  6823. // Create the overlay (backdrop) with improved animation
  6824. const overlay = document.createElement('div');
  6825. overlay.style.cssText = `
  6826. position: fixed;
  6827. top: 0;
  6828. left: 0;
  6829. width: 100%;
  6830. height: 100%;
  6831. background-color: rgba(0, 0, 0, 0.6);
  6832. z-index: 9999;
  6833. opacity: 0;
  6834. transition: opacity 0.4s ease;
  6835. backdrop-filter: blur(3px);
  6836. `;
  6837. document.body.appendChild(overlay);
  6838.  
  6839. // Create the popup container with improved styling
  6840. const popup = document.createElement('div');
  6841. popup.className = 'player-count-popup';
  6842. popup.style.cssText = `
  6843. position: fixed;
  6844. top: 50%;
  6845. left: 50%;
  6846. transform: translate(-50%, -50%) scale(0.95);
  6847. background-color: rgb(30, 32, 34);
  6848. padding: 30px 25px;
  6849. border-radius: 12px;
  6850. z-index: 10000;
  6851. box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
  6852. display: flex;
  6853. flex-direction: column;
  6854. align-items: center;
  6855. gap: 20px;
  6856. width: 340px;
  6857. opacity: 0;
  6858. transition: opacity 0.4s ease, transform 0.4s ease;
  6859. border: 1px solid rgba(255, 255, 255, 0.1);
  6860. `;
  6861.  
  6862. // Improved close button with better hover effects
  6863. const closeButton = document.createElement('button');
  6864. closeButton.innerHTML = '&times;';
  6865. closeButton.style.cssText = `
  6866. position: absolute;
  6867. top: 12px;
  6868. right: 12px;
  6869. background: transparent;
  6870. border: none;
  6871. color: #999999;
  6872. font-size: 26px;
  6873. cursor: pointer;
  6874. width: 36px;
  6875. height: 36px;
  6876. border-radius: 50%;
  6877. display: flex;
  6878. align-items: center;
  6879. justify-content: center;
  6880. transition: all 0.2s ease;
  6881. `;
  6882. closeButton.addEventListener('mouseenter', () => {
  6883. closeButton.style.backgroundColor = 'rgba(255, 255, 255, 0.1)';
  6884. closeButton.style.color = '#ff4444';
  6885. closeButton.style.transform = 'rotate(90deg)';
  6886. });
  6887. closeButton.addEventListener('mouseleave', () => {
  6888. closeButton.style.backgroundColor = 'transparent';
  6889. closeButton.style.color = '#999999';
  6890. closeButton.style.transform = 'rotate(0deg)';
  6891. });
  6892.  
  6893. // Enhanced title with icon
  6894. const titleContainer = document.createElement('div');
  6895. titleContainer.style.cssText = `
  6896. display: flex;
  6897. align-items: center;
  6898. gap: 10px;
  6899. margin-bottom: 5px;
  6900. `;
  6901.  
  6902. const titleIcon = document.createElement('span');
  6903. titleIcon.innerHTML = '🔍';
  6904. titleIcon.style.cssText = `font-size: 22px;`;
  6905.  
  6906. const title = document.createElement('h3');
  6907. title.textContent = 'Locate User';
  6908. title.style.cssText = `
  6909. color: white;
  6910. margin: 0;
  6911. font-size: 20px;
  6912. font-weight: 600;
  6913. `;
  6914.  
  6915. titleContainer.appendChild(titleIcon);
  6916. titleContainer.appendChild(title);
  6917. popup.appendChild(titleContainer);
  6918.  
  6919. // Add subtitle with instructions
  6920. const subtitle = document.createElement('p');
  6921. subtitle.textContent = 'Enter the exact Roblox username to find their server';
  6922. subtitle.style.cssText = `
  6923. color: #aaaaaa;
  6924. margin: -10px 0 0 0;
  6925. font-size: 14px;
  6926. text-align: center;
  6927. `;
  6928. popup.appendChild(subtitle);
  6929.  
  6930. // Improved input box with focus styling
  6931. const usernameInput = document.createElement('input');
  6932. usernameInput.type = 'text';
  6933. usernameInput.placeholder = 'Username';
  6934. usernameInput.style.cssText = `
  6935. width: 100%;
  6936. padding: 12px 15px;
  6937. font-size: 16px;
  6938. border: 2px solid #444;
  6939. border-radius: 8px;
  6940. background-color: #252729;
  6941. color: white;
  6942. outline: none;
  6943. transition: all 0.3s ease;
  6944. box-sizing: border-box;
  6945. `;
  6946. usernameInput.addEventListener('focus', () => {
  6947. usernameInput.style.borderColor = '#b71c1c';
  6948. usernameInput.style.boxShadow = '0 0 5px rgba(211, 47, 47, 0.5)';
  6949. });
  6950. usernameInput.addEventListener('blur', () => {
  6951. usernameInput.style.borderColor = '#444';
  6952. usernameInput.style.boxShadow = 'none';
  6953. });
  6954. popup.appendChild(usernameInput);
  6955.  
  6956. // Enhanced confirm button with better styling and effects
  6957. const confirmButton = document.createElement('button');
  6958. confirmButton.textContent = 'Search';
  6959. confirmButton.style.cssText = `
  6960. padding: 12px 0;
  6961. width: 100%;
  6962. font-size: 16px;
  6963. font-weight: 600;
  6964. background-color: #b71c1c;
  6965. color: white;
  6966. border: none;
  6967. border-radius: 8px;
  6968. cursor: pointer;
  6969. transition: all 0.3s ease;
  6970. display: flex;
  6971. align-items: center;
  6972. justify-content: center;
  6973. gap: 8px;
  6974. `;
  6975.  
  6976. // Add icon to button
  6977. const searchIcon = document.createElement('span');
  6978. searchIcon.textContent = '🔍';
  6979. searchIcon.style.fontSize = '18px';
  6980. confirmButton.prepend(searchIcon);
  6981.  
  6982. confirmButton.addEventListener('mouseenter', () => {
  6983. confirmButton.style.backgroundColor = '#d32f2f';
  6984. confirmButton.style.transform = 'translateY(-2px)';
  6985. confirmButton.style.boxShadow = '0 5px 15px rgba(211, 47, 47, 0.5)';
  6986. });
  6987. confirmButton.addEventListener('mouseleave', () => {
  6988. confirmButton.style.backgroundColor = '#b71c1c';
  6989. confirmButton.style.transform = 'translateY(0)';
  6990. confirmButton.style.boxShadow = 'none';
  6991. });
  6992. confirmButton.addEventListener('mousedown', () => {
  6993. confirmButton.style.transform = 'translateY(1px)';
  6994. });
  6995. confirmButton.addEventListener('mouseup', () => {
  6996. confirmButton.style.transform = 'translateY(-2px)';
  6997. });
  6998.  
  6999. // Handle keyboard enter for better UX
  7000. usernameInput.addEventListener('keydown', (e) => {
  7001. if (e.key === 'Enter') {
  7002. confirmButton.click();
  7003. }
  7004. });
  7005.  
  7006. // Handle confirm button click with enhanced validation feedback
  7007. confirmButton.addEventListener('click', () => {
  7008. const username = usernameInput.value.trim();
  7009. if (username) {
  7010. if (username.length >= 3 && username.length <= 20) {
  7011. FindPlayerGameServer(username);
  7012. notifications("Searching for the user's server...", "info", "🔍", "5000");
  7013. fadeOutAndRemove_7th(popup, overlay);
  7014. } else {
  7015. usernameInput.style.borderColor = '#ff4444';
  7016. usernameInput.style.boxShadow = '0 0 5px rgba(255, 68, 68, 0.5)';
  7017. notifications('Username must be between 3 and 20 characters', 'error', '⚠️', '3000');
  7018.  
  7019. // Reset input styling after delay
  7020. setTimeout(() => {
  7021. if (document.body.contains(usernameInput)) {
  7022. usernameInput.style.borderColor = '#444';
  7023. usernameInput.style.boxShadow = 'none';
  7024. }
  7025. }, 2000);
  7026. }
  7027. } else {
  7028. usernameInput.style.borderColor = '#ff4444';
  7029. usernameInput.style.boxShadow = '0 0 5px rgba(255, 68, 68, 0.5)';
  7030. notifications('Please enter a username', 'error', '⚠️', '2500');
  7031. }
  7032. });
  7033.  
  7034. // Append elements to popup
  7035. popup.appendChild(confirmButton);
  7036. popup.appendChild(closeButton);
  7037.  
  7038. // Append popup to body
  7039. document.body.appendChild(popup);
  7040.  
  7041. // Focus the input field automatically
  7042. setTimeout(() => {
  7043. usernameInput.focus();
  7044. }, 300);
  7045.  
  7046. // Fade in the overlay and popup with improved animation
  7047. setTimeout(() => {
  7048. overlay.style.opacity = '1';
  7049. popup.style.opacity = '1';
  7050. popup.style.transform = 'translate(-50%, -50%) scale(1)';
  7051. }, 10);
  7052.  
  7053. // Keep the same fadeOutAndRemove function name for compatibility
  7054. function fadeOutAndRemove_7th(popup, overlay) {
  7055. popup.style.opacity = '0';
  7056. popup.style.transform = 'translate(-50%, -50%) scale(0.9)';
  7057. overlay.style.opacity = '0';
  7058. setTimeout(() => {
  7059. popup.remove();
  7060. overlay.remove();
  7061. }, 300);
  7062. }
  7063.  
  7064. // Close the popup when clicking outside
  7065. overlay.addEventListener('click', () => {
  7066. fadeOutAndRemove_7th(popup, overlay);
  7067. });
  7068.  
  7069. // Close the popup when the close button is clicked
  7070. closeButton.addEventListener('click', () => {
  7071. fadeOutAndRemove_7th(popup, overlay);
  7072. });
  7073. }
  7074.  
  7075.  
  7076. // Add this helper function somewhere inside or above your main function
  7077. const checkIfUserOnline = async (userId) => {
  7078. try {
  7079. const response = await fetch("https://presence.roblox.com/v1/presence/users", {
  7080. method: "POST",
  7081. headers: {
  7082. "Content-Type": "application/json"
  7083. },
  7084. body: JSON.stringify({
  7085. userIds: [parseInt(userId)]
  7086. })
  7087. });
  7088. const data = await response.json();
  7089. const presenceType = data.userPresences?.[0]?.userPresenceType ?? 0;
  7090. return presenceType !== 0; // true if online or in-game/studio
  7091. } catch (error) {
  7092. ConsoleLogEnabled("Presence check failed:", error);
  7093. return false; // fail-safe: treat as offline
  7094. }
  7095. };
  7096.  
  7097.  
  7098. async function FindPlayerGameServer(playerName) {
  7099. disableLoadMoreButton();
  7100. Loadingbar(true);
  7101. disableFilterButton(true);
  7102. const wait = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds));
  7103.  
  7104. const fetchData = async (url, options = {}) => {
  7105. if (!options.headers) options.headers = {};
  7106. return fetch(url, options)
  7107. .then(response => response.json())
  7108. .catch(error => ConsoleLogEnabled("Fetch error:", error));
  7109. };
  7110.  
  7111. const fetchDataGM = (url, options = {}) => {
  7112. return new Promise((resolve, reject) => {
  7113. GM_xmlhttpRequest({
  7114. method: options.method || 'GET',
  7115. url: url,
  7116. headers: options.headers || {},
  7117. anonymous: true, // Prevents sending cookies
  7118. nocache: true, // Prevents caching
  7119. onload: function(response) {
  7120. try {
  7121. const parsedData = JSON.parse(response.responseText);
  7122. resolve(parsedData);
  7123. } catch (error) {
  7124. ConsoleLogEnabled("JSON parsing error:", error);
  7125. reject(error);
  7126. }
  7127. },
  7128. onerror: function(error) {
  7129. ConsoleLogEnabled("Request error:", error);
  7130. reject(error);
  7131. }
  7132. });
  7133. });
  7134. };
  7135.  
  7136. ConsoleLogEnabled(`Initiating search for player: ${playerName}`);
  7137.  
  7138. const gameId = window.location.href.split("/")[4];
  7139. ConsoleLogEnabled(`Game ID identified: ${gameId}`);
  7140.  
  7141. let userId;
  7142.  
  7143. try {
  7144. ConsoleLogEnabled(`Retrieving user ID for player: ${playerName}`);
  7145. const userProfile = await fetch(`https://www.roblox.com/users/profile?username=${playerName}`);
  7146. if (!userProfile.ok) {
  7147. notifications("Error: User does not exist on Roblox!", "error", "⚠️", "2500");
  7148. Loadingbar(false);
  7149. disableFilterButton(false);
  7150. throw `Player "${playerName}" not found`;
  7151. }
  7152. userId = userProfile.url.match(/\d+/)[0];
  7153. const isOnline = await checkIfUserOnline(userId);
  7154. if (!isOnline) {
  7155. notifications("User is currently offline.", "error", "📴", "4000");
  7156. Loadingbar(false);
  7157. disableFilterButton(false);
  7158. fadeOutAndRemove_7th_progress(progressPopup.popup, progressPopup.overlay);
  7159. return `User "${playerName}" is offline.`;
  7160. }
  7161. ConsoleLogEnabled(`User is online proceeding with server scan.`);
  7162.  
  7163. ConsoleLogEnabled(`User ID retrieved: ${userId}`);
  7164. } catch (error) {
  7165. ConsoleLogEnabled("Error:", error);
  7166. return `Error: ${error}`;
  7167. }
  7168.  
  7169. ConsoleLogEnabled(`Fetching avatar thumbnail for user ID: ${userId}`);
  7170. const avatarThumbnail = (await fetchData(`https://thumbnails.roblox.com/v1/users/avatar-headshot?userIds=${userId}&format=Png&size=150x150`)).data[0].imageUrl;
  7171. ConsoleLogEnabled(`Avatar thumbnail URL: ${avatarThumbnail}`);
  7172.  
  7173. let pageCursor = null;
  7174. let playerFound = false;
  7175. let totalServersChecked = 0;
  7176. let startTime = Date.now();
  7177.  
  7178. // Show the search progress popup with the player's thumbnail
  7179. const progressPopup = showSearchProgressPopup(avatarThumbnail);
  7180.  
  7181. while (true) {
  7182. let apiUrl = `https://games.roblox.com/v1/games/${gameId}/servers/0?limit=100`;
  7183. if (pageCursor) apiUrl += "&cursor=" + pageCursor;
  7184.  
  7185. ConsoleLogEnabled(`Accessing servers with URL: ${apiUrl}`);
  7186. const serverList = await fetchDataGM(apiUrl, {
  7187. credentials: "omit"
  7188. }).catch(() => null);
  7189.  
  7190. if (serverList && serverList.data) {
  7191. ConsoleLogEnabled(`Discovered ${serverList.data.length} servers in this set.`);
  7192. for (let index = 0; index < serverList.data.length; index++) {
  7193. const server = serverList.data[index];
  7194. if (!playerFound) {
  7195. totalServersChecked++;
  7196.  
  7197. // Calculate time elapsed
  7198. const timeElapsed = Math.floor((Date.now() - startTime) / 1000);
  7199.  
  7200. // Update the progress popup
  7201. updateSearchProgressPopup(
  7202. progressPopup,
  7203. totalServersChecked,
  7204. timeElapsed
  7205. );
  7206.  
  7207. if (server.playerTokens.length === 0) {
  7208. ConsoleLogEnabled(`Server ${index + 1} is empty. Proceeding to next server.`);
  7209. continue;
  7210. }
  7211.  
  7212. ConsoleLogEnabled(`Inspecting server ${index + 1} hosting ${server.playing} players...`);
  7213.  
  7214. let thumbnailData;
  7215. while (true) {
  7216. let requestBody = [];
  7217.  
  7218. const generateRequestEntry = (playerToken) => ({
  7219. requestId: `0:${playerToken}:AvatarHeadshot:150x150:png:regular`,
  7220. type: "AvatarHeadShot",
  7221. targetId: 0,
  7222. token: playerToken,
  7223. format: "png",
  7224. size: "150x150"
  7225. });
  7226.  
  7227. server.playerTokens.forEach(token => {
  7228. requestBody.push(generateRequestEntry(token));
  7229. });
  7230.  
  7231. try {
  7232. ConsoleLogEnabled(`Fetching thumbnails for ${server.playerTokens.length} player(s)...`);
  7233. thumbnailData = await fetchData("https://thumbnails.roblox.com/v1/batch", {
  7234. method: "POST",
  7235. headers: {
  7236. "Content-Type": "application/json",
  7237. Accept: "application/json"
  7238. },
  7239. body: JSON.stringify(requestBody)
  7240. });
  7241. ConsoleLogEnabled("Thumbnail Data Response:", thumbnailData);
  7242. break;
  7243. } catch (error) {
  7244. ConsoleLogEnabled("Thumbnail retrieval error:", error);
  7245. await wait(1000);
  7246. }
  7247. }
  7248.  
  7249. if (!thumbnailData.data) {
  7250. ConsoleLogEnabled("No thumbnail data available. Moving to next server.");
  7251. continue;
  7252. }
  7253.  
  7254. for (let thumbIndex = 0; thumbIndex < thumbnailData.data.length; thumbIndex++) {
  7255. const thumbnail = thumbnailData.data[thumbIndex];
  7256. if (thumbnail && thumbnail.imageUrl === avatarThumbnail) {
  7257. playerFound = true;
  7258. ConsoleLogEnabled(`Player located in server ${index + 1}!`);
  7259. notifications("Found User's Server! Joining Server...", "success", "🚀", "5000");
  7260. showLoadingOverlay();
  7261. Roblox.GameLauncher.joinGameInstance(gameId, server.id);
  7262. fadeOutAndRemove_7th_progress(progressPopup.popup, progressPopup.overlay);
  7263. Loadingbar(false);
  7264. disableFilterButton(false);
  7265. return {
  7266. gameId,
  7267. serverId: server.id,
  7268. currentPlayers: server.playing,
  7269. maximumPlayers: server.maxPlayers,
  7270. };
  7271. }
  7272. }
  7273. } else {
  7274. break;
  7275. }
  7276. }
  7277.  
  7278. pageCursor = serverList.nextPageCursor;
  7279. if (!pageCursor || playerFound) break;
  7280. else {
  7281. ConsoleLogEnabled("Pausing for 2.5 seconds before next server batch...");
  7282. await wait(2500);
  7283. }
  7284. } else {
  7285. ConsoleLogEnabled("Server fetch failed. Retrying in 10 seconds...");
  7286. notifications("Got rate limited. Waiting 10 seconds...", "info", "❗", "10000")
  7287. await wait(10000);
  7288. }
  7289. }
  7290.  
  7291. if (!playerFound) {
  7292. // Wait for 2 seconds before calling another function
  7293. setTimeout(() => {
  7294. fadeOutAndRemove_7th_progress(progressPopup.popup, progressPopup.overlay);
  7295. notifications("User not found playing this game!", "error", "⚠️", "5000");
  7296. notifications("If the user is playing, try again in a minute. The Roblox API may not be updated yet.", "info", "🔄", "20000");
  7297. }, 2000); // 2000 milliseconds = 2 seconds
  7298.  
  7299. // Existing logic (unchanged)
  7300. Loadingbar(false);
  7301. disableFilterButton(false);
  7302. ConsoleLogEnabled(`Player not found in the searched servers (${totalServersChecked} servers checked)`);
  7303. // Update the progress popup with the final count
  7304. updateSearchProgressPopup(
  7305. progressPopup,
  7306. totalServersChecked,
  7307. Math.floor((Date.now() - startTime) / 1000),
  7308. true
  7309. );
  7310. return `Player not found in the searched servers (${totalServersChecked} servers checked)`;
  7311. }
  7312. }
  7313.  
  7314. // Enhanced progress popup for search visualization
  7315. function showSearchProgressPopup(avatarThumbnail) {
  7316. // Create the overlay with blur effect
  7317. const overlay = document.createElement('div');
  7318. overlay.style.cssText = `
  7319. position: fixed;
  7320. top: 0;
  7321. left: 0;
  7322. width: 100%;
  7323. height: 100%;
  7324. background-color: rgba(0, 0, 0, 0.6);
  7325. z-index: 9999;
  7326. opacity: 0;
  7327. transition: opacity 0.4s ease;
  7328. backdrop-filter: blur(3px);
  7329. `;
  7330. document.body.appendChild(overlay);
  7331.  
  7332. // Create the popup container with improved styling
  7333. const popup = document.createElement('div');
  7334. popup.className = 'search-progress-popup';
  7335. popup.style.cssText = `
  7336. position: fixed;
  7337. top: 50%;
  7338. left: 50%;
  7339. transform: translate(-50%, -50%) scale(0.95);
  7340. background-color: rgb(30, 32, 34);
  7341. padding: 30px;
  7342. border-radius: 12px;
  7343. z-index: 10000;
  7344. box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
  7345. display: flex;
  7346. flex-direction: column;
  7347. align-items: center;
  7348. gap: 20px;
  7349. width: 340px;
  7350. opacity: 0;
  7351. transition: opacity 0.4s ease, transform 0.4s ease;
  7352. border: 1px solid rgba(255, 255, 255, 0.1);
  7353. `;
  7354.  
  7355. // Improved title with visual hierarchy
  7356. const title = document.createElement('h3');
  7357. title.textContent = 'Searching for Player...';
  7358. title.style.cssText = `
  7359. color: white;
  7360. margin: 0 0 10px 0;
  7361. font-size: 20px;
  7362. font-weight: 600;
  7363. text-align: center;
  7364. `;
  7365. popup.appendChild(title);
  7366.  
  7367. // Add animated loader element
  7368. const loaderContainer = document.createElement('div');
  7369. loaderContainer.style.cssText = `
  7370. position: relative;
  7371. width: 120px;
  7372. height: 120px;
  7373. display: flex;
  7374. justify-content: center;
  7375. align-items: center;
  7376. `;
  7377.  
  7378. // Create ripple effect around avatar
  7379. const ripple = document.createElement('div');
  7380. ripple.style.cssText = `
  7381. position: absolute;
  7382. width: 110px;
  7383. height: 110px;
  7384. border-radius: 50%;
  7385. border: 3px solid #b71c1c;
  7386. animation: ripple 1.5s ease-out infinite;
  7387. opacity: 0;
  7388. `;
  7389.  
  7390. // Add the keyframe animation
  7391. const style = document.createElement('style');
  7392. style.textContent = `
  7393. @keyframes ripple {
  7394. 0% {
  7395. transform: scale(0.8);
  7396. opacity: 0.8;
  7397. }
  7398. 100% {
  7399. transform: scale(1.2);
  7400. opacity: 0;
  7401. }
  7402. }
  7403. @keyframes pulse {
  7404. 0% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.5); }
  7405. 70% { box-shadow: 0 0 0 10px rgba(58, 122, 255, 0); }
  7406. 100% { box-shadow: 0 0 0 0 rgba(58, 122, 255, 0); }
  7407. }
  7408. `;
  7409. document.head.appendChild(style);
  7410.  
  7411. // Enhanced player thumbnail display
  7412. const thumbnail = document.createElement('img');
  7413. thumbnail.src = avatarThumbnail;
  7414. thumbnail.style.cssText = `
  7415. width: 100px;
  7416. height: 100px;
  7417. border-radius: 50%;
  7418. object-fit: cover;
  7419. border: 4px solid #b71c1c;
  7420. box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
  7421. animation: pulse 2s infinite;
  7422. z-index: 2;
  7423. `;
  7424.  
  7425. loaderContainer.appendChild(ripple);
  7426. loaderContainer.appendChild(thumbnail);
  7427. popup.appendChild(loaderContainer);
  7428.  
  7429. // Status container
  7430. const statusContainer = document.createElement('div');
  7431. statusContainer.style.cssText = `
  7432. background-color: rgba(0, 0, 0, 0.2);
  7433. border-radius: 8px;
  7434. padding: 15px;
  7435. width: 100%;
  7436. box-sizing: border-box;
  7437. `;
  7438.  
  7439. // Improved progress indicators with icons
  7440. const serversSearchedContainer = document.createElement('div');
  7441. serversSearchedContainer.style.cssText = `
  7442. display: flex;
  7443. align-items: center;
  7444. gap: 10px;
  7445. margin-bottom: 10px;
  7446. `;
  7447.  
  7448. const serverIcon = document.createElement('span');
  7449. serverIcon.textContent = '🔍';
  7450. serverIcon.style.fontSize = '18px';
  7451.  
  7452. const serversSearchedText = document.createElement('p');
  7453. serversSearchedText.textContent = 'Servers searched: 0';
  7454. serversSearchedText.style.cssText = `
  7455. color: white;
  7456. margin: 0;
  7457. font-size: 16px;
  7458. flex-grow: 1;
  7459. `;
  7460.  
  7461. serversSearchedContainer.appendChild(serverIcon);
  7462. serversSearchedContainer.appendChild(serversSearchedText);
  7463.  
  7464. const timeElapsedContainer = document.createElement('div');
  7465. timeElapsedContainer.style.cssText = `
  7466. display: flex;
  7467. align-items: center;
  7468. gap: 10px;
  7469. `;
  7470.  
  7471. const timeIcon = document.createElement('span');
  7472. timeIcon.textContent = '⏱️';
  7473. timeIcon.style.fontSize = '18px';
  7474.  
  7475. const timeElapsedText = document.createElement('p');
  7476. timeElapsedText.textContent = 'Time elapsed: 0s';
  7477. timeElapsedText.style.cssText = `
  7478. color: white;
  7479. margin: 0;
  7480. font-size: 16px;
  7481. flex-grow: 1;
  7482. `;
  7483.  
  7484. timeElapsedContainer.appendChild(timeIcon);
  7485. timeElapsedContainer.appendChild(timeElapsedText);
  7486.  
  7487. statusContainer.appendChild(serversSearchedContainer);
  7488. statusContainer.appendChild(timeElapsedContainer);
  7489. popup.appendChild(statusContainer);
  7490.  
  7491. // Add a status message that can be updated
  7492. const statusMessage = document.createElement('p');
  7493. statusMessage.textContent = 'Scanning servers...';
  7494. statusMessage.style.cssText = `
  7495. color: #aaaaaa;
  7496. margin: -10px 0 0 0;
  7497. font-size: 14px;
  7498. text-align: center;
  7499. font-style: italic;
  7500. `;
  7501. popup.appendChild(statusMessage);
  7502.  
  7503. // Append the popup to the body
  7504. document.body.appendChild(popup);
  7505.  
  7506. // Fade in the overlay and popup
  7507. setTimeout(() => {
  7508. overlay.style.opacity = '1';
  7509. popup.style.opacity = '1';
  7510. popup.style.transform = 'translate(-50%, -50%) scale(1)';
  7511. }, 10);
  7512.  
  7513. return {
  7514. popup,
  7515. overlay,
  7516. serversSearchedText,
  7517. timeElapsedText,
  7518. statusMessage,
  7519. ripple
  7520. };
  7521. }
  7522.  
  7523. // Enhanced update function for search progress popup
  7524. function updateSearchProgressPopup(
  7525. progressPopup,
  7526. totalServersChecked,
  7527. timeElapsed,
  7528. isFinal = false
  7529. ) {
  7530. // Update numbers with animation effect
  7531. const currentServers = parseInt(progressPopup.serversSearchedText.textContent.match(/\d+/)[0]);
  7532. const currentTime = parseInt(progressPopup.timeElapsedText.textContent.match(/\d+/)[0]);
  7533.  
  7534. // Animate the number changes
  7535. progressPopup.serversSearchedText.textContent = `Servers searched: ${totalServersChecked}`;
  7536. progressPopup.timeElapsedText.textContent = `Time elapsed: ${timeElapsed}s`;
  7537.  
  7538. // Update status message based on progress
  7539. if (totalServersChecked % 5 === 0) {
  7540. const messages = [
  7541. "Scanning servers...",
  7542. "Checking player lists...",
  7543. "Searching for matches...",
  7544. "Processing server data...",
  7545. "Analyzing player tokens..."
  7546. ];
  7547. progressPopup.statusMessage.textContent = messages[Math.floor(Math.random() * messages.length)];
  7548. }
  7549.  
  7550. if (isFinal) {
  7551. progressPopup.statusMessage.textContent = "Search completed";
  7552. progressPopup.statusMessage.style.color = "#ffaa00";
  7553. progressPopup.statusMessage.style.fontWeight = "bold";
  7554. progressPopup.ripple.style.animationPlayState = "paused";
  7555. progressPopup.serversSearchedText.textContent = `Servers searched: ${totalServersChecked} (complete)`;
  7556. }
  7557. }
  7558.  
  7559. // Enhanced removal function for progress popup
  7560. function fadeOutAndRemove_7th_progress(popup, overlay) {
  7561. popup.style.opacity = '0';
  7562. popup.style.transform = 'translate(-50%, -50%) scale(0.9)';
  7563. overlay.style.opacity = '0';
  7564. setTimeout(() => {
  7565. popup.remove();
  7566. overlay.remove();
  7567. }, 400);
  7568. }
  7569.  
  7570.  
  7571. /*********************************************************************************************************************************************************************************************************************************************
  7572. End of: This is all the functions for the 8 buttons
  7573.  
  7574. *********************************************************************************************************************************************************************************************************************************************/
  7575.  
  7576.  
  7577.  
  7578. /*********************************************************************************************************************************************************************************************************************************************
  7579. The Universal Functions
  7580.  
  7581. *********************************************************************************************************************************************************************************************************************************************/
  7582.  
  7583.  
  7584.  
  7585.  
  7586. /*******************************************************
  7587. name of function: disableLoadMoreButton
  7588. description: Disables the "Load More" button
  7589. *******************************************************/
  7590. function disableLoadMoreButton() {
  7591. const loadMoreButton = document.querySelector('.rbx-running-games-load-more');
  7592. if (loadMoreButton) {
  7593. loadMoreButton.disabled = true;
  7594. loadMoreButton.style.opacity = '0.5'; // Optional: Make the button look disabled
  7595. loadMoreButton.style.cursor = 'not-allowed'; // Optional: Change cursor to indicate disabled state
  7596. loadMoreButton.title = 'Disabled by Rolocate'; // Set tooltip text
  7597. } else {
  7598. ConsoleLogEnabled('Load More button not found!');
  7599. ConsoleLogEnabled('Maybe moved by another extension!');
  7600. }
  7601. }
  7602.  
  7603.  
  7604. /*******************************************************
  7605. name of function: Loadingbar
  7606. description: Shows or hides a loading bar (now using pulsing boxes)
  7607. *******************************************************/
  7608. function Loadingbar(disable) {
  7609. const serverListSection = document.querySelector('#rbx-public-running-games');
  7610. const serverCardsContainer = document.querySelector('#rbx-public-game-server-item-container');
  7611. const emptyGameInstancesContainer = document.querySelector('.section-content-off.empty-game-instances-container');
  7612. const noServersMessage = emptyGameInstancesContainer?.querySelector('.no-servers-message');
  7613.  
  7614. // Check if the "Unable to load servers." message is visible
  7615. if (!serverCardsContainer && noServersMessage?.textContent.includes('Unable to load servers.')) {
  7616. notifications('Unable to load servers. Please refresh the page.', 'error', '⚠️', '8000');
  7617. return;
  7618. }
  7619.  
  7620. // Reset everything if disable is true
  7621. if (disable) {
  7622. if (serverCardsContainer) {
  7623. serverCardsContainer.innerHTML = ''; // Clear contents
  7624. serverCardsContainer.removeAttribute('style'); // Remove inline styles if present
  7625. }
  7626.  
  7627. // Prevent duplicate loading bars
  7628. const existingLoadingBar = document.querySelector('#loading-bar');
  7629. if (existingLoadingBar) {
  7630. existingLoadingBar.remove(); // Remove the existing loading bar if it exists
  7631. }
  7632.  
  7633. // Create and display the loading boxes
  7634. const loadingContainer = document.createElement('div');
  7635. loadingContainer.id = 'loading-bar';
  7636. loadingContainer.style.cssText = `
  7637. display: flex;
  7638. justify-content: center;
  7639. align-items: center;
  7640. gap: 5px;
  7641. margin-top: 10px;
  7642. `;
  7643.  
  7644. const fragment = document.createDocumentFragment();
  7645. for (let i = 0; i < 3; i++) {
  7646. const box = document.createElement('div');
  7647. box.style.cssText = `
  7648. width: 10px;
  7649. height: 10px;
  7650. background-color: white;
  7651. margin: 0 5px;
  7652. border-radius: 2px;
  7653. animation: pulse 1.2s ${i * 0.2}s infinite;
  7654. `;
  7655. fragment.appendChild(box);
  7656. }
  7657. loadingContainer.appendChild(fragment);
  7658.  
  7659. if (serverListSection) {
  7660. serverListSection.appendChild(loadingContainer);
  7661. }
  7662.  
  7663. // Inject CSS only once
  7664. const existingStyle = document.querySelector('#loading-style');
  7665. if (!existingStyle) {
  7666. const styleSheet = document.createElement('style');
  7667. styleSheet.id = 'loading-style';
  7668. styleSheet.textContent = `
  7669. @keyframes pulse {
  7670. 0%, 100% { transform: scale(1); }
  7671. 50% { transform: scale(1.5); }
  7672. }
  7673. `;
  7674. document.head.appendChild(styleSheet);
  7675. }
  7676.  
  7677. // Remove gradient div if it exists
  7678. const gradientDiv = document.querySelector('div[style*="background: linear-gradient(145deg"]');
  7679. if (gradientDiv) {
  7680. gradientDiv.remove();
  7681. }
  7682.  
  7683. // ik this approach sucks but its the best i can do. it remove ths premium messages with this specific
  7684. // text so it doesnet remove the other stuff, you prob cant even understand what im sayin right now
  7685. const premiumMessageDiv = document.querySelector('.premium-message-text');
  7686. if (premiumMessageDiv) {
  7687. const messageText = premiumMessageDiv.textContent.trim();
  7688. const errorMessages = [
  7689. "Error: Cannot access server regions because you have not purchased the game.",
  7690. "Error: This game requires users to teleport to a subplace. As a result, server regions cannot be retrieved."
  7691. ];
  7692.  
  7693. if (errorMessages.includes(messageText)) {
  7694. showMessage("END");
  7695. }
  7696. }
  7697.  
  7698.  
  7699.  
  7700.  
  7701. } else {
  7702. // If disable is false, remove the loading bar
  7703. const loadingBar = document.querySelector('#loading-bar');
  7704. if (loadingBar) {
  7705. loadingBar.remove();
  7706. }
  7707.  
  7708. // Reset any applied styles
  7709. const styleSheet = document.querySelector('#loading-style');
  7710. if (styleSheet) {
  7711. styleSheet.remove();
  7712. }
  7713. }
  7714. }
  7715.  
  7716.  
  7717.  
  7718.  
  7719. /*******************************************************
  7720. name of function: fetchPlayerThumbnails
  7721. description: Fetches player thumbnails for up to 5 players. Skips the batch if an error occurs.
  7722. *******************************************************/
  7723. async function fetchPlayerThumbnails(playerTokens) {
  7724. // Limit to the first 5 player tokens
  7725. const limitedTokens = playerTokens.slice(0, 5);
  7726.  
  7727. const body = limitedTokens.map(token => ({
  7728. requestId: `0:${token}:AvatarHeadshot:150x150:png:regular`,
  7729. type: "AvatarHeadShot",
  7730. targetId: 0,
  7731. token,
  7732. format: "png",
  7733. size: "150x150",
  7734. }));
  7735.  
  7736. try {
  7737. const response = await fetch("https://thumbnails.roblox.com/v1/batch", {
  7738. method: "POST",
  7739. headers: {
  7740. "Content-Type": "application/json",
  7741. Accept: "application/json",
  7742. },
  7743. body: JSON.stringify(body),
  7744. });
  7745.  
  7746. // Check if the response is successful
  7747. if (!response.ok) {
  7748. throw new Error(`HTTP error! Status: ${response.status}`);
  7749. }
  7750.  
  7751. const data = await response.json();
  7752. return data.data || []; // Return the data or an empty array if no data is present
  7753. } catch (error) {
  7754. ConsoleLogEnabled('Error fetching player thumbnails:', error);
  7755. return []; // Return an empty array if an error occurs
  7756. }
  7757. }
  7758.  
  7759.  
  7760. /*******************************************************
  7761. name of function: disableFilterButton
  7762. description: Disables or enables the filter button based on the input.
  7763. *******************************************************/
  7764. function disableFilterButton(disable) {
  7765. const filterButton = document.querySelector('.RL-filter-button');
  7766. const refreshButtons = document.querySelectorAll('.btn-more.rbx-refresh.refresh-link-icon.btn-control-xs.btn-min-width');
  7767. const filterOverlayId = 'filter-button-overlay';
  7768. const refreshOverlayClass = 'refresh-button-overlay';
  7769.  
  7770. if (filterButton) {
  7771. const parent = filterButton.parentElement;
  7772.  
  7773. if (disable) {
  7774. // Disable the filter button with an overlay
  7775. filterButton.disabled = true;
  7776. filterButton.style.opacity = '0.5';
  7777. filterButton.style.cursor = 'not-allowed';
  7778.  
  7779. // Create an overlay if it doesn't exist
  7780. let overlay = document.getElementById(filterOverlayId);
  7781. if (!overlay) {
  7782. overlay = document.createElement('div');
  7783. overlay.id = filterOverlayId;
  7784. overlay.style.position = 'absolute';
  7785. overlay.style.top = '-10px';
  7786. overlay.style.left = '-10px';
  7787. overlay.style.width = 'calc(100% + 20px)';
  7788. overlay.style.height = 'calc(100% + 20px)';
  7789. overlay.style.backgroundColor = 'transparent';
  7790. overlay.style.zIndex = '9999';
  7791. overlay.style.pointerEvents = 'all'; // Block clicks
  7792. parent.style.position = 'relative';
  7793. parent.appendChild(overlay);
  7794. }
  7795. } else {
  7796. // Enable the filter button
  7797. filterButton.disabled = false;
  7798. filterButton.style.opacity = '1';
  7799. filterButton.style.cursor = 'pointer';
  7800.  
  7801. // Remove the overlay if it exists
  7802. const overlay = document.getElementById(filterOverlayId);
  7803. if (overlay) {
  7804. overlay.remove();
  7805. }
  7806. }
  7807. } else {
  7808. ConsoleLogEnabled('Filter button not found! Something is wrong!');
  7809. notifications("Something's wrong. Please report and issue on Greasyfork.", "error", "⚠️", "15000");
  7810. }
  7811.  
  7812. if (refreshButtons.length > 0) {
  7813. refreshButtons.forEach((refreshButton) => {
  7814. const refreshParent = refreshButton.parentElement;
  7815.  
  7816. if (disable) {
  7817. // Create an overlay over the refresh button
  7818. let refreshOverlay = refreshParent.querySelector(`.${refreshOverlayClass}`);
  7819. if (!refreshOverlay) {
  7820. refreshOverlay = document.createElement('div');
  7821. refreshOverlay.className = refreshOverlayClass;
  7822. refreshOverlay.style.position = 'absolute';
  7823. refreshOverlay.style.top = '-10px';
  7824. refreshOverlay.style.left = '-10px';
  7825. refreshOverlay.style.width = 'calc(100% + 20px)';
  7826. refreshOverlay.style.height = 'calc(100% + 20px)';
  7827. refreshOverlay.style.backgroundColor = 'transparent';
  7828. refreshOverlay.style.zIndex = '9999';
  7829. refreshOverlay.style.pointerEvents = 'all'; // Block clicks
  7830. refreshParent.style.position = 'relative';
  7831. refreshParent.appendChild(refreshOverlay);
  7832. }
  7833. } else {
  7834. // Remove the overlay if it exists
  7835. const refreshOverlay = refreshParent.querySelector(`.${refreshOverlayClass}`);
  7836. if (refreshOverlay) {
  7837. refreshOverlay.remove();
  7838. }
  7839. }
  7840. });
  7841. } else {
  7842. ConsoleLogEnabled('Refresh button not found!');
  7843. notifications("Something's wrong. Please report and issue on Greasyfork.", "error", "⚠️", "15000");
  7844. }
  7845. }
  7846.  
  7847.  
  7848.  
  7849. async function rbx_card(serverId, playerTokens, maxPlayers, playing, gameId) {
  7850. // Fetch player thumbnails (up to 5)
  7851. const thumbnails = await fetchPlayerThumbnails(playerTokens);
  7852.  
  7853. // Create the server card container
  7854. const cardItem = document.createElement('li');
  7855. cardItem.className = 'rbx-game-server-item col-md-3 col-sm-4 col-xs-6';
  7856.  
  7857. // Create the player thumbnails container
  7858. const playerThumbnailsContainer = document.createElement('div');
  7859. playerThumbnailsContainer.className = 'player-thumbnails-container';
  7860.  
  7861. // Add player thumbnails to the container (up to 5)
  7862. thumbnails.forEach(thumbnail => {
  7863. const playerAvatar = document.createElement('span');
  7864. playerAvatar.className = 'avatar avatar-headshot-md player-avatar';
  7865.  
  7866. const thumbnailImage = document.createElement('span');
  7867. thumbnailImage.className = 'thumbnail-2d-container avatar-card-image';
  7868.  
  7869. const img = document.createElement('img');
  7870. img.src = thumbnail.imageUrl;
  7871. img.alt = '';
  7872. img.title = '';
  7873.  
  7874. thumbnailImage.appendChild(img);
  7875. playerAvatar.appendChild(thumbnailImage);
  7876. playerThumbnailsContainer.appendChild(playerAvatar);
  7877. });
  7878.  
  7879. // Add the 6th placeholder for remaining players
  7880. if (playing > 5) {
  7881. const remainingPlayers = playing - 5;
  7882. const placeholder = document.createElement('span');
  7883. placeholder.className = 'avatar avatar-headshot-md player-avatar hidden-players-placeholder';
  7884. placeholder.textContent = `+${remainingPlayers}`;
  7885. placeholder.style.cssText = `
  7886. background-color: #6a6f81; /* Grayish-blue background */
  7887. color: white;
  7888. display: flex;
  7889. align-items: center;
  7890. justify-content: center;
  7891. border-radius: 50%; /* Fully round */
  7892. font-size: 16px; /* Larger font size */
  7893. width: 60px; /* Larger width */
  7894. height: 60px; /* Larger height */
  7895. `;
  7896. playerThumbnailsContainer.appendChild(placeholder);
  7897. }
  7898.  
  7899. // Create the server details container
  7900. const serverDetails = document.createElement('div');
  7901. serverDetails.className = 'rbx-game-server-details game-server-details';
  7902.  
  7903. // Add server status (e.g., "15 of 15 people max")
  7904. const serverStatus = document.createElement('div');
  7905. serverStatus.className = 'text-info rbx-game-status rbx-game-server-status text-overflow';
  7906. serverStatus.textContent = `${playing} of ${maxPlayers} people max`;
  7907. serverDetails.appendChild(serverStatus);
  7908.  
  7909. // Add the player count gauge
  7910. const gaugeContainer = document.createElement('div');
  7911. gaugeContainer.className = 'server-player-count-gauge border';
  7912.  
  7913. const gaugeInner = document.createElement('div');
  7914. gaugeInner.className = 'gauge-inner-bar border';
  7915. gaugeInner.style.width = `${(playing / maxPlayers) * 100}%`;
  7916.  
  7917. gaugeContainer.appendChild(gaugeInner);
  7918. serverDetails.appendChild(gaugeContainer);
  7919.  
  7920. // Create a container for the buttons
  7921. const buttonContainer = document.createElement('div');
  7922. buttonContainer.className = 'button-container';
  7923. buttonContainer.style.cssText = `
  7924. display: flex;
  7925. gap: 8px; /* Space between buttons */
  7926. `;
  7927.  
  7928. // Add the "Join" button
  7929. const joinButton = document.createElement('button');
  7930. joinButton.type = 'button';
  7931. joinButton.className = 'btn-full-width btn-control-xs rbx-game-server-join game-server-join-btn btn-primary-md btn-min-width';
  7932. joinButton.textContent = 'Join';
  7933.  
  7934. // Add click event to join the server
  7935. joinButton.addEventListener('click', () => {
  7936. showLoadingOverlay();
  7937. Roblox.GameLauncher.joinGameInstance(gameId, serverId);
  7938. });
  7939.  
  7940. buttonContainer.appendChild(joinButton);
  7941.  
  7942. // Add the "Invite" button
  7943. const inviteButton = document.createElement('button');
  7944. inviteButton.type = 'button';
  7945. inviteButton.className = 'btn-full-width btn-control-xs rbx-game-server-invite game-server-invite-btn btn-secondary-md btn-min-width';
  7946. inviteButton.textContent = 'Invite';
  7947.  
  7948. // Add click event to log the invite link
  7949. inviteButton.addEventListener('click', () => {
  7950. const inviteLink = `https://oqarshi.github.io/Invite/?placeid=${gameId}&serverid=${serverId}`;
  7951. ConsoleLogEnabled('Copied invite link:', inviteLink);
  7952. navigator.clipboard.writeText(inviteLink).then(() => {
  7953. notifications('Success! Invite link copied to clipboard!', 'success', '🎉', '2000');
  7954. ConsoleLogEnabled('Invite link copied to clipboard');
  7955. }).catch(err => {
  7956. ConsoleLogEnabled('Failed to copy invite link:', err);
  7957. notifications('Failed! Invite link copied to clipboard!', 'error', '⚠️', '2000');
  7958. });
  7959. });
  7960.  
  7961. buttonContainer.appendChild(inviteButton);
  7962.  
  7963. // Add the button container to the server details
  7964. serverDetails.appendChild(buttonContainer);
  7965.  
  7966. // Assemble the card
  7967. const cardContainer = document.createElement('div');
  7968. cardContainer.className = 'card-item';
  7969. cardContainer.appendChild(playerThumbnailsContainer);
  7970. cardContainer.appendChild(serverDetails);
  7971.  
  7972. cardItem.appendChild(cardContainer);
  7973.  
  7974. // Add the card to the server list
  7975. const serverList = document.querySelector('#rbx-public-game-server-item-container');
  7976. serverList.appendChild(cardItem);
  7977. }
  7978.  
  7979. /*********************************************************************************************************************************************************************************************************************************************
  7980. End of function for the notification function
  7981.  
  7982. *********************************************************************************************************************************************************************************************************************************************/
  7983.  
  7984.  
  7985. /*********************************************************************************************************************************************************************************************************************************************
  7986. Launching Function
  7987.  
  7988. *********************************************************************************************************************************************************************************************************************************************/
  7989.  
  7990. function showLoadingOverlay() {
  7991. // Create the content div (no overlay background)
  7992. const content = document.createElement('div');
  7993. content.style.position = 'fixed';
  7994. content.style.top = 'calc(50% - 15px)'; // Move 15px higher
  7995. content.style.left = '50%';
  7996. content.style.transform = 'translate(-50%, -50%)'; // Center the box horizontally
  7997. content.style.width = '400px';
  7998. content.style.height = '250px';
  7999. content.style.backgroundColor = '#1e1e1e'; // Dark background
  8000. content.style.display = 'flex';
  8001. content.style.flexDirection = 'column';
  8002. content.style.justifyContent = 'center';
  8003. content.style.alignItems = 'center';
  8004. content.style.boxShadow = '0 4px 20px rgba(0, 0, 0, 0.5)'; // Subtle shadow
  8005. content.style.borderRadius = '12px'; // Slightly rounded corners
  8006. content.style.zIndex = '1000000'; // z-index set to 1 million
  8007. content.style.opacity = '0'; // Start with 0 opacity for fade-in
  8008. content.style.transition = 'opacity 0.5s ease'; // Fade-in transition
  8009. content.style.fontFamily = 'Arial, sans-serif'; // Clean font
  8010.  
  8011. // Create the loading text
  8012. const loadingText = document.createElement('p');
  8013. loadingText.textContent = 'Joining Roblox Game...';
  8014. loadingText.style.fontSize = '20px';
  8015. loadingText.style.color = '#fff'; // White text for contrast
  8016. loadingText.style.marginTop = '20px'; // Spacing between image and text
  8017. loadingText.style.fontWeight = 'bold'; // Bold text
  8018.  
  8019. // Create the base64 image
  8020. const base64Image = document.createElement('img');
  8021. base64Image.src = window.Base64Images.logo;
  8022. base64Image.style.width = '80px'; // Slightly larger image
  8023. base64Image.style.height = '80px'; // Slightly larger image
  8024. base64Image.style.borderRadius = '8px'; // Rounded corners for the image
  8025.  
  8026. // Create the loading boxes container
  8027. const loadingBoxes = document.createElement('div');
  8028. loadingBoxes.style.display = 'flex';
  8029. loadingBoxes.style.alignItems = 'center';
  8030. loadingBoxes.style.justifyContent = 'center';
  8031. loadingBoxes.style.marginTop = '15px'; // Spacing between text and boxes
  8032.  
  8033. // Create the three loading boxes
  8034. for (let i = 0; i < 3; i++) {
  8035. const box = document.createElement('div');
  8036. box.style.width = '10px';
  8037. box.style.height = '10px';
  8038. box.style.backgroundColor = '#fff'; // White boxes
  8039. box.style.margin = '0 5px'; // Spacing between boxes
  8040. box.style.borderRadius = '2px'; // Slightly rounded corners
  8041. box.style.animation = `pulse 1.2s ${i * 0.2}s infinite`; // Animation with delay
  8042. loadingBoxes.appendChild(box);
  8043. }
  8044.  
  8045. // Define the pulse animation using CSS
  8046. const style = document.createElement('style');
  8047. style.textContent = `
  8048. @keyframes pulse {
  8049. 0%, 100% { transform: scale(1); }
  8050. 50% { transform: scale(1.5); }
  8051. }
  8052. `;
  8053. document.head.appendChild(style); // Add the animation to the document
  8054.  
  8055. // Append the image, text, and loading boxes to the content div
  8056. content.appendChild(base64Image);
  8057. content.appendChild(loadingText);
  8058. content.appendChild(loadingBoxes);
  8059.  
  8060. // Append the content div to the body
  8061. document.body.appendChild(content);
  8062.  
  8063. // Trigger fade-in animation
  8064. setTimeout(() => {
  8065. content.style.opacity = '1';
  8066. }, 10); // Small delay to trigger the transition
  8067.  
  8068. // Remove the content after 8 seconds with fade-out animation
  8069. setTimeout(() => {
  8070. content.style.opacity = '0'; // Fade out
  8071. setTimeout(() => {
  8072. document.body.removeChild(content); // Remove after fade-out completes
  8073. }, 500); // Wait for the fade-out transition to finish
  8074. }, 8000); // 8000 milliseconds = 8 seconds
  8075. }
  8076.  
  8077.  
  8078. /*********************************************************************************************************************************************************************************************************************************************
  8079. End of function for the launching function
  8080.  
  8081. *********************************************************************************************************************************************************************************************************************************************/
  8082.  
  8083. const serverRegionsByIp = {
  8084. "128.116.0.0": { city: "Hong Kong", country: { name: "Hong Kong", code: "HK" }, latitude: 22.3193, longitude: 114.1694 },
  8085. "128.116.1.0": { city: "Los Angeles", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 34.0522, longitude: -118.2437 },
  8086. "128.116.2.0": { city: "Warsaw", country: { name: "Poland", code: "PL" }, region: { name: "Mazowieckie", code: "14" }, latitude: 52.2297, longitude: 21.0122 },
  8087. "128.116.3.0": { city: "Warsaw", country: { name: "Poland", code: "PL" }, region: { name: "Mazowieckie", code: "14" }, latitude: 52.2297, longitude: 21.0122 },
  8088. "128.116.4.0": { city: "Paris", country: { name: "France", code: "FR" }, region: { name: "Île-de-France", code: "IDF" }, latitude: 48.8566, longitude: 2.3522 },
  8089. "128.116.5.0": { city: "Frankfurt am Main", country: { name: "Germany", code: "DE" }, region: { name: "Hessen", code: "HE" }, latitude: 50.1109, longitude: 8.6821 },
  8090. "128.116.6.0": { city: "Tokyo", country: { name: "Japan", code: "JP" }, region: { name: "Tokyo", code: "13" }, latitude: 35.6895, longitude: 139.6917 },
  8091. "128.116.7.0": { city: "Mumbai", country: { name: "India", code: "IN" }, region: { name: "Mahārāshtra", code: "MH" }, latitude: 19.0760, longitude: 72.8777 },
  8092. "128.116.8.0": { city: "Frankfurt am Main", country: { name: "Germany", code: "DE" }, region: { name: "Hessen", code: "HE" }, latitude: 50.1109, longitude: 8.6821 },
  8093. "128.116.9.0": { city: "Mumbai", country: { name: "India", code: "IN" }, region: { name: "Mahārāshtra", code: "MH" }, latitude: 19.0760, longitude: 72.8777 },
  8094. "128.116.10.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8095. "128.116.11.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8096. "128.116.12.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8097. "128.116.13.0": { city: "Amsterdam", country: { name: "Netherlands", code: "NL" }, region: { name: "Noord-Holland", code: "NH" }, latitude: 52.3676, longitude: 4.9041 },
  8098. "128.116.14.0": { city: "Hong Kong", country: { name: "Hong Kong", code: "HK" }, latitude: 22.3193, longitude: 114.1694 },
  8099. "128.116.15.0": { city: "Secaucus", country: { name: "United States", code: "US" }, region: { name: "New Jersey", code: "NJ" }, latitude: 40.7895, longitude: -74.0565 },
  8100. "128.116.16.0": { city: "Secaucus", country: { name: "United States", code: "US" }, region: { name: "New Jersey", code: "NJ" }, latitude: 40.7895, longitude: -74.0565 },
  8101. "128.116.17.0": { city: "Secaucus", country: { name: "United States", code: "US" }, region: { name: "New Jersey", code: "NJ" }, latitude: 40.7895, longitude: -74.0565 },
  8102. "128.116.18.0": { city: "Miami", country: { name: "United States", code: "US" }, region: { name: "Florida", code: "FL" }, latitude: 25.7617, longitude: -80.1918 },
  8103. "128.116.19.0": { city: "Paris", country: { name: "France", code: "FR" }, region: { name: "Île-de-France", code: "IDF" }, latitude: 48.8566, longitude: 2.3522 },
  8104. "128.116.20.0": { city: "Paris", country: { name: "France", code: "FR" }, region: { name: "Île-de-France", code: "IDF" }, latitude: 48.8566, longitude: 2.3522 },
  8105. "128.116.21.0": { city: "Amsterdam", country: { name: "Netherlands", code: "NL" }, region: { name: "Noord-Holland", code: "NH" }, latitude: 52.3676, longitude: 4.9041 },
  8106. "128.116.22.0": { city: "Atlanta", country: { name: "United States", code: "US" }, region: { name: "Georgia", code: "GA" }, latitude: 33.7490, longitude: -84.3880 },
  8107. "128.116.23.0": { city: "Secaucus", country: { name: "United States", code: "US" }, region: { name: "New Jersey", code: "NJ" }, latitude: 40.7895, longitude: -74.0565 },
  8108. "128.116.24.0": { city: "Atlanta", country: { name: "United States", code: "US" }, region: { name: "Georgia", code: "GA" }, latitude: 33.7490, longitude: -84.3880 },
  8109. "128.116.25.0": { city: "Atlanta", country: { name: "United States", code: "US" }, region: { name: "Georgia", code: "GA" }, latitude: 33.7490, longitude: -84.3880 },
  8110. "128.116.26.0": { city: "Paris", country: { name: "France", code: "FR" }, region: { name: "Île-de-France", code: "IDF" }, latitude: 48.8566, longitude: 2.3522 },
  8111. "128.116.27.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8112. "128.116.28.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8113. "128.116.29.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8114. "128.116.30.0": { city: "Hong Kong", country: { name: "Hong Kong", code: "HK" }, latitude: 22.3193, longitude: 114.1694 },
  8115. "128.116.31.0": { city: "Warsaw", country: { name: "Poland", code: "PL" }, region: { name: "Mazowieckie", code: "14" }, latitude: 52.2297, longitude: 21.0122 },
  8116. "128.116.32.0": { city: "New York City", country: { name: "United States", code: "US" }, region: { name: "New York", code: "NY" }, latitude: 40.7128, longitude: -74.0060 },
  8117. "128.116.33.0": { city: "London", country: { name: "United Kingdom", code: "GB" }, region: { name: "England", code: "ENG" }, latitude: 51.5072, longitude: 0.1276 },
  8118. "128.116.34.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8119. "128.116.35.0": { city: "London", country: { name: "United Kingdom", code: "GB" }, region: { name: "England", code: "ENG" }, latitude: 51.5072, longitude: 0.1276 },
  8120. "128.116.36.0": { city: "London", country: { name: "United Kingdom", code: "GB" }, region: { name: "England", code: "ENG" }, latitude: 51.5072, longitude: 0.1276 },
  8121. "128.116.37.0": { city: "Miami", country: { name: "United States", code: "US" }, region: { name: "Florida", code: "FL" }, latitude: 25.7617, longitude: -80.1918 },
  8122. "128.116.38.0": { city: "Miami", country: { name: "United States", code: "US" }, region: { name: "Florida", code: "FL" }, latitude: 25.7617, longitude: -80.1918 },
  8123. "128.116.39.0": { city: "Frankfurt am Main", country: { name: "Germany", code: "DE" }, region: { name: "Hessen", code: "HE" }, latitude: 50.1109, longitude: 8.6821 },
  8124. "128.116.40.0": { city: "Frankfurt am Main", country: { name: "Germany", code: "DE" }, region: { name: "Hessen", code: "HE" }, latitude: 50.1109, longitude: 8.6821 },
  8125. "128.116.41.0": { city: "Frankfurt am Main", country: { name: "Germany", code: "DE" }, region: { name: "Hessen", code: "HE" }, latitude: 50.1109, longitude: 8.6821 },
  8126. "128.116.42.0": { city: "Frankfurt am Main", country: { name: "Germany", code: "DE" }, region: { name: "Hessen", code: "HE" }, latitude: 50.1109, longitude: 8.6821 },
  8127. "128.116.43.0": { city: "Frankfurt am Main", country: { name: "Germany", code: "DE" }, region: { name: "Hessen", code: "HE" }, latitude: 50.1109, longitude: 8.6821 },
  8128. "128.116.44.0": { city: "Frankfurt am Main", country: { name: "Germany", code: "DE" }, region: { name: "Hessen", code: "HE" }, latitude: 50.1109, longitude: 8.6821 },
  8129. "128.116.45.0": { city: "Miami", country: { name: "United States", code: "US" }, region: { name: "Florida", code: "FL" }, latitude: 25.7617, longitude: -80.1918 },
  8130. "128.116.46.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8131. "128.116.47.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8132. "128.116.48.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8133. "128.116.49.0": { city: "Los Angeles", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 34.0522, longitude: -118.2437 },
  8134. "128.116.50.0": { city: "Singapore", country: { name: "Singapore", code: "SG" }, latitude: 1.3521, longitude: 103.8198 },
  8135. "128.116.51.0": { city: "Sydney", country: { name: "Australia", code: "AU" }, region: { name: "New South Wales", code: "NSW" }, latitude: -33.8688, longitude: 151.2093 },
  8136. "128.116.52.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8137. "128.116.53.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8138. "128.116.54.0": { city: "Amsterdam", country: { name: "Netherlands", code: "NL" }, region: { name: "Noord-Holland", code: "NH" }, latitude: 52.3676, longitude: 4.9041 },
  8139. "128.116.55.0": { city: "Tokyo", country: { name: "Japan", code: "JP" }, region: { name: "Tokyo", code: "13" }, latitude: 35.6895, longitude: 139.6917 },
  8140. "128.116.56.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8141. "128.116.57.0": { city: "San Jose", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.3382, longitude: -121.8863 },
  8142. "128.116.58.0": { city: "Tokyo", country: { name: "Japan", code: "JP" }, region: { name: "Tokyo", code: "13" }, latitude: 35.6895, longitude: 139.6917 },
  8143. "128.116.59.0": { city: "Tokyo", country: { name: "Japan", code: "JP" }, region: { name: "Tokyo", code: "13" }, latitude: 35.6895, longitude: 139.6917 },
  8144. "128.116.60.0": { city: "Tokyo", country: { name: "Japan", code: "JP" }, region: { name: "Tokyo", code: "13" }, latitude: 35.6895, longitude: 139.6917 },
  8145. "128.116.61.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8146. "128.116.62.0": { city: "Seattle", country: { name: "United States", code: "US" }, region: { name: "Washington", code: "WA" }, latitude: 47.6062, longitude: -122.3321 },
  8147. "128.116.63.0": { city: "Los Angeles", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 34.0522, longitude: -118.2437 },
  8148. "128.116.64.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8149. "128.116.65.0": { city: "Secaucus", country: { name: "United States", code: "US" }, region: { name: "New Jersey", code: "NJ" }, latitude: 40.7895, longitude: -74.0565 },
  8150. "128.116.66.0": { city: "Secaucus", country: { name: "United States", code: "US" }, region: { name: "New Jersey", code: "NJ" }, latitude: 40.7895, longitude: -74.0565 },
  8151. "128.116.67.0": { city: "San Jose", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.3382, longitude: -121.8863 },
  8152. "128.116.68.0": { city: "Santa Clara", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.3541, longitude: -121.9552 },
  8153. "128.116.69.0": { city: "Santa Clara", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.3541, longitude: -121.9552 },
  8154. "128.116.70.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8155. "128.116.71.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8156. "128.116.72.0": { city: "London", country: { name: "United Kingdom", code: "GB" }, region: { name: "England", code: "ENG" }, latitude: 51.5072, longitude: 0.1276 },
  8157. "128.116.73.0": { city: "London", country: { name: "United Kingdom", code: "GB" }, region: { name: "England", code: "ENG" }, latitude: 51.5072, longitude: 0.1276 },
  8158. "128.116.74.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8159. "128.116.75.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8160. "128.116.76.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8161. "128.116.77.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8162. "128.116.78.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8163. "128.116.79.0": { city: "Singapore", country: { name: "Singapore", code: "SG" }, latitude: 1.3521, longitude: 103.8198 },
  8164. "128.116.80.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8165. "128.116.81.0": { city: "Santa Clara", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.3541, longitude: -121.9552 },
  8166. "128.116.82.0": { city: "Tokyo", country: { name: "Japan", code: "JP" }, region: { name: "Tokyo", code: "13" }, latitude: 35.6895, longitude: 139.6917 },
  8167. "128.116.83.0": { city: "Tokyo", country: { name: "Japan", code: "JP" }, region: { name: "Tokyo", code: "13" }, latitude: 35.6895, longitude: 139.6917 },
  8168. "128.116.84.0": { city: "Elk Grove Village", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 42.0039, longitude: -87.9706 },
  8169. "128.116.85.0": { city: "Miami", country: { name: "United States", code: "US" }, region: { name: "Florida", code: "FL" }, latitude: 25.7617, longitude: -80.1918 },
  8170. "128.116.86.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8171. "128.116.87.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8172. "128.116.88.0": { city: "Elk Grove Village", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 42.0039, longitude: -87.9706 },
  8173. "128.116.89.0": { city: "London", country: { name: "United Kingdom", code: "GB" }, region: { name: "England", code: "ENG" }, latitude: 51.5072, longitude: 0.1276 },
  8174. "128.116.90.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8175. "128.116.91.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8176. "128.116.92.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8177. "128.116.93.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8178. "128.116.94.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8179. "128.116.95.0": { city: "Dallas", country: { name: "United States", code: "US" }, region: { name: "Texas", code: "TX" }, latitude: 32.7767, longitude: -96.7970 },
  8180. "128.116.96.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8181. "128.116.97.0": { city: "Singapore", country: { name: "Singapore", code: "SG" }, latitude: 1.3521, longitude: 103.8198 },
  8182. "128.116.98.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8183. "128.116.99.0": { city: "Atlanta", country: { name: "United States", code: "US" }, region: { name: "Georgia", code: "GA" }, latitude: 33.7490, longitude: -84.3880 },
  8184. "128.116.100.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8185. "128.116.101.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8186. "128.116.102.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8187. "128.116.103.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8188. "128.116.104.0": { city: "Mumbai", country: { name: "India", code: "IN" }, region: { name: "Mahārāshtra", code: "MH" }, latitude: 19.0760, longitude: 72.8777 },
  8189. "128.116.105.0": { city: "Santa Clara", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.3541, longitude: -121.9552 },
  8190. "128.116.106.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8191. "128.116.107.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8192. "128.116.108.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8193. "128.116.109.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8194. "128.116.110.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8195. "128.116.111.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8196. "128.116.112.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8197. "128.116.113.0": { city: "Chicago", country: { name: "United States", code: "US" }, region: { name: "Illinois", code: "IL" }, latitude: 41.8781, longitude: -87.6298 },
  8198. "128.116.114.0": { city: "Ashburn", country: { name: "United States", code: "US" }, region: { name: "Virginia", code: "VA" }, latitude: 39.0438, longitude: -77.4874 },
  8199. "128.116.115.0": { city: "Seattle", country: { name: "United States", code: "US" }, region: { name: "Washington", code: "WA" }, latitude: 47.6062, longitude: -122.3321 },
  8200. "128.116.116.0": { city: "Los Angeles", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 34.0522, longitude: -118.2437 },
  8201. "128.116.117.0": { city: "San Jose", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.3382, longitude: -121.8863 },
  8202. "128.116.118.0": { city: "Hong Kong", country: { name: "Hong Kong", code: "HK" }, latitude: 22.3193, longitude: 114.1694 },
  8203. "128.116.119.0": { city: "London", country: { name: "United Kingdom", code: "GB" }, region: { name: "England", code: "ENG" }, latitude: 51.5072, longitude: 0.1276 },
  8204. "128.116.120.0": { city: "Tokyo", country: { name: "Japan", code: "JP" }, region: { name: "Tokyo", code: "13" }, latitude: 35.6895, longitude: 139.6917 },
  8205. "128.116.121.0": { city: "Amsterdam", country: { name: "Netherlands", code: "NL" }, region: { name: "Noord-Holland", code: "NH" }, latitude: 52.3676, longitude: 4.9041 },
  8206. "128.116.122.0": { city: "Paris", country: { name: "France", code: "FR" }, region: { name: "Île-de-France", code: "IDF" }, latitude: 48.8566, longitude: 2.3522 },
  8207. "128.116.123.0": { city: "Frankfurt am Main", country: { name: "Germany", code: "DE" }, region: { name: "Hessen", code: "HE" }, latitude: 50.1109, longitude: 8.6821 },
  8208. "128.116.124.0": { city: "Warsaw", country: { name: "Poland", code: "PL" }, region: { name: "Mazowieckie", code: "14" }, latitude: 52.2297, longitude: 21.0122 },
  8209. "128.116.125.0": { city: "San Mateo", country: { name: "United States", code: "US" }, region: { name: "California", code: "CA" }, latitude: 37.5630, longitude: -122.3255 },
  8210. "128.116.126.0": { city: "Secaucus", country: { name: "United States", code: "US" }, region: { name: "New Jersey", code: "NJ" }, latitude: 40.7895, longitude: -74.0565 },
  8211. "128.116.127.0": { city: "Miami", country: { name: "United States", code: "US" }, region: { name: "Florida", code: "FL" }, latitude: 25.7617, longitude: -80.1918 },
  8212. };
  8213. // find_game_id function does nothing lmao but its ere i guees
  8214. function find_game_id() {
  8215. ConsoleLogEnabled('Trying to find game id');
  8216. const gameIdMatch = window.location.pathname.match(/\/games\/(\d+)\//);
  8217. if (!gameIdMatch) {
  8218. ConsoleLogEnabled("Game ID not found in URL!");
  8219. return;
  8220. }
  8221.  
  8222. const gameId = gameIdMatch[1];
  8223. }
  8224.  
  8225.  
  8226. // end of the check for the url
  8227. }
  8228.  
  8229. /*******************************************************
  8230. End of code for the random hop button and the filter button on roblox.com/games/*
  8231. *******************************************************/
  8232.  
  8233.  
  8234.  
  8235.  
  8236. })();