forked from jamesrom/jamesrom.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.js
51 lines (45 loc) · 1.05 KB
/
stats.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
var Stats = (function() {
var self = {};
self.clicks = 0;
self.resets = 0;
self.total_reds = 0;
self.red_percentage = "(0.000%)";
self.total_oranges = 0;
self.orange_percentage = "(0.000%)";
self.total_yellows = 0;
self.yellow_percentage = "(0.000%)";
self.total_greens = 0;
self.green_percentage = "(0.000%)";
self.total_blues = 0;
self.blue_percentage = "(0.000%)";
self.total_purples = 0;
self.purple_percentage = "(0.000%)";
self.sum_of_times = 0;
self.lowest_time = 60;
self.sum_of_times = 0;
self.average_time = 0;
self.resets_per_minute = 0;
self.render = function() {
_(self)
.keys()
.filter(function(key) {
return key != "render" && key != "resize";
})
.each(function(key, i) {
$('#stats .' + key).text(self[key]);
})
.value();
self.resize();
Timer.resize();
}
self.resize = function() {
if ($(window).width() < 400) {
$('#stats').addClass('small');
}
$('#stats')
.removeClass('small')
.css('left', ($('#chart').offset().left))
.css('top', Chart.margins.top - 4);
}
return self;
}());