Robux to USD

Converts Robux values shown in <span class="text-robux"> to USD using the DevEx rate of $0.0035 per Robux

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Robux to USD
// @namespace    https://roblox.com/
// @version      1.2
// @description  Converts Robux values shown in <span class="text-robux"> to USD using the DevEx rate of $0.0035 per Robux
// @author       Meadow
// @match        https://www.roblox.com/*
// @grant        none
// @run-at       document-end
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    const ROBUX_TO_USD = 0.0035;

    // Convert Robux to USD string
    function robuxToUSD(robux) {
        return `$${(robux * ROBUX_TO_USD).toFixed(2)} USD`;
    }

    // Check and convert all .text-robux spans
    function convertRobuxSpans() {
        const spans = document.querySelectorAll('span.text-robux');

        spans.forEach(span => {
            if (span.dataset.converted === 'true') return; // Skip already converted

            const robux = parseInt(span.textContent.replace(/[^\d]/g, ''), 10);
            if (isNaN(robux)) return;

            // Create USD display
            const usdDisplay = document.createElement('span');
            usdDisplay.textContent = ` (${robuxToUSD(robux)})`;
            usdDisplay.style.color = '#6e6e6e';
            usdDisplay.style.fontSize = '12px';
            usdDisplay.style.marginLeft = '4px';

            span.appendChild(usdDisplay);
            span.dataset.converted = 'true';
        });
    }

    // Initial run
    convertRobuxSpans();

    // Watch for dynamic content changes
    const observer = new MutationObserver(() => {
        convertRobuxSpans();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();