Torn Locked Award Highlighter

Adds a soft red highlight to locked awards on the Torn awards page for easier visibility.

当前为 2025-07-01 提交的版本,查看 最新版本

// ==UserScript==
// @name         Torn Locked Award Highlighter
// @namespace    https://bypxbyp.com
// @version      1.2
// @description  Adds a soft red highlight to locked awards on the Torn awards page for easier visibility.
// @license      MIT
// @author       BypXByp [3243346]
// @match        https://www.torn.com/page.php?sid=awards
// @match        https://www.torn.com/page.php?sid=awards&tab=honors
// @grant        none
// @icon         https://www.google.com/s2/favicons?sz=64&domain=torn.com
// ==/UserScript==

(function() {
    'use strict';

    const highlightColor = 'rgba(255, 100, 100, 0.2)';
    const selector = 'li[class*="locked__"]';
    const debounceDelay = 500;

    let debounceTimeout;

    function highlightLockedAwards() {
        console.log('[Torn Highlighter] Scanning for locked awards...');
        const lockedAwards = document.querySelectorAll(selector);

        lockedAwards.forEach(liElement => {
            if (liElement.style.backgroundColor !== highlightColor) {
                liElement.style.backgroundColor = highlightColor;
            }
        });

        console.log(`[Torn Highlighter] Found and ensured ${lockedAwards.length} locked awards are highlighted.`);
    }

    function handlePageInteraction() {
        clearTimeout(debounceTimeout);
        debounceTimeout = setTimeout(highlightLockedAwards, debounceDelay);
    }

    setTimeout(highlightLockedAwards, 500);

    document.body.addEventListener('click', handlePageInteraction, true);

    console.log('[Torn Highlighter] Script loaded. Will re-scan for locked awards on click.');

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址