[HWM] countMonstersArts

Подсчёт количества наноартов

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

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 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         [HWM] countMonstersArts
// @version      0.10.0
// @description  Подсчёт количества наноартов
// @author       Komdosh
// @match        http*://*.heroeswm.ru/arts_for_monsters.php*
// @grant        none
// @namespace https://greasyfork.org/users/13829
// ==/UserScript==

var headers = Array.from(document.querySelectorAll("td>b, td>a")).slice(0,9);
var count = 0;

for (var header of headers){
   count+=parseInt(header.innerHTML.split('(')[1].split(')')[0]);
}

var center = document.querySelector("center > b");
center.innerHTML+="<br>Количество артефактов существ: "+count;


var lsName = 'KomdoshScript_ArtsForMonsterCount';
if(!localStorage.getItem(lsName)){
    localStorage.setItem(lsName, count);
}

if(localStorage.getItem(lsName) && localStorage.getItem(lsName)<count){
    var all = localStorage.getItem('HWMCMA');
    center.innerHTML+=" <font color='green' weight='bold'>+"+(count-all)+"</font>";
    localStorage.setItem('HWMCMA', count);
}