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).

目前為 2018-07-30 提交的版本,檢視 最新版本

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