Torn - Disable Booster Tab

Makes the Booster tab appear and behave as disabled on the item page.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Torn - Disable Booster Tab
// @namespace    gin4
// @version      1.1
// @description  Makes the Booster tab appear and behave as disabled on the item page.
// @match        https://www.torn.com/item.php*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const disableBoosterTab = (tab) => {
        if (!tab || tab.classList.contains('ui-state-disabled')) return;

        // Add Torn's disabled classes
        tab.classList.add('ui-state-disabled', 'no-items');
        tab.setAttribute('aria-disabled', 'true');
        tab.setAttribute('aria-selected', 'false');
        tab.setAttribute('tabindex', '-1');

        // Remove active/selected state if present
        tab.classList.remove('ui-tabs-active', 'ui-state-active');
        tab.removeAttribute('aria-controls');

        // Disable its link
        const link = tab.querySelector('a');
        if (link) {
            link.removeAttribute('href');
            link.removeAttribute('tabindex');
            link.style.pointerEvents = 'none';
            link.title = 'Disabled';
        }
    };

    // Observe the DOM since Torn loads tabs dynamically
    const observer = new MutationObserver(() => {
        const boosterTab = document.querySelector('li#categoriesItem[data-type="Booster"]');
        if (boosterTab) {
            disableBoosterTab(boosterTab);
            observer.disconnect();
        }
    });

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