Skip to content

Commit

Permalink
Merge pull request #29 from Chia-Network/display-auto
Browse files Browse the repository at this point in the history
Change display if in auto play state
  • Loading branch information
prozacchiwawa authored Sep 10, 2024
2 parents 15d0d8a + 34f1607 commit 8b2c87e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
8 changes: 8 additions & 0 deletions resources/web/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ body {
position: absolute;
width: 20vw;
height: 85vh;

}

.info-auto {
background: #54b166;
}

.info-manual {
background: #bbb;
}

Expand Down
17 changes: 14 additions & 3 deletions resources/web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ function update_ungate_button(json) {
}
}

let last_update = "";

function check() {
return fetch("idle.json", {
"method": "POST"
Expand All @@ -28,10 +30,19 @@ function check() {
});
}).then((json) => {
if (json.info) {
const info = document.getElementById('info');
let this_str = JSON.stringify(json);
setTimeout(check, 500);
if (this_str === last_update) {
return;
} else {
last_update = this_str;
}

info = document.getElementById('info');
clear(info);
auto = json.auto;
auto = json.info.auto;

info.setAttribute("class", json.info.auto ? "info-auto" : "info-manual");
update_ungate_button(json);

let keys = Object.keys(json.info);
Expand All @@ -46,7 +57,7 @@ function check() {
info.appendChild(ul);
}

setTimeout(check, 500);

});
}

Expand Down

0 comments on commit 8b2c87e

Please sign in to comment.