summaryrefslogtreecommitdiff
path: root/kvmd/web/js/msd.js
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/web/js/msd.js')
-rw-r--r--kvmd/web/js/msd.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/kvmd/web/js/msd.js b/kvmd/web/js/msd.js
new file mode 100644
index 00000000..5ae851ea
--- /dev/null
+++ b/kvmd/web/js/msd.js
@@ -0,0 +1,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;
+ };
+};