name:
js/vendor/stats.min.js
-rw-r--r--
2870
1// stats.js - http://github.com/mrdoob/stats.js
2var Stats = function() {
3 var l = Date.now(),
4 m = l,
5 g = 0,
6 n = Infinity,
7 o = 0,
8 h = 0,
9 p = Infinity,
10 q = 0,
11 r = 0,
12 s = 0,
13 f = document.createElement("div");
14 f.id = "stats";
15 f.addEventListener("mousedown", function(b) {
16 b.preventDefault();
17 t(++s % 2)
18 }, !1);
19 f.style.cssText = "width:80px;opacity:0.9;cursor:pointer";
20 var a = document.createElement("div");
21 a.id = "fps";
22 a.style.cssText = "padding:0 0 3px 3px;text-align:left;background-color:#fff";
23 f.appendChild(a);
24 var i = document.createElement("div");
25 i.id = "fpsText";
26 i.style.cssText = "color:#333;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px";
27 i.innerHTML = "FPS";
28 a.appendChild(i);
29 var c = document.createElement("div");
30 c.id = "fpsGraph";
31 c.style.cssText = "position:relative;width:74px;height:30px;background-color:#333";
32 for (a.appendChild(c); 74 > c.children.length;) {
33 var j = document.createElement("span");
34 j.style.cssText = "width:1px;height:30px;float:left;background-color:#fff";
35 c.appendChild(j)
36 }
37 var d = document.createElement("div");
38 d.id = "ms";
39 d.style.cssText = "padding:0 0 3px 3px;text-align:left;background-color:#333;display:none";
40 f.appendChild(d);
41 var k = document.createElement("div");
42 k.id = "msText";
43 k.style.cssText = "color:#333;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px";
44 k.innerHTML = "MS";
45 d.appendChild(k);
46 var e = document.createElement("div");
47 e.id = "msGraph";
48 e.style.cssText = "position:relative;width:74px;height:30px;background-color:#333";
49 for (d.appendChild(e); 74 > e.children.length;) j = document.createElement("span"), j.style.cssText = "width:1px;height:30px;float:left;background-color:#131", e.appendChild(j);
50 var t = function(b) {
51 s = b;
52 switch (s) {
53 case 0:
54 a.style.display =
55 "block";
56 d.style.display = "none";
57 break;
58 case 1:
59 a.style.display = "none", d.style.display = "block"
60 }
61 };
62 return {
63 REVISION: 11,
64 domElement: f,
65 setMode: t,
66 begin: function() {
67 l = Date.now()
68 },
69 end: function() {
70 var b = Date.now();
71 g = b - l;
72 n = Math.min(n, g);
73 o = Math.max(o, g);
74 k.textContent = g + " MS (" + n + "-" + o + ")";
75 var a = Math.min(30, 30 - 30 * (g / 200));
76 e.appendChild(e.firstChild).style.height = a + "px";
77 r++;
78 b > m + 1E3 && (h = Math.round(1E3 * r / (b - m)), p = Math.min(p, h), q = Math.max(q, h), i.textContent = h + " FPS (" + p + "-" + q + ")", a = Math.min(30, 30 - 30 * (h / 100)), c.appendChild(c.firstChild).style.height =
79 a + "px", m = b, r = 0);
80 return b
81 },
82 update: function() {
83 l = this.end()
84 }
85 }
86};