Bazaar Item Search powered by IronNerd

View items you are searching for in bazaars!

当前为 2024-11-30 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Bazaar Item Search powered by IronNerd
// @namespace    [email protected]
// @version      0.3.8
// @description  View items you are searching for in bazaars!
// @author       Nurv [669537]
// @match        https://www.torn.com/page.php?sid=ItemMarket*
// @grant        GM_xmlhttpRequest
// @grant        GM_setValue
// @grant        GM_getValue
// @run-at       document-end
// @license      Copyright IronNerd.me
// @connect      ironnerd.me
// ==/UserScript==

(function () {
    'use strict';

    console.log('IronNerd Bazaar Enhancements script started.');

    init();

    function init() {
        injectAdditionalStyles();
        ensureBazaarEnhancerContainer();
        displayDeprecationMessage();
    }


    function ensureBazaarEnhancerContainer() {
        let container = document.getElementById('bazaar-enhancer-container');
        if (!container) {
            container = document.createElement('div');
            container.id = 'bazaar-enhancer-container';

            const delimiter = document.querySelector('.delimiter___zFh2E');
            if (delimiter && delimiter.parentNode) {
                delimiter.parentNode.insertBefore(container, delimiter.nextSibling);
            } else {
                document.body.appendChild(container);
            }

            console.log('IronNerd Bazaar Enhancements: `bazaar-enhancer-container` created and appended to the DOM.');
        } else {
            console.log('IronNerd Bazaar Enhancements: `bazaar-enhancer-container` already exists.');
        }
    }

    function displayDeprecationMessage() {
        const container = document.getElementById('bazaar-enhancer-container');
        if (!container) return;

        container.innerHTML = `
            <h3 style="text-align: center; color: #333; font-weight: bold; margin-bottom: 10px;">Script is down</h3>
            <p style="text-align: center; color: #444;">Script no longer works due to new Torn implementation.</p>
            <p style="text-align: center; color: #444;">Will update this when possible. Please follow the forum post for more information.</p>
        `;
    }

    function injectAdditionalStyles() {
        const style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = `
            #bazaar-enhancer-container {
                background-color: #ffffff;
                color: #000000;
                border: 1px solid #ddd;
                box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
                border-radius: 8px;
                padding: 10px;
                margin: 10px 0;
                transition: background-color 0.3s, color 0.3s;
            }
            .dark-mode #bazaar-enhancer-container {
                background-color: rgba(0, 0, 0, 0.6);
                color: #f0f0f0;
                border: 1px solid rgba(255, 255, 255, 0.1);
                box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
            }
        `;
        document.head.appendChild(style);
        console.log('IronNerd Bazaar Enhancements: Additional styles injected.');
    }
})();