FM skill colors for TrophyManager

Football manager colors

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         FM skill colors for TrophyManager
// @namespace    http://gitare.info/
// @version      0.2 beta
// @description  Football manager colors
// @author       Gordan S. aka Mansfield
// @match        https://trophymanager.com/players/*
// @grant        none
// ==/UserScript==

// it works on single player page
(function() {
    'use strict';

    function find_color(br){
       switch(br){
           case 1:
           case 2:
           case 3:
           case 4:
           case 5:
               return "#fffdd0"
               break;
           case 6:
           case 7:
           case 8:
               return "#fcf4a3"
               break;
           case 9:
           case 10:
               return "#fcf4a3"
           case 11:
           case 12:
               return "#f7fca3"
               break;
           case 13:
           case 14:
               return "#f8de7e"
               break;
           case 15:
           case 16:
               return "#fcd12a"
               break
           case 17:
           case 18:
               return "yellow"
               break;
           default:
               return ""
       }
    }
    var table = document.getElementsByClassName("skill_table zebra");

    for(var i=0; i<table[0].rows.length;i++){
       var broj= parseInt(table[0].rows[i].firstChild.nextElementSibling.nextSibling.innerText)
        var color = find_color(broj);
       table[0].rows[i].firstChild.nextElementSibling.nextSibling.style.color= color;

        var broj2 = parseInt(table[0].rows[i].firstChild.nextElementSibling.firstChild.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.firstChild.data);
        var color2 = find_color(broj2);
        table[0].rows[i].firstChild.nextElementSibling.firstChild.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.style.color= color2;
       }

})();