Torn Dog Tag Count

Highlight previously stolen tags

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Torn Dog Tag Count
// @namespace    blank
// @description  Highlight previously stolen tags
// @version      0.4.1
// @match        *.torn.com/competition.php
// @grant        none
// ==/UserScript==

function checkTagCount(){
    if(document.getElementsByClassName('dog-tag-list')[0]){
        var tagCount = parseInt(document.getElementsByClassName('dog-tag-list')[0].getAttribute('data-from'));
        const tagInfo = document.getElementsByClassName('dog-tag-cont');
        for(var i=0; i < tagInfo.length; i++){
            if(tagInfo[i].getElementsByClassName('tooltip')){
                if(tagInfo[i].getElementsByClassName('user')[0].children.length > 2){
                    tagInfo[i].style.backgroundColor = "#d7e1cc";
                }
            }
        }
    }
}

const observer = new MutationObserver((mutations) => {
    for (const mutation of mutations) {
        for (const node of mutation.addedNodes) {
            checkTagCount();
        }
    }
});
const wrapper = document.querySelector('#mainContainer .content-wrapper');
observer.observe(wrapper, { subtree: true, childList: true });