forked from lovmoon3k/useful-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runStatJs.js
33 lines (32 loc) · 937 Bytes
/
runStatJs.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
export default {
name: {
en: "Run Stat.js",
vi: "Chạy stats.js",
},
description: {
en: "Run stat.js in current website",
vi: "Tính toán FPS website",
},
func: function () {
let src = "//mrdoob.github.io/stats.js/build/stats.min.js";
var script = document.createElement("script");
script.onload = function () {
var stats = new Stats();
document.body.appendChild(stats.dom);
requestAnimationFrame(function loop() {
stats.update();
requestAnimationFrame(loop);
});
};
script.onerror = (event) => {
alert(
'Looks like the Content Security Policy directive is blocking the use of script\n\nYou can copy and paste the content of:\n\n"' +
src +
'"\n\ninto your console instead\n\n(link is in console already)'
);
console.log(src);
};
script.src = src;
document.head.appendChild(script);
},
};