Highlight RW Effects

Highlight RW effects in the attack loader

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Highlight RW Effects
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Highlight RW effects in the attack loader
// @author       Weav3r
// @match        https://www.torn.com/loader.php?sid=attack*
// ==/UserScript==

(function() {
    'use strict';

    const specifiedClasses = [
        'attacking-events-dune',
        'attacking-events-critical-hit',
        'attacking-events-standart-damage',
        'attacking-events-mug',
        'attacking-events-attack-win',
        'attacking-events-miss',
        'attacking-events-leave',
        'attacking-events-attack-join',
        'attacking-events-booster-use',
        'attacking-events-ziro-damage',
        'attacking-events-grenade-use',
        'attacking-events-reloading',
        'attacking-events-attack-lose',
        'attacking-events-riot',
        'attacking-events-quicken',
        "attacking-events-assault"
    ];

    function highlightNonMatchingEvents() {

        const messages = document.querySelectorAll('.message___Z4JCk');

        messages.forEach(message => {
            const parent = message.closest('.col1____LGQW');
            if (parent) {
                const iconWrap = parent.querySelector('.iconWrap___aIfWj span');
                if (iconWrap) {
                    const classes = iconWrap.classList;
                    const matches = specifiedClasses.some(specifiedClass => classes.contains(specifiedClass));
                    if (!matches) {
                        parent.style.backgroundColor = 'rgba(255, 255, 204, 0.3)';
                    }
                }
            }
        });
    }

    highlightNonMatchingEvents();

    const observer = new MutationObserver(() => {
        highlightNonMatchingEvents();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();