blob: 5ae851ea15d223bca8010f9fadef94af5f3ffe23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
var msd = new function() {
this.loadInitialState = function() {
var http = tools.makeRequest("GET", "/kvmd/msd", function() {
if (http.readyState === 4) {
if (http.status === 200) {
msd.setState(JSON.parse(http.responseText).result);
} else {
setTimeout(msd.loadInitialState, 1000);
}
}
});
};
this.setState = function(state) {
if (state.connected_to == "server") {
cls = "led-on";
} else if (state.busy) {
cls = "led-msd-writing";
} else {
cls = "led-off";
}
$("msd-led").className = cls;
};
};
|