Highlight RW Effects

Highlight RW effects in the attack loader

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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
    });
})();