Bounty Alert

Bounty detection for Torn profiles

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Bounty Alert
// @namespace    http://tampermonkey.net/
// @version      2.6.9
// @description  Bounty detection for Torn profiles
// @author       Pint-Shot-Riot 
// @match        https://www.torn.com/profiles.php?XID=*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    let isDismissed = false;

    function findBounty() {
        if (isDismissed) return;

        const icons = document.querySelectorAll('.profile-icons li, .icons li');
        let bountyElement = null;

        for (const li of icons) {
            const hasLink = li.querySelector('a[href*="bounties.php"]');
            const hasIcon = li.querySelector('i[class*="bounty"], #bounty');
            if (hasLink || hasIcon) {
                bountyElement = li;
                break;
            }
        }

        if (bountyElement) {
            // We still find the element to trigger the banner, but we don't pass the amount anymore
            renderBanner();
        }
    }

    function renderBanner() {
        if (document.getElementById('torn-bounty-alert')) return;

        const target = document.querySelector('.content-wrapper') || document.querySelector('.profile-wrapper');
        
        if (target) {
            const banner = document.createElement('div');
            banner.id = 'torn-bounty-alert';
            banner.style = `
                background: #111; 
                color: #ff3b3b; 
                padding: 15px; 
                text-align: center; 
                font-size: 24px; 
                font-weight: 900; 
                border: 5px solid #ff3b3b; 
                margin: 10px auto; 
                width: 90%;
                border-radius: 8px;
                box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
                font-family: sans-serif;
                z-index: 9999;
                cursor: pointer;
            `;
            // Removed ${amount} and replaced with generic text
            banner.innerHTML = `⚠️ BOUNTY DETECTED ⚠️<br><span style="font-size: 12px; font-weight: normal;">(Click to dismiss)</span>`;
            
            banner.addEventListener('click', () => {
                isDismissed = true;
                banner.remove();
            });

            target.prepend(banner);
            
            const context = new (window.AudioContext || window.webkitAudioContext)();
            const osc = context.createOscillator();
            const gain = context.createGain();
            
            osc.type = 'square';
            osc.frequency.value = 300;
            gain.gain.value = 0.1; 

            osc.connect(gain);
            gain.connect(context.destination);
            
            osc.start();
            osc.stop(context.currentTime + 0.1);
        }
    }

    const timer = setInterval(findBounty, 1000);
    setTimeout(() => clearInterval(timer), 10000);
})();