Armor Visuals be Gone

Deletes armor images from the player models (Loader and Item Page)

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Armor Visuals be Gone
// @version      1.0
// @description  Deletes armor images from the player models (Loader and Item Page)
// @author       ShadowBirb
// @match        http*://www.torn.com/*
// @namespace https://greasyfork.org/users/1389667
// ==/UserScript==

(function() {
    'use strict';

    // List of image IDs to target
    const targetIDs = [
        32, 34, 49, 50, 176, 178, 332, 333, 334, 348, 538, 640, 641, 647, 650,
        651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664,
        665, 666, 669, 670, 671, 672, 673, 674, 675, 676, 679, 680, 681, 682,
        683, 684, 1307, 1308, 1309, 1310, 1311, 1355, 1356, 1357, 1358, 1359
    ];

    function deleteTargetImages() {
        console.log("Looking for target image containers...");

        let found = false;
        document.querySelectorAll("div.armour___fLnYY img").forEach(img => {
            const src = img.getAttribute("src");
            const match = src ? src.match(/ID=(\d+)/) : null;

            if (match) {
                const imgID = parseInt(match[1], 10);
                console.log(`Detected image with ID: ${imgID} in src attribute`);

                // Check if the ID is in the target list
                if (targetIDs.includes(imgID)) {
                    const parentDiv = img.closest("div.armour___fLnYY");
                    if (parentDiv) {
                        parentDiv.remove();
                        console.log(`Successfully deleted image ID: ${imgID}`);
                        found = true;
                    } else {
                        console.warn(`Failed to find container for image ID: ${imgID}`);
                    }
                } else {
                    console.info(`Image ID: ${imgID} is not in the target list, no action taken`);
                }
            } else {
                console.warn("No valid ID found in src attribute or src attribute missing");
            }
        });

        if (!found) {
            console.warn("No image containers were found. Retrying in 1 second...");
            setTimeout(deleteTargetImages, 1000); // Retry after 1 second if no elements found
        } else {
            console.log("Finished all target images.");
        }
    }

    // Run the function after page load
    window.addEventListener('load', deleteTargetImages);
})();