Torn - Disable Booster Tab

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 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 });
})();