Bazaar Link Redirect and Rename

Redirect the "Bazaar" link to the "Item Market" page when clicked and rename the button to "Item Market"

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Bazaar Link Redirect and Rename
// @namespace   Violentmonkey Scripts
// @match       https://www.torn.com/item.php
// @grant       none
// @version     1.0
// @author      -
// @license     MIT
// @description Redirect the "Bazaar" link to the "Item Market" page when clicked and rename the button to "Item Market"
// ==/UserScript==

(function() {
    // Wait until the page is fully loaded
    window.addEventListener('load', function() {
        // Select the "Bazaar" link element by its id or class
        const bazaarLink = document.querySelector('a[aria-labelledby="bazaar"]');
        
        // Rename the button text from "Bazaar" to "Item Market"
        if (bazaarLink) {
            const spanText = bazaarLink.querySelector('#bazaar');
            if (spanText) {
                spanText.textContent = 'Item Market';
            }

            // Add an event listener for the click event
            bazaarLink.addEventListener('click', function(event) {
                // Prevent the default action of the click (which would normally navigate to "bazaar.php")
                event.preventDefault();

                // Redirect to the Item Market page
                window.location.href = '/page.php?sid=ItemMarket';
            });
        }
    });
})();