-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwot_stats_style_functions.js
167 lines (157 loc) · 3.03 KB
/
wot_stats_style_functions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
* Description: Support js-file to the site Say Wot? - Stats, World of Tanks statistics engine (http://saywotstats.net)
* VersionInfo: Using WOT API v1.X
* Author: Johan "DaWoody" Wedfelt
* AuthorUrl: https://github.com/DaWoody
* Feedback/Dev: http://saywotstats.blogspot.se
* License: GNU General Public License, version 3(GPL-3.0) (http://opensource.org/licenses/GPL-3.0)
*
*/
jQuery(document).ready(function(){
$.fn.printColorToStat = function(statName, value){
var result;
switch(statName){
case 'averageWinRate': {
result = setWinRateColor(value);
}
break;
case 'wn7':{
result = setWN7Color(value);
}
break;
case 'wn8': {
result = setWN8Color(value);
}
break;
case 'totalBattlesPlayed':{
result = setBattlesPlayedColor(value);
}
break;
default: {
console.log('This color coding message was reached by the default method');
}
break;
}
return result;
};
//Color the winratio
function setWinRateColor(value){
var color;
//Unicum
if (value>=60) {
color = '#e2c0ff';
}
//Great
else if(value>54&&value<60) {
color = '#a1d7fd';
}
//Good
else if(value>51&&value<=54) {
color = '#68f06b';
}
//Average
else if(value>48&&value<51){
color = '#f8ec87';
}
//Bad
else if(value<48){
color = '#f54747';
}
//Default color
else {
color = 'rgba(249,194,183,0.8)';
}
return color;
}
//Color the WN7 stats
function setWN7Color(value){
var color;
//Unicum
if (value>1700) {
color = '#e2c0ff';
}
//Great
else if(value>=1500&&value<1700) {
color = '#a1d7fd';
}
//Good
else if(value>=1200&&value<1500) {
color = '#68f06b';
}
//Average
else if(value>=900&&value<1200){
color = '#f8ec87';
}
//Bad
else if(value<900){
color = '#f54747';
}
//Default color
else {
color = 'rgba(249,194,183,0.8)';
}
return color;
}
//Color the WN8 stats
function setWN8Color(value){
var color;
//Unicum
if (value>2400) {
color = '#e2c0ff';
}
//Really Great
else if(value>=1900&&value<2399) {
color = '#a1d7fd';
}
//Great
else if(value>=1600&&value<1899) {
color = '#7feee7';
}
//Good
else if(value>=1250&&value<1599) {
color = '#68f06b';
}
//Average
else if(value>=900&&value<1249){
color = '#f8ec87';
}
//Bad
else if(value<900){
color = '#f54747';
}
//Default color
else {
color = 'rgba(249,194,183,0.8)';
}
return color;
}
//Color the total battles played
function setBattlesPlayedColor(value){
var color;
//Unicum
if (value>=20000) {
color = '#e2c0ff';
}
//Great
else if(value>14500&&value<20000) {
color = '#a1d7fd';
}
//Good
else if(value>=9000&&value<14500) {
color = '#68f06b';
}
//Average
else if(value>=1000&&value<9000){
color = '#f8ec87';
}
//Bad
else if(value<1000){
color = '#f54747';
}
//Default color
else {
color = 'rgba(249,194,183,0.8)';
}
return color;
}
});