-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMUScript.js
More file actions
51 lines (45 loc) · 972 Bytes
/
MUScript.js
File metadata and controls
51 lines (45 loc) · 972 Bytes
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
window.fusionJavaScriptHandler =
{
handle: function(action, data)
{
var unit;
var f;
var numdec;
var val;
try
{
if ( document.getElementById("radioGB").checked == true)
{
unit = " GB";
power = 30;
numdec = 2;
}
else if ( document.getElementById("radioMB").checked == true)
{
unit = " MB";
power = 20;
numdec = 0;
}
else
{
unit = " KB";
power = 10;
numdec = 0;
}
f = Math.pow(2,power);
obj = JSON.parse(data)
val = parseInt(obj.min, 10)/f;
document.getElementById('mem_min').innerHTML = val.toFixed(numdec);
val = parseInt(obj.uss, 10)/f;
document.getElementById('mem_cur').innerHTML = val.toFixed(numdec);
val = parseInt(obj.max, 10)/f;
document.getElementById('mem_max').innerHTML = val.toFixed(numdec);
}
catch (e)
{
console.log(e);
console.log('exception caught with command: ' + action + ', data: ' + data);
}
return 'OK';
}
};