Enhanced Roblox Display Modifier by OB

Modifies Robux display and item details on Roblox pages by OB

  1. // ==UserScript==
  2. // @name Enhanced Roblox Display Modifier by OB
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.6
  5. // @description Modifies Robux display and item details on Roblox pages by OB
  6. // @match https://*.roblox.com/*
  7. // @license MIT
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Configuration
  16. const config = {
  17. desiredRobuxAmount: 100000,
  18. itemsToModify: [
  19. {
  20. originalName: "ITEM NAME",
  21. newName: "Sparkle Time Fedora",
  22. newImageUrl: "https://tr.rbxcdn.com/0c54305eb2775385ee670cb16f28e1f0/150/150/Hat/Webp",
  23. hasRestrictionIcon: true
  24. },
  25. {
  26. originalName: "ITEM NAME",
  27. newName: "Blackvalk",
  28. newImageUrl: "https://tr.rbxcdn.com/8d250084fe0bfe56b7ef82ead80fc079/150/150/Hat/Webp",
  29. hasRestrictionIcon: true
  30. },
  31. {
  32. originalName: "ITEM NAME",
  33. newName: "Teal Sparkle Time Fedora",
  34. newImageUrl: "https://tr.rbxcdn.com/401b49b8a1c3ca0956b3a137f9f2d17d/150/150/Hat/Webp",
  35. hasRestrictionIcon: true
  36. }
  37. ]
  38. };
  39.  
  40. // Function to format the Robux amount with K for thousands (no decimal)
  41. function formatRobuxAmountK(amount) {
  42. return amount >= 1000 ? Math.floor(amount / 1000) + 'K' : amount.toString();
  43. }
  44.  
  45. // Function to format the Robux amount with commas
  46. function formatRobuxAmountCommas(amount) {
  47. return amount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  48. }
  49.  
  50. // Function to edit the Robux display in the navigation bar
  51. function editNavRobuxDisplay() {
  52. const robuxAmountElement = document.getElementById('nav-robux-amount');
  53. const formattedAmount = formatRobuxAmountK(config.desiredRobuxAmount);
  54. if (robuxAmountElement && robuxAmountElement.textContent !== formattedAmount) {
  55. robuxAmountElement.textContent = formattedAmount;
  56. }
  57. }
  58.  
  59. // Function to edit the Robux display in the balance area
  60. function editBalanceRobuxDisplay() {
  61. const balanceElements = document.querySelectorAll('span:has(.icon-robux-16x16)');
  62. balanceElements.forEach(element => {
  63. const robuxElement = element.querySelector('.icon-robux-16x16');
  64. if (robuxElement && robuxElement.nextSibling) {
  65. const formattedAmount = formatRobuxAmountCommas(config.desiredRobuxAmount);
  66. robuxElement.nextSibling.textContent = formattedAmount;
  67. }
  68. });
  69. }
  70.  
  71. // Function to modify item details
  72. function modifyItemDetails() {
  73. const itemCards = document.querySelectorAll('.item-card');
  74.  
  75. itemCards.forEach(card => {
  76. const itemNameElement = card.querySelector('.item-card-name');
  77. const itemImageElement = card.querySelector('.item-card-thumb-container img');
  78.  
  79. if (itemNameElement && itemImageElement) {
  80. const itemName = itemNameElement.textContent.trim();
  81. const originalItem = config.itemsToModify.find(item => item.originalName.toLowerCase() === itemName.toLowerCase());
  82.  
  83. if (originalItem) {
  84. // Update the item name
  85. itemNameElement.textContent = originalItem.newName;
  86. itemNameElement.title = originalItem.newName;
  87.  
  88. // Update the item image
  89. itemImageElement.src = originalItem.newImageUrl;
  90. itemImageElement.setAttribute('ng-src', originalItem.newImageUrl); // For AngularJS bindings
  91.  
  92. // Check for restriction icon
  93. const restrictionIconContainer = card.querySelector('.item-card-thumb-container');
  94.  
  95. // Create the restriction icon
  96. if (originalItem.hasRestrictionIcon) {
  97. const iconSpan = document.createElement('span');
  98. iconSpan.className = 'restriction-icon icon-limited-unique-label';
  99. iconSpan.setAttribute('ng-show', 'item.itemRestrictionIcon');
  100. iconSpan.setAttribute('ng-class', 'item.itemRestrictionIcon');
  101.  
  102. // Remove existing icons to avoid duplicates
  103. const existingIcon = restrictionIconContainer.querySelector('.restriction-icon');
  104. if (existingIcon) {
  105. existingIcon.remove();
  106. }
  107.  
  108. // Append the new icon
  109. restrictionIconContainer.appendChild(iconSpan);
  110. }
  111. }
  112. }
  113. });
  114. }
  115.  
  116. // Function to continuously check and update all displays
  117. function updateAllDisplays() {
  118. editNavRobuxDisplay();
  119. editBalanceRobuxDisplay();
  120. modifyItemDetails();
  121. requestAnimationFrame(updateAllDisplays);
  122. }
  123.  
  124. // Start observing DOM changes
  125. const observer = new MutationObserver(() => {
  126. editNavRobuxDisplay();
  127. editBalanceRobuxDisplay();
  128. modifyItemDetails();
  129. });
  130.  
  131. // Function to start everything
  132. function init() {
  133. updateAllDisplays();
  134. observer.observe(document.body, { childList: true, subtree: true });
  135. }
  136.  
  137. // Run init as soon as the DOM is ready
  138. if (document.readyState === 'loading') {
  139. document.addEventListener('DOMContentLoaded', init);
  140. } else {
  141. init();
  142. }
  143. })();