-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds configuration for the displayed texts and colors.
- Loading branch information
Showing
3 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
const myInterval = setInterval(myTimer, 2000); | ||
var config = null; | ||
|
||
function myTimer() { | ||
/** | ||
* Load configuration and initialize timer | ||
*/ | ||
fetch('/config') | ||
.then(response => response.json()) | ||
.then(cfg => { | ||
config = cfg; | ||
console.info('config', config) | ||
setInterval(updateTimer, 2000); | ||
}) | ||
|
||
/** | ||
* Check for capture agent status | ||
*/ | ||
function updateTimer() { | ||
fetch('/status') | ||
.then(response => response.json()) | ||
.then(capturing => { | ||
console.info(capturing) | ||
document.getElementById('text').innerText = capturing ? 'Aufzeichnung läuft' : 'Keine Aufzeichnung'; | ||
console.debug('capturing', capturing) | ||
const active = capturing ? config.capturing : config.idle; | ||
document.getElementById('text').innerText = active.text; | ||
const body = document.getElementsByTagName('body')[0]; | ||
if (capturing) { | ||
body.style.backgroundColor = '#ac0634'; | ||
body.style.color = '#fff'; | ||
} else { | ||
body.style.backgroundColor = '#fff'; | ||
body.style.color = '#000'; | ||
} | ||
body.style.backgroundColor = active.background; | ||
body.style.color = active.color; | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters