Sets price indicator

Telling you if the price of the sets is between the lower price (var minprice) and your maximum price (var maxprice) by coloring the gems price (Green is ok, red isn't).

Verzia zo dňa 30.07.2018. Pozri najnovšiu verziu.

// ==UserScript==
// @name         Sets price indicator
// @version      0.2
// @description  Telling you if the price of the sets is between the lower price (var minprice) and your maximum price (var maxprice) by coloring the gems price (Green is ok, red isn't).
// @author       Zeper
// @match        https://steamlvlup.com/levelup*
// @grant        none
// @namespace https://greasyfork.org/users/191481
// ==/UserScript==

var sets = document.getElementById('calc_sets');
var gems = document.getElementById("calc_gems");
var minprice = 230;
var maxprice = 240;

function check() {
    var setsvalue = sets.innerHTML;
    var setsprice = Math.round(gems.innerHTML/setsvalue);
    if (setsprice > 0)
    {
        if (setsprice >= minprice && setsprice <= maxprice)
        {
            gems.style = "color: green;";
        }
        else
        {
            gems.style = "color: red;";
        }
        gems.title = setsprice + " gems per Sets" ;
    }
}

new MutationObserver(check).observe(sets, { attributes: false, childList: true, subtree: false });