From 3d8bb101001178adc16d845b170229282688f9ef Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 11:17:27 -0600
Subject: [PATCH 26/61] Update clock-config.css
size_color align
---
views/clockviews/clock-config.css | 2 ++
1 file changed, 2 insertions(+)
diff --git a/views/clockviews/clock-config.css b/views/clockviews/clock-config.css
index d423b5cc2eb..ffa91612fda 100644
--- a/views/clockviews/clock-config.css
+++ b/views/clockviews/clock-config.css
@@ -31,7 +31,9 @@ select {
width: 100%;
}
.size_color {
+ align-items: center;
display: flex;
+ justify-content: space-evenly;
}
#facename {
From 2711a5b23eb2f732222048806f64f337a8633468 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 11:26:16 -0600
Subject: [PATCH 27/61] Update clock-config.css
trying divs again
---
views/clockviews/clock-config.css | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/views/clockviews/clock-config.css b/views/clockviews/clock-config.css
index ffa91612fda..06e22c33013 100644
--- a/views/clockviews/clock-config.css
+++ b/views/clockviews/clock-config.css
@@ -10,15 +10,15 @@
padding: 1%;
font-size: 10px;
}
-#config-form div {
+#config-form > div {
margin: 0px;
padding: 10px 5px;
text-align: left;
}
-#config-form p:nth-child(even){
+#config-form > div:nth-child(even){
background-color: rgba(200,200,200,0.5);
}
-#config-form p:nth-child(odd){
+#config-form > div:nth-child(odd){
background-color: rgba(220,220,220,0.5);
}
input.elmt {
From 2528db42913c4e5ee2518c77ba6b192ecac2e9de Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 11:26:38 -0600
Subject: [PATCH 28/61] Update clock-config.html
trying divs again
---
views/clockviews/clock-config.html | 39 +++++++++++++++---------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/views/clockviews/clock-config.html b/views/clockviews/clock-config.html
index 4da29f941c3..6d5aa0c1750 100644
--- a/views/clockviews/clock-config.html
+++ b/views/clockviews/clock-config.html
@@ -1,62 +1,63 @@
From e081072c63b972d43c062a690dac33d607c1da50 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 11:49:19 -0600
Subject: [PATCH 31/61] Update clock-config.css
button margin
---
views/clockviews/clock-config.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/views/clockviews/clock-config.css b/views/clockviews/clock-config.css
index 4063bcb4576..2d2d30c1301 100644
--- a/views/clockviews/clock-config.css
+++ b/views/clockviews/clock-config.css
@@ -12,7 +12,7 @@
}
#config-form form > div {
margin: 0px;
- padding: 10px 5px;
+ padding: 7px 5px;
text-align: left;
}
#config-form form > div:nth-child(even){
@@ -34,7 +34,7 @@ select {
align-items: center;
display: flex;
justify-content: space-evenly;
-
+ margin-top: 3px;
}
#facename {
font-size: 7px;
From 7334dbed7ee1bac29110ed09f98016cd649c7ea7 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 11:54:16 -0600
Subject: [PATCH 32/61] Update clock-config.css
#facename bg/align
---
views/clockviews/clock-config.css | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/views/clockviews/clock-config.css b/views/clockviews/clock-config.css
index 2d2d30c1301..cfd1714adf1 100644
--- a/views/clockviews/clock-config.css
+++ b/views/clockviews/clock-config.css
@@ -15,7 +15,7 @@
padding: 7px 5px;
text-align: left;
}
-#config-form form > div:nth-child(even){
+#config-form form > div:nth-child(even):not(#facename) {
background-color: rgba(200,200,200,0.5);
}
#config-form form > div:nth-child(odd){
@@ -38,6 +38,7 @@ select {
}
#facename {
font-size: 7px;
+ text-align: center !important;
}
#clocklink {
font-size: 18px;
From 4c79856dc956967e163a0ff79d5c1f85416867da Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 12:10:13 -0600
Subject: [PATCH 33/61] Update clock-config.css
button width
---
views/clockviews/clock-config.css | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/views/clockviews/clock-config.css b/views/clockviews/clock-config.css
index cfd1714adf1..6ab1f9c0ab5 100644
--- a/views/clockviews/clock-config.css
+++ b/views/clockviews/clock-config.css
@@ -21,8 +21,10 @@
#config-form form > div:nth-child(odd){
background-color: rgba(220,220,220,0.5);
}
-input.elmt {
- width: 120px;
+input.elmt,
+input.undo {
+ margin: 0px 5px;
+ width: calc(100% - 10px);
}
input.size {
max-width: 50%;
From b18d9177649deb556bb2040591ed0a2f5c997f9b Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 12:15:00 -0600
Subject: [PATCH 34/61] Update clock-config.css
.size_color {margin-bottom}
---
views/clockviews/clock-config.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/views/clockviews/clock-config.css b/views/clockviews/clock-config.css
index 6ab1f9c0ab5..c8ac8fbb869 100644
--- a/views/clockviews/clock-config.css
+++ b/views/clockviews/clock-config.css
@@ -36,7 +36,7 @@ select {
align-items: center;
display: flex;
justify-content: space-evenly;
- margin-top: 3px;
+ margin-bottom: 3px;
}
#facename {
font-size: 7px;
From a23ced595e6057b6d904667d4026ca939cf6d0b6 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 13:48:17 -0600
Subject: [PATCH 35/61] Update clock-shared.css
text-stroke
---
views/clockviews/clock-shared.css | 77 ++++++++++++++++---------------
1 file changed, 39 insertions(+), 38 deletions(-)
diff --git a/views/clockviews/clock-shared.css b/views/clockviews/clock-shared.css
index fc624a52c00..cf3329ab79c 100644
--- a/views/clockviews/clock-shared.css
+++ b/views/clockviews/clock-shared.css
@@ -1,69 +1,70 @@
body {
- text-align: center;
- margin: 0 0;
- padding: 0;
- overflow: hidden;
- font-family: 'Open Sans', Arial, Helvetica, sans-serif;
- color: grey;
- background-color: black;
+ text-align: center;
+ margin: 0 0;
+ padding: 0;
+ overflow: hidden;
+ font-family: 'Open Sans', Arial, Helvetica, sans-serif;
+ color: grey;
+ background-color: black;
}
main {
- height: 100vh;
+ height: 100vh;
}
#inner {
- display: -webkit-box;
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
- align-items: center;
- justify-content: center;
- align-content: center;
- flex-flow: wrap;
- height: 100%;
- width: 100%;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: -webkit-flex;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ align-content: center;
+ flex-flow: wrap;
+ height: 100%;
+ width: 100%;
+ -webkit-text-stroke: 3px black;
}
#inner div {
- margin-right: 2vmin;
- margin-left: 2vmin;
- line-height: 1em;
+ margin-right: 2vmin;
+ margin-left: 2vmin;
+ line-height: 1em;
}
#inner div img {
- height: 100%;
+ height: 100%;
}
#inner div.nl {
- width: 100%;
- margin: 0;
- height: 3vmin;
+ width: 100%;
+ margin: 0;
+ height: 3vmin;
}
#errorMessage {
- font-size: 25em;
+ font-size: 25em;
}
.stale {
- text-decoration: line-through;
+ text-decoration: line-through;
}
.close {
- color: white;
- font: 4em 'Open Sans';
- position: absolute;
- top: 0;
- right: 20px;
- text-decoration: none;
- z-index: 10;
+ color: white;
+ font: 4em 'Open Sans';
+ position: absolute;
+ top: 0;
+ right: 20px;
+ text-decoration: none;
+ z-index: 10;
}
.close:after {
- content: '\00D7';
+ content: '\00D7';
}
.hidden {
- opacity: 0;
- transition: opacity 0.5s linear;
-}
\ No newline at end of file
+ opacity: 0;
+ transition: opacity 0.5s linear;
+}
From 95e9c6c9321425dbf5b902c5b920cd7b52d1a355 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 14:00:53 -0600
Subject: [PATCH 36/61] Update clock-client.js
watch color check boxes
---
lib/client/clock-client.js | 95 ++++++++++++++++++++++++++++++--------
1 file changed, 77 insertions(+), 18 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 00aaacfb819..17bd0c15a13 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -88,6 +88,17 @@ client.render = function render () {
let clockCreated = ($inner.children().length > 0);
+ // These are the particular shades of red, yellow, green, and blue.
+ let red = 'rgba(213,9,21,1)';
+ let arrowRed = '#D50915';
+ let yellow = 'rgba(234,168,0,1)';
+ let arrowYellow = '#EAA800';
+ let green = 'rgba(134,207,70,1)';
+ let arrowGreen = '#86CF46';
+ let blue = 'rgba(78,143,207,1)';
+ let arrowBlue = '#4E8FCF';
+
+
for (let param in faceParams) {
if (param === '0') {
/* eslint-disable-next-line security/detect-object-injection */ // verified false positive
@@ -98,7 +109,24 @@ client.render = function render () {
} else if (!clockCreated) {
/* eslint-disable-next-line security/detect-object-injection */ // verified false positive
let faceParam = faceParams[param];
- let div = '
0) ? ' style="' + ((faceParam.substr(0, 2) === 'ar') ? 'height' : 'font-size') + ':' + faceParam.substr(2, 2) + 'vmin"' : '') + '>
';
+
+ let classParam = faceParam.substr(0, 2);
+ let colorParam = (classParam.charAt(0) == classParam.charAt(0).toUpperCase());
+ classParam = classParam.toLowerCase();
+ let sizeParam = '';
+ if (faceParam.substr(2, 2) - 0 > 0) {
+ sizeParam = faceParam.substr(2, 2);
+ }
+ let paramStyle = '';
+ if (sizeParam) {
+ if (classParam === 'ar') {
+ paramStyle = (paramStyle + 'height: ' + sizeParam + 'vmin;');
+ } else {
+ paramStyle = (paramStyle + 'font-size: ' + sizeParam + 'vmin;');
+ }
+ }
+
+ let div = '
';
$inner.append(div);
}
}
@@ -108,22 +136,16 @@ client.render = function render () {
// Insert the delta value text.
$('.dt').html(deltaDisplayValue);
- // Color background
- if (bgColor) {
+ // Threshold values
+ let bgHigh = client.settings.thresholds.bgHigh;
+ let bgLow = client.settings.thresholds.bgLow;
+ let bgTargetBottom = client.settings.thresholds.bgTargetBottom;
+ let bgTargetTop = client.settings.thresholds.bgTargetTop;
- // These are the particular shades of red, yellow, green, and blue.
- let red = 'rgba(213,9,21,1)';
- let yellow = 'rgba(234,168,0,1)';
- let green = 'rgba(134,207,70,1)';
- let blue = 'rgba(78,143,207,1)';
+ let bgNum = parseFloat(rec.mgdl);
- // Threshold values
- let bgHigh = client.settings.thresholds.bgHigh;
- let bgLow = client.settings.thresholds.bgLow;
- let bgTargetBottom = client.settings.thresholds.bgTargetBottom;
- let bgTargetTop = client.settings.thresholds.bgTargetTop;
-
- let bgNum = parseFloat(rec.mgdl);
+ // Color background
+ if (bgColor) {
// Threshold background coloring.
if (bgNum < bgLow) {
@@ -145,6 +167,29 @@ client.render = function render () {
} else {
$('body').css('background-color', 'black');
}
+
+ //Text color
+ let arrowColor = '#FFFFFF';
+ if (bgNum < bgLow) {
+ $('.color').css('color', red);
+ arrowColor = arrowRed;
+ }
+ if ((bgLow <= bgNum) && (bgNum < bgTargetBottom)) {
+ $('.color').css('color', blue);
+ arrowColor = arrowBlue;
+ }
+ if ((bgTargetBottom <= bgNum) && (bgNum < bgTargetTop)) {
+ $('.color').css('color', green);
+ arrowColor = arrowGreen;
+ }
+ if ((bgTargetTop <= bgNum) && (bgNum < bgHigh)) {
+ $('.color').css('color', yellow);
+ arrowColor = arrowYellow;
+ }
+ if (bgNum >= bgHigh) {
+ $('.color').css('color', red);
+ arrowColor = arrowRed;
+ }
// Time before data considered stale.
let threshold = 1000 * 60 * staleMinutes;
@@ -172,15 +217,29 @@ client.render = function render () {
}
// Insert the trend arrow.
- let arrow = $('
![arrow]()
').attr('src', '/images/' + (!rec.direction || rec.direction === 'NOT COMPUTABLE' ? 'NONE' : rec.direction) + '.svg');
+ let trendArrow = {
+ 'NONE': '
',
+ 'Flat': '
',
+ 'FortyFiveDown': '
',
+ 'FortyFiveUp': '
',
+ 'SingleDown': '
',
+ 'SingleUp': '
',
+ 'DoubleDown': '
',
+ 'DoubleUp': '
',
+ 'TripleDown': '
',
+ 'TripleUp': '
'
+ };
+ let arrow = $(trendArrow[(!rec.direction || rec.direction === 'NOT COMPUTABLE' ? 'NONE' : rec.direction)]);
+ $('.ar').html(arrow);
+
// Restyle body bg
if (thresholdReached) {
$('body').css('background-color', 'grey').css('color', 'black');
- $('.ar').css('filter', 'brightness(0%)').html(arrow);
+ $('.ar').css('filter', 'brightness(0%)');
} else {
$('body').css('color', bgColor ? 'white' : 'grey');
- $('.ar').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)').html(arrow);
+ $('.ar').not('.color').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)');
}
updateClock();
From d02027827e9ec7da0b56edd59f8ba177e350e2ea Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 14:04:11 -0600
Subject: [PATCH 37/61] Update clock-config.html
input.elmt.click
---
views/clockviews/clock-config.html | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/views/clockviews/clock-config.html b/views/clockviews/clock-config.html
index f3e4540c42e..dd7510a994b 100644
--- a/views/clockviews/clock-config.html
+++ b/views/clockviews/clock-config.html
@@ -65,7 +65,12 @@
Clock view configurator
$( function() {
$( "input.elmt" ).click( function() {
let size = $("input#" + this.id + "_size").val();
- let append = '-' + this.name + (size ? size : '');
+ let color = $("input#" + this.id + "_color").prop('checked') || false;
+ let name = this.name;
+ if (color) {
+ name = (name.charAt(0).toUpperCase() + name.slice(1))
+ }
+ let append = '-' + name + (size ? size : '');
let $facename = $( "#facename" );
$facename.text($facename.text() + append);
$facename.change();
From 7bb58ec4d1b13d5372bf7b983406153a5efe7271 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 14:16:38 -0600
Subject: [PATCH 38/61] Update clock-client.js
arrow stroke
---
lib/client/clock-client.js | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 17bd0c15a13..b7d78f2d026 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -218,16 +218,16 @@ client.render = function render () {
// Insert the trend arrow.
let trendArrow = {
- 'NONE': '
',
- 'Flat': '
',
- 'FortyFiveDown': '
',
- 'FortyFiveUp': '
',
- 'SingleDown': '
',
- 'SingleUp': '
',
- 'DoubleDown': '
',
- 'DoubleUp': '
',
- 'TripleDown': '
',
- 'TripleUp': '
'
+ 'NONE': '
',
+ 'Flat': '
',
+ 'FortyFiveDown': '
',
+ 'FortyFiveUp': '
',
+ 'SingleDown': '
',
+ 'SingleUp': '
',
+ 'DoubleDown': '
',
+ 'DoubleUp': '
',
+ 'TripleDown': '
',
+ 'TripleUp': '
'
};
let arrow = $(trendArrow[(!rec.direction || rec.direction === 'NOT COMPUTABLE' ? 'NONE' : rec.direction)]);
$('.ar').html(arrow);
From 2fb057b61932dc1e09ea002eb360bf23e32fd6d9 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 14:32:05 -0600
Subject: [PATCH 39/61] Update clock-client.js
arrow width/color
---
lib/client/clock-client.js | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index b7d78f2d026..2edadfc3d6d 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -120,7 +120,7 @@ client.render = function render () {
let paramStyle = '';
if (sizeParam) {
if (classParam === 'ar') {
- paramStyle = (paramStyle + 'height: ' + sizeParam + 'vmin;');
+ paramStyle = (paramStyle + 'height: ' + sizeParam + 'vmin;' + 'width: ' + sizeParam + 'vmin;');
} else {
paramStyle = (paramStyle + 'font-size: ' + sizeParam + 'vmin;');
}
@@ -172,23 +172,33 @@ client.render = function render () {
let arrowColor = '#FFFFFF';
if (bgNum < bgLow) {
$('.color').css('color', red);
- arrowColor = arrowRed;
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowRed;
+ }
}
if ((bgLow <= bgNum) && (bgNum < bgTargetBottom)) {
$('.color').css('color', blue);
- arrowColor = arrowBlue;
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowBlue;
+ }
}
if ((bgTargetBottom <= bgNum) && (bgNum < bgTargetTop)) {
$('.color').css('color', green);
- arrowColor = arrowGreen;
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowGreen;
+ }
}
if ((bgTargetTop <= bgNum) && (bgNum < bgHigh)) {
$('.color').css('color', yellow);
- arrowColor = arrowYellow;
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowYellow;
+ }
}
if (bgNum >= bgHigh) {
$('.color').css('color', red);
- arrowColor = arrowRed;
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowRed;
+ }
}
// Time before data considered stale.
From 2a576d3b97d1b96be4f70f25f29fb69c0aeb83f1 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 14:48:12 -0600
Subject: [PATCH 40/61] Update clock-client.js
reduce arrow stroke width to 1
---
lib/client/clock-client.js | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 2edadfc3d6d..70e49bdebf3 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -120,7 +120,7 @@ client.render = function render () {
let paramStyle = '';
if (sizeParam) {
if (classParam === 'ar') {
- paramStyle = (paramStyle + 'height: ' + sizeParam + 'vmin;' + 'width: ' + sizeParam + 'vmin;');
+ paramStyle = (paramStyle + 'width: ' + sizeParam + 'vmin;');
} else {
paramStyle = (paramStyle + 'font-size: ' + sizeParam + 'vmin;');
}
@@ -228,16 +228,16 @@ client.render = function render () {
// Insert the trend arrow.
let trendArrow = {
- 'NONE': '
',
- 'Flat': '
',
- 'FortyFiveDown': '
',
- 'FortyFiveUp': '
',
- 'SingleDown': '
',
- 'SingleUp': '
',
- 'DoubleDown': '
',
- 'DoubleUp': '
',
- 'TripleDown': '
',
- 'TripleUp': '
'
+ 'NONE': '
',
+ 'Flat': '
',
+ 'FortyFiveDown': '
',
+ 'FortyFiveUp': '
',
+ 'SingleDown': '
',
+ 'SingleUp': '
',
+ 'DoubleDown': '
',
+ 'DoubleUp': '
',
+ 'TripleDown': '
',
+ 'TripleUp': '
'
};
let arrow = $(trendArrow[(!rec.direction || rec.direction === 'NOT COMPUTABLE' ? 'NONE' : rec.direction)]);
$('.ar').html(arrow);
From 2dcb36498d97e639efd911c9d1665d7784af0c74 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 14:49:39 -0600
Subject: [PATCH 41/61] Update clock-shared.css
change from text stroke to text shadow
---
views/clockviews/clock-shared.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/views/clockviews/clock-shared.css b/views/clockviews/clock-shared.css
index cf3329ab79c..400f9347369 100644
--- a/views/clockviews/clock-shared.css
+++ b/views/clockviews/clock-shared.css
@@ -23,7 +23,7 @@ main {
flex-flow: wrap;
height: 100%;
width: 100%;
- -webkit-text-stroke: 3px black;
+ text-shadow: 1px 1px 0px #000000,-1px 1px 0px #000000,-1px -1px 0px #000000,1px -1px 0px #000000;
}
#inner div {
From 234eec0e61d66c00ccf7d21253818590dedef0b8 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 15:02:02 -0600
Subject: [PATCH 42/61] Update clock-client.js
arrow stroke width to 3
---
lib/client/clock-client.js | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 70e49bdebf3..3b656fbb631 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -228,16 +228,16 @@ client.render = function render () {
// Insert the trend arrow.
let trendArrow = {
- 'NONE': '
',
- 'Flat': '
',
- 'FortyFiveDown': '
',
- 'FortyFiveUp': '
',
- 'SingleDown': '
',
- 'SingleUp': '
',
- 'DoubleDown': '
',
- 'DoubleUp': '
',
- 'TripleDown': '
',
- 'TripleUp': '
'
+ 'NONE': '
',
+ 'Flat': '
',
+ 'FortyFiveDown': '
',
+ 'FortyFiveUp': '
',
+ 'SingleDown': '
',
+ 'SingleUp': '
',
+ 'DoubleDown': '
',
+ 'DoubleUp': '
',
+ 'TripleDown': '
',
+ 'TripleUp': '
'
};
let arrow = $(trendArrow[(!rec.direction || rec.direction === 'NOT COMPUTABLE' ? 'NONE' : rec.direction)]);
$('.ar').html(arrow);
From 0fbf57caddf7e65eebbe8da884a438ba3eee0c90 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 15:11:57 -0600
Subject: [PATCH 43/61] Update clock-client.js
// classParam = classParam.toLowerCase();
---
lib/client/clock-client.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 3b656fbb631..73bee68c1a1 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -112,7 +112,7 @@ client.render = function render () {
let classParam = faceParam.substr(0, 2);
let colorParam = (classParam.charAt(0) == classParam.charAt(0).toUpperCase());
- classParam = classParam.toLowerCase();
+ // classParam = classParam.toLowerCase();
let sizeParam = '';
if (faceParam.substr(2, 2) - 0 > 0) {
sizeParam = faceParam.substr(2, 2);
From 88091e555e749e516e9d29bc9ff437ffed038282 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 15:22:59 -0600
Subject: [PATCH 44/61] Update clock-client.js
classParam = classParam.toLowerCase();
---
lib/client/clock-client.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 73bee68c1a1..3b656fbb631 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -112,7 +112,7 @@ client.render = function render () {
let classParam = faceParam.substr(0, 2);
let colorParam = (classParam.charAt(0) == classParam.charAt(0).toUpperCase());
- // classParam = classParam.toLowerCase();
+ classParam = classParam.toLowerCase();
let sizeParam = '';
if (faceParam.substr(2, 2) - 0 > 0) {
sizeParam = faceParam.substr(2, 2);
From 8e9d9a831d3fc82cf7ba58f7c0ed4826cbfed0f4 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 15:28:58 -0600
Subject: [PATCH 45/61] Update clock-client.js
face = $inner.data('face');
---
lib/client/clock-client.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 3b656fbb631..7ca74e267d9 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -79,6 +79,8 @@ client.render = function render () {
} else if (face === 'config') {
face = $inner.attr('data-face-config');
$inner.empty();
+ } else {
+ face = $inner.data('face');
}
let faceParams = face.split('-');
From 1429edbac3919247855defdb767ce993e23df74b Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 15:58:28 -0600
Subject: [PATCH 46/61] Update clock-config.css
alt cofig row colors
---
views/clockviews/clock-config.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/views/clockviews/clock-config.css b/views/clockviews/clock-config.css
index c8ac8fbb869..ffdf6f6e509 100644
--- a/views/clockviews/clock-config.css
+++ b/views/clockviews/clock-config.css
@@ -16,10 +16,10 @@
text-align: left;
}
#config-form form > div:nth-child(even):not(#facename) {
- background-color: rgba(200,200,200,0.5);
+ background-color: rgba(190,190,190,0.5);
}
#config-form form > div:nth-child(odd){
- background-color: rgba(220,220,220,0.5);
+ background-color: rgba(230,230,230,0.5);
}
input.elmt,
input.undo {
From 1a02c4dee8714ad4121357f44a204d267f091b1e Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 16:47:46 -0600
Subject: [PATCH 47/61] Update clock-client.js
thresholdReached - remove color class
---
lib/client/clock-client.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 7ca74e267d9..e2b6cbc66f3 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -248,6 +248,7 @@ client.render = function render () {
// Restyle body bg
if (thresholdReached) {
$('body').css('background-color', 'grey').css('color', 'black');
+ $('.color').removeClass('color');
$('.ar').css('filter', 'brightness(0%)');
} else {
$('body').css('color', bgColor ? 'white' : 'grey');
From 857b2d394673df8ebfea085c681be0432ef77f20 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 16:51:57 -0600
Subject: [PATCH 48/61] Update clock-client.js
thresholdReached - color class to black
---
lib/client/clock-client.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index e2b6cbc66f3..d8f9ecf7b0d 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -248,7 +248,7 @@ client.render = function render () {
// Restyle body bg
if (thresholdReached) {
$('body').css('background-color', 'grey').css('color', 'black');
- $('.color').removeClass('color');
+ $('.color').css('color', 'black');;
$('.ar').css('filter', 'brightness(0%)');
} else {
$('body').css('color', bgColor ? 'white' : 'grey');
From cd3070b4e511c226b777e56b6e599962d9926852 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Mon, 13 Nov 2023 17:16:13 -0600
Subject: [PATCH 49/61] Update clock-client.js
bring trend arrow back after thresholdReached is no loner true
---
lib/client/clock-client.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index d8f9ecf7b0d..5359117f320 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -253,6 +253,7 @@ client.render = function render () {
} else {
$('body').css('color', bgColor ? 'white' : 'grey');
$('.ar').not('.color').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)');
+ $('.ar.color').css('filter','brightness(100%)');
}
updateClock();
From a37143592600affd6a5fe61f0f99d3196c4c854a Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Tue, 14 Nov 2023 08:48:11 -0600
Subject: [PATCH 50/61] Update clock.html
original formatting
---
views/clockviews/clock.html | 184 ++++++++++++++++++------------------
1 file changed, 92 insertions(+), 92 deletions(-)
diff --git a/views/clockviews/clock.html b/views/clockviews/clock.html
index 380f293ea71..3e320ac22c2 100644
--- a/views/clockviews/clock.html
+++ b/views/clockviews/clock.html
@@ -2,101 +2,101 @@
-
-
-
-
Nightscout
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
Nightscout
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
- >
-
-
-
-
-
- <%if (face == 'config') { %>
- <%- include('clock-config.html', {}); %>
- <% } %>
+
+
+ >
+
+
+
+
+
+ <%if (face == 'config') { %>
+ <%- include('clock-config.html', {}); %>
+ <% } %>
From cdc7d23c0fad2b5fb529bf8aef4fc12f9414e58a Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Tue, 14 Nov 2023 08:50:27 -0600
Subject: [PATCH 51/61] Update clock-config.html
2 space indent
---
views/clockviews/clock-config.html | 200 ++++++++++++++---------------
1 file changed, 100 insertions(+), 100 deletions(-)
diff --git a/views/clockviews/clock-config.html b/views/clockviews/clock-config.html
index dd7510a994b..49a96ddc493 100644
--- a/views/clockviews/clock-config.html
+++ b/views/clockviews/clock-config.html
@@ -1,104 +1,104 @@
From bd6d3bd2d70db18433f4613b3299a40979d282e9 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Tue, 14 Nov 2023 08:51:39 -0600
Subject: [PATCH 52/61] Update clock-shared.css
2 space indent
---
views/clockviews/clock-shared.css | 76 +++++++++++++++----------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/views/clockviews/clock-shared.css b/views/clockviews/clock-shared.css
index 400f9347369..d967404d1e4 100644
--- a/views/clockviews/clock-shared.css
+++ b/views/clockviews/clock-shared.css
@@ -1,70 +1,70 @@
body {
- text-align: center;
- margin: 0 0;
- padding: 0;
- overflow: hidden;
- font-family: 'Open Sans', Arial, Helvetica, sans-serif;
- color: grey;
- background-color: black;
+ text-align: center;
+ margin: 0 0;
+ padding: 0;
+ overflow: hidden;
+ font-family: 'Open Sans', Arial, Helvetica, sans-serif;
+ color: grey;
+ background-color: black;
}
main {
- height: 100vh;
+ height: 100vh;
}
#inner {
- display: -webkit-box;
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
- align-items: center;
- justify-content: center;
- align-content: center;
- flex-flow: wrap;
- height: 100%;
- width: 100%;
- text-shadow: 1px 1px 0px #000000,-1px 1px 0px #000000,-1px -1px 0px #000000,1px -1px 0px #000000;
+ display: -webkit-box;
+ display: -ms-flexbox;
+ display: -webkit-flex;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ align-content: center;
+ flex-flow: wrap;
+ height: 100%;
+ width: 100%;
+ text-shadow: 1px 1px 0px #000000,-1px 1px 0px #000000,-1px -1px 0px #000000,1px -1px 0px #000000;
}
#inner div {
- margin-right: 2vmin;
- margin-left: 2vmin;
- line-height: 1em;
+ margin-right: 2vmin;
+ margin-left: 2vmin;
+ line-height: 1em;
}
#inner div img {
- height: 100%;
+ height: 100%;
}
#inner div.nl {
- width: 100%;
- margin: 0;
- height: 3vmin;
+ width: 100%;
+ margin: 0;
+ height: 3vmin;
}
#errorMessage {
- font-size: 25em;
+ font-size: 25em;
}
.stale {
- text-decoration: line-through;
+ text-decoration: line-through;
}
.close {
- color: white;
- font: 4em 'Open Sans';
- position: absolute;
- top: 0;
- right: 20px;
- text-decoration: none;
- z-index: 10;
+ color: white;
+ font: 4em 'Open Sans';
+ position: absolute;
+ top: 0;
+ right: 20px;
+ text-decoration: none;
+ z-index: 10;
}
.close:after {
- content: '\00D7';
+ content: '\00D7';
}
.hidden {
- opacity: 0;
- transition: opacity 0.5s linear;
+ opacity: 0;
+ transition: opacity 0.5s linear;
}
From 5974945b758f7f3d470a1c2e30ce137ac2e46cd2 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Tue, 14 Nov 2023 08:52:29 -0600
Subject: [PATCH 53/61] Update clock-config.css
2 space indent
---
views/clockviews/clock-config.css | 74 +++++++++++++++----------------
1 file changed, 37 insertions(+), 37 deletions(-)
diff --git a/views/clockviews/clock-config.css b/views/clockviews/clock-config.css
index ffdf6f6e509..2e5974b8635 100644
--- a/views/clockviews/clock-config.css
+++ b/views/clockviews/clock-config.css
@@ -1,62 +1,62 @@
#config-form {
- position: fixed;
- top: 10px;
- left: 10px;
- width: 250px;
- min-width: 220px;
- background: rgba(255, 255, 255, 0.5);
- color: black;
- opacity: 1;
- padding: 1%;
- font-size: 10px;
+ position: fixed;
+ top: 10px;
+ left: 10px;
+ width: 250px;
+ min-width: 220px;
+ background: rgba(255, 255, 255, 0.5);
+ color: black;
+ opacity: 1;
+ padding: 1%;
+ font-size: 10px;
}
#config-form form > div {
- margin: 0px;
- padding: 7px 5px;
- text-align: left;
+ margin: 0px;
+ padding: 7px 5px;
+ text-align: left;
}
#config-form form > div:nth-child(even):not(#facename) {
- background-color: rgba(190,190,190,0.5);
+ background-color: rgba(190,190,190,0.5);
}
#config-form form > div:nth-child(odd){
- background-color: rgba(230,230,230,0.5);
+ background-color: rgba(230,230,230,0.5);
}
input.elmt,
input.undo {
- margin: 0px 5px;
- width: calc(100% - 10px);
+ margin: 0px 5px;
+ width: calc(100% - 10px);
}
input.size {
- max-width: 50%;
+ max-width: 50%;
}
select {
- width: 100%;
+ width: 100%;
}
.size_color {
- align-items: center;
- display: flex;
- justify-content: space-evenly;
- margin-bottom: 3px;
+ align-items: center;
+ display: flex;
+ justify-content: space-evenly;
+ margin-bottom: 3px;
}
#facename {
- font-size: 7px;
- text-align: center !important;
+ font-size: 7px;
+ text-align: center !important;
}
#clocklink {
- font-size: 18px;
+ font-size: 18px;
}
#clocklink:link, #clocklink:visited {
- background-color: #f44336;
- color: white;
- padding: 14px 25px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
-
- margin: 10px 0px;
- border-radius: 5px;
- border: 1px solid #b51818;
+ background-color: #f44336;
+ color: white;
+ padding: 14px 25px;
+ text-align: center;
+ text-decoration: none;
+ display: inline-block;
+
+ margin: 10px 0px;
+ border-radius: 5px;
+ border: 1px solid #b51818;
}
#clocklink:hover, #clocklink:active {
- background-color: red;
+ background-color: red;
}
From 3870349e5cf4b3d5b02f1e6fc56c87b43f29d0ff Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Tue, 14 Nov 2023 08:54:40 -0600
Subject: [PATCH 54/61] Update clock-client.js
2 space indent
---
lib/client/clock-client.js | 534 ++++++++++++++++++-------------------
1 file changed, 267 insertions(+), 267 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 5359117f320..1bcf2346472 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -5,285 +5,285 @@ var client = {};
var latestProperties = {};
client.query = function query () {
- var parts = (location.search || '?').substring(1).split('&');
- var token = '';
- parts.forEach(function(val) {
- if (val.startsWith('token=')) {
- token = val.substring('token='.length);
- }
- });
-
- var secret = localStorage.getItem('apisecrethash');
- var src = '/api/v2/properties'; // Use precalculated data from the backend
-
- if (secret) {
- var s = '?secret=' + secret;
- src += s;
- } else if (token) {
- var s2 = '?token=' + token;
- src += s2;
- }
-
- $.ajax(src, {
- error: function gotError (err) {
- console.error(err);
- }
- , success: function gotData (data) {
- latestProperties = data;
- client.render();
- }
- });
+ var parts = (location.search || '?').substring(1).split('&');
+ var token = '';
+ parts.forEach(function(val) {
+ if (val.startsWith('token=')) {
+ token = val.substring('token='.length);
+ }
+ });
+
+ var secret = localStorage.getItem('apisecrethash');
+ var src = '/api/v2/properties'; // Use precalculated data from the backend
+
+ if (secret) {
+ var s = '?secret=' + secret;
+ src += s;
+ } else if (token) {
+ var s2 = '?token=' + token;
+ src += s2;
+ }
+
+ $.ajax(src, {
+ error: function gotError (err) {
+ console.error(err);
+ }
+ , success: function gotData (data) {
+ latestProperties = data;
+ client.render();
+ }
+ });
};
client.render = function render () {
- if (!latestProperties.bgnow && !latestProperties.bgnow.sgvs) {
- console.error('BG data not available');
- return;
- }
-
- let rec = latestProperties.bgnow.sgvs[0];
- let deltaDisplayValue;
-
- if (latestProperties.delta) {
- deltaDisplayValue = latestProperties.delta.display;
- }
-
- let $errorMessage = $('#errorMessage');
- let $inner = $('#inner');
-
- // If no one measured value found => show "-?-"
- if (!rec) {
- if (!$errorMessage.length) {
- $inner.after('
-?-
')
- } else {
- $errorMessage.show();
- }
- $inner.hide();
- return;
- } else {
- $errorMessage.length && $errorMessage.hide();
- $inner.show();
- }
-
- //Parse face parameters
- let face = $inner.data('face').toLowerCase();
-
- // Backward compatible
- if (face === 'clock-color') {
- face = 'c' + (window.serverSettings.settings.showClockLastTime ? 'y' : 'n') + '13-sg35-' + (window.serverSettings.settings.showClockDelta ? 'dt14-' : '') + 'nl-ar25-nl-ag6';
- } else if (face === 'clock') {
- face = 'bn0-sg40';
- } else if (face === 'bgclock') {
- face = 'b' + (window.serverSettings.settings.showClockLastTime ? 'y' : 'n') + '13-sg35-' + (window.serverSettings.settings.showClockDelta ? 'dt14-' : '') + 'nl-ar25-nl-ag6';
- } else if (face === 'config') {
- face = $inner.attr('data-face-config');
- $inner.empty();
- } else {
- face = $inner.data('face');
- }
-
- let faceParams = face.split('-');
- let bgColor = false;
- let staleMinutes = 13;
- let alwaysShowTime = false;
-
- let clockCreated = ($inner.children().length > 0);
-
- // These are the particular shades of red, yellow, green, and blue.
- let red = 'rgba(213,9,21,1)';
- let arrowRed = '#D50915';
- let yellow = 'rgba(234,168,0,1)';
- let arrowYellow = '#EAA800';
- let green = 'rgba(134,207,70,1)';
- let arrowGreen = '#86CF46';
- let blue = 'rgba(78,143,207,1)';
- let arrowBlue = '#4E8FCF';
-
-
- for (let param in faceParams) {
- if (param === '0') {
- /* eslint-disable-next-line security/detect-object-injection */ // verified false positive
- let faceParam = faceParams[param];
- bgColor = (faceParam.substr(0, 1) === 'c'); // do we want colorful background?
- alwaysShowTime = (faceParam.substr(1, 1) === 'y'); // always show "stale time" text?
- staleMinutes = (faceParam.substr(2, 2) - 0 >= 0) ? faceParam.substr(2, 2) : 13; // threshold value (0=never)
- } else if (!clockCreated) {
- /* eslint-disable-next-line security/detect-object-injection */ // verified false positive
- let faceParam = faceParams[param];
-
- let classParam = faceParam.substr(0, 2);
- let colorParam = (classParam.charAt(0) == classParam.charAt(0).toUpperCase());
- classParam = classParam.toLowerCase();
- let sizeParam = '';
- if (faceParam.substr(2, 2) - 0 > 0) {
- sizeParam = faceParam.substr(2, 2);
- }
- let paramStyle = '';
- if (sizeParam) {
- if (classParam === 'ar') {
- paramStyle = (paramStyle + 'width: ' + sizeParam + 'vmin;');
- } else {
- paramStyle = (paramStyle + 'font-size: ' + sizeParam + 'vmin;');
- }
- }
-
- let div = '
';
- $inner.append(div);
- }
- }
-
- let displayValue = rec.scaled;
-
- // Insert the delta value text.
- $('.dt').html(deltaDisplayValue);
-
- // Threshold values
- let bgHigh = client.settings.thresholds.bgHigh;
- let bgLow = client.settings.thresholds.bgLow;
- let bgTargetBottom = client.settings.thresholds.bgTargetBottom;
- let bgTargetTop = client.settings.thresholds.bgTargetTop;
-
- let bgNum = parseFloat(rec.mgdl);
-
- // Color background
- if (bgColor) {
-
- // Threshold background coloring.
- if (bgNum < bgLow) {
- $('body').css('background-color', red);
- }
- if ((bgLow <= bgNum) && (bgNum < bgTargetBottom)) {
- $('body').css('background-color', blue);
- }
- if ((bgTargetBottom <= bgNum) && (bgNum < bgTargetTop)) {
- $('body').css('background-color', green);
- }
- if ((bgTargetTop <= bgNum) && (bgNum < bgHigh)) {
- $('body').css('background-color', yellow);
- }
- if (bgNum >= bgHigh) {
- $('body').css('background-color', red);
- }
-
- } else {
- $('body').css('background-color', 'black');
- }
-
- //Text color
- let arrowColor = '#FFFFFF';
- if (bgNum < bgLow) {
- $('.color').css('color', red);
- if ($('.ar').hasClass('color')) {
- arrowColor = arrowRed;
- }
- }
- if ((bgLow <= bgNum) && (bgNum < bgTargetBottom)) {
- $('.color').css('color', blue);
- if ($('.ar').hasClass('color')) {
- arrowColor = arrowBlue;
- }
- }
- if ((bgTargetBottom <= bgNum) && (bgNum < bgTargetTop)) {
- $('.color').css('color', green);
- if ($('.ar').hasClass('color')) {
- arrowColor = arrowGreen;
- }
- }
- if ((bgTargetTop <= bgNum) && (bgNum < bgHigh)) {
- $('.color').css('color', yellow);
- if ($('.ar').hasClass('color')) {
- arrowColor = arrowYellow;
- }
- }
- if (bgNum >= bgHigh) {
- $('.color').css('color', red);
- if ($('.ar').hasClass('color')) {
- arrowColor = arrowRed;
- }
- }
-
- // Time before data considered stale.
- let threshold = 1000 * 60 * staleMinutes;
-
- var elapsedms = Date.now() - rec.mills;
- let elapsedMins = Math.floor((elapsedms / 1000) / 60);
- let thresholdReached = (elapsedms > threshold) && threshold > 0;
-
- // Insert the BG value text, toggle stale if necessary.
- $('.sg').toggleClass('stale', thresholdReached).html(displayValue);
-
- if (thresholdReached || alwaysShowTime) {
- let staleTimeText;
- if (elapsedMins === 0) {
- staleTimeText = 'Just now';
- } else if (elapsedMins === 1) {
- staleTimeText = '1 minute ago';
- } else {
- staleTimeText = elapsedMins + ' minutes ago';
- }
-
- $('.ag').html(staleTimeText);
- } else {
- $('.ag').html('');
- }
-
- // Insert the trend arrow.
- let trendArrow = {
- 'NONE': '
',
- 'Flat': '
',
- 'FortyFiveDown': '
',
- 'FortyFiveUp': '
',
- 'SingleDown': '
',
- 'SingleUp': '
',
- 'DoubleDown': '
',
- 'DoubleUp': '
',
- 'TripleDown': '
',
- 'TripleUp': '
'
- };
- let arrow = $(trendArrow[(!rec.direction || rec.direction === 'NOT COMPUTABLE' ? 'NONE' : rec.direction)]);
- $('.ar').html(arrow);
-
-
- // Restyle body bg
- if (thresholdReached) {
- $('body').css('background-color', 'grey').css('color', 'black');
- $('.color').css('color', 'black');;
- $('.ar').css('filter', 'brightness(0%)');
- } else {
- $('body').css('color', bgColor ? 'white' : 'grey');
- $('.ar').not('.color').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)');
- $('.ar.color').css('filter','brightness(100%)');
- }
-
- updateClock();
-
+ if (!latestProperties.bgnow && !latestProperties.bgnow.sgvs) {
+ console.error('BG data not available');
+ return;
+ }
+
+ let rec = latestProperties.bgnow.sgvs[0];
+ let deltaDisplayValue;
+
+ if (latestProperties.delta) {
+ deltaDisplayValue = latestProperties.delta.display;
+ }
+
+ let $errorMessage = $('#errorMessage');
+ let $inner = $('#inner');
+
+ // If no one measured value found => show "-?-"
+ if (!rec) {
+ if (!$errorMessage.length) {
+ $inner.after('
-?-
')
+ } else {
+ $errorMessage.show();
+ }
+ $inner.hide();
+ return;
+ } else {
+ $errorMessage.length && $errorMessage.hide();
+ $inner.show();
+ }
+
+ //Parse face parameters
+ let face = $inner.data('face').toLowerCase();
+
+ // Backward compatible
+ if (face === 'clock-color') {
+ face = 'c' + (window.serverSettings.settings.showClockLastTime ? 'y' : 'n') + '13-sg35-' + (window.serverSettings.settings.showClockDelta ? 'dt14-' : '') + 'nl-ar25-nl-ag6';
+ } else if (face === 'clock') {
+ face = 'bn0-sg40';
+ } else if (face === 'bgclock') {
+ face = 'b' + (window.serverSettings.settings.showClockLastTime ? 'y' : 'n') + '13-sg35-' + (window.serverSettings.settings.showClockDelta ? 'dt14-' : '') + 'nl-ar25-nl-ag6';
+ } else if (face === 'config') {
+ face = $inner.attr('data-face-config');
+ $inner.empty();
+ } else {
+ face = $inner.data('face');
+ }
+
+ let faceParams = face.split('-');
+ let bgColor = false;
+ let staleMinutes = 13;
+ let alwaysShowTime = false;
+
+ let clockCreated = ($inner.children().length > 0);
+
+ // These are the particular shades of red, yellow, green, and blue.
+ let red = 'rgba(213,9,21,1)';
+ let arrowRed = '#D50915';
+ let yellow = 'rgba(234,168,0,1)';
+ let arrowYellow = '#EAA800';
+ let green = 'rgba(134,207,70,1)';
+ let arrowGreen = '#86CF46';
+ let blue = 'rgba(78,143,207,1)';
+ let arrowBlue = '#4E8FCF';
+
+
+ for (let param in faceParams) {
+ if (param === '0') {
+ /* eslint-disable-next-line security/detect-object-injection */ // verified false positive
+ let faceParam = faceParams[param];
+ bgColor = (faceParam.substr(0, 1) === 'c'); // do we want colorful background?
+ alwaysShowTime = (faceParam.substr(1, 1) === 'y'); // always show "stale time" text?
+ staleMinutes = (faceParam.substr(2, 2) - 0 >= 0) ? faceParam.substr(2, 2) : 13; // threshold value (0=never)
+ } else if (!clockCreated) {
+ /* eslint-disable-next-line security/detect-object-injection */ // verified false positive
+ let faceParam = faceParams[param];
+
+ let classParam = faceParam.substr(0, 2);
+ let colorParam = (classParam.charAt(0) == classParam.charAt(0).toUpperCase());
+ classParam = classParam.toLowerCase();
+ let sizeParam = '';
+ if (faceParam.substr(2, 2) - 0 > 0) {
+ sizeParam = faceParam.substr(2, 2);
+ }
+ let paramStyle = '';
+ if (sizeParam) {
+ if (classParam === 'ar') {
+ paramStyle = (paramStyle + 'width: ' + sizeParam + 'vmin;');
+ } else {
+ paramStyle = (paramStyle + 'font-size: ' + sizeParam + 'vmin;');
+ }
+ }
+
+ let div = '
';
+ $inner.append(div);
+ }
+ }
+
+ let displayValue = rec.scaled;
+
+ // Insert the delta value text.
+ $('.dt').html(deltaDisplayValue);
+
+ // Threshold values
+ let bgHigh = client.settings.thresholds.bgHigh;
+ let bgLow = client.settings.thresholds.bgLow;
+ let bgTargetBottom = client.settings.thresholds.bgTargetBottom;
+ let bgTargetTop = client.settings.thresholds.bgTargetTop;
+
+ let bgNum = parseFloat(rec.mgdl);
+
+ // Color background
+ if (bgColor) {
+
+ // Threshold background coloring.
+ if (bgNum < bgLow) {
+ $('body').css('background-color', red);
+ }
+ if ((bgLow <= bgNum) && (bgNum < bgTargetBottom)) {
+ $('body').css('background-color', blue);
+ }
+ if ((bgTargetBottom <= bgNum) && (bgNum < bgTargetTop)) {
+ $('body').css('background-color', green);
+ }
+ if ((bgTargetTop <= bgNum) && (bgNum < bgHigh)) {
+ $('body').css('background-color', yellow);
+ }
+ if (bgNum >= bgHigh) {
+ $('body').css('background-color', red);
+ }
+
+ } else {
+ $('body').css('background-color', 'black');
+ }
+
+ //Text color
+ let arrowColor = '#FFFFFF';
+ if (bgNum < bgLow) {
+ $('.color').css('color', red);
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowRed;
+ }
+ }
+ if ((bgLow <= bgNum) && (bgNum < bgTargetBottom)) {
+ $('.color').css('color', blue);
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowBlue;
+ }
+ }
+ if ((bgTargetBottom <= bgNum) && (bgNum < bgTargetTop)) {
+ $('.color').css('color', green);
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowGreen;
+ }
+ }
+ if ((bgTargetTop <= bgNum) && (bgNum < bgHigh)) {
+ $('.color').css('color', yellow);
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowYellow;
+ }
+ }
+ if (bgNum >= bgHigh) {
+ $('.color').css('color', red);
+ if ($('.ar').hasClass('color')) {
+ arrowColor = arrowRed;
+ }
+ }
+
+ // Time before data considered stale.
+ let threshold = 1000 * 60 * staleMinutes;
+
+ var elapsedms = Date.now() - rec.mills;
+ let elapsedMins = Math.floor((elapsedms / 1000) / 60);
+ let thresholdReached = (elapsedms > threshold) && threshold > 0;
+
+ // Insert the BG value text, toggle stale if necessary.
+ $('.sg').toggleClass('stale', thresholdReached).html(displayValue);
+
+ if (thresholdReached || alwaysShowTime) {
+ let staleTimeText;
+ if (elapsedMins === 0) {
+ staleTimeText = 'Just now';
+ } else if (elapsedMins === 1) {
+ staleTimeText = '1 minute ago';
+ } else {
+ staleTimeText = elapsedMins + ' minutes ago';
+ }
+
+ $('.ag').html(staleTimeText);
+ } else {
+ $('.ag').html('');
+ }
+
+ // Insert the trend arrow.
+ let trendArrow = {
+ 'NONE': '
',
+ 'Flat': '
',
+ 'FortyFiveDown': '
',
+ 'FortyFiveUp': '
',
+ 'SingleDown': '
',
+ 'SingleUp': '
',
+ 'DoubleDown': '
',
+ 'DoubleUp': '
',
+ 'TripleDown': '
',
+ 'TripleUp': '
'
+ };
+ let arrow = $(trendArrow[(!rec.direction || rec.direction === 'NOT COMPUTABLE' ? 'NONE' : rec.direction)]);
+ $('.ar').html(arrow);
+
+
+ // Restyle body bg
+ if (thresholdReached) {
+ $('body').css('background-color', 'grey').css('color', 'black');
+ $('.color').css('color', 'black');;
+ $('.ar').css('filter', 'brightness(0%)');
+ } else {
+ $('body').css('color', bgColor ? 'white' : 'grey');
+ $('.ar').not('.color').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)');
+ $('.ar.color').css('filter','brightness(100%)');
+ }
+
+ updateClock();
+
};
function updateClock () {
- let timeDivisor = parseInt(client.settings.timeFormat ? client.settings.timeFormat : 12, 10);
- let today = new Date()
- , h = today.getHours() % timeDivisor;
- if (timeDivisor === 12) {
- h = (h === 0) ? 12 : h; // In the case of 00:xx, change to 12:xx for 12h time
- }
- if (timeDivisor === 24) {
- h = (h < 10) ? ("0" + h) : h; // Pad the hours with a 0 in 24h time
- }
- let m = today.getMinutes();
- if (m < 10) m = "0" + m;
- $('.tm').html(h + ":" + m);
+ let timeDivisor = parseInt(client.settings.timeFormat ? client.settings.timeFormat : 12, 10);
+ let today = new Date()
+ , h = today.getHours() % timeDivisor;
+ if (timeDivisor === 12) {
+ h = (h === 0) ? 12 : h; // In the case of 00:xx, change to 12:xx for 12h time
+ }
+ if (timeDivisor === 24) {
+ h = (h < 10) ? ("0" + h) : h; // Pad the hours with a 0 in 24h time
+ }
+ let m = today.getMinutes();
+ if (m < 10) m = "0" + m;
+ $('.tm').html(h + ":" + m);
}
client.init = function init () {
- console.log('Initializing clock');
- client.settings = browserSettings(client, window.serverSettings, $);
- client.query();
- setInterval(client.query, 20 * 1000); // update every 20 seconds
+ console.log('Initializing clock');
+ client.settings = browserSettings(client, window.serverSettings, $);
+ client.query();
+ setInterval(client.query, 20 * 1000); // update every 20 seconds
- // time update
- setInterval(updateClock, 1000);
+ // time update
+ setInterval(updateClock, 1000);
};
module.exports = client;
From 54ba62e8ac6820c590a83ae85c1dc1dc456306d9 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Tue, 14 Nov 2023 09:03:51 -0600
Subject: [PATCH 55/61] Update clock-shared.css
text-shadow x 8
---
views/clockviews/clock-shared.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/views/clockviews/clock-shared.css b/views/clockviews/clock-shared.css
index d967404d1e4..6e091e1bdee 100644
--- a/views/clockviews/clock-shared.css
+++ b/views/clockviews/clock-shared.css
@@ -23,7 +23,7 @@ main {
flex-flow: wrap;
height: 100%;
width: 100%;
- text-shadow: 1px 1px 0px #000000,-1px 1px 0px #000000,-1px -1px 0px #000000,1px -1px 0px #000000;
+ text-shadow: -1px -1px 0px #000000, -1px 0px 0px #000000, -1px 1px 0px #000000, 0px -1px 0px #000000, 0px 1px 0px #000000, 1px -1px 0px #000000, 1px 0px 0px #000000, 1px 1px 0px #000000;
}
#inner div {
From d09237895f5ea196951f989f29227185d198895d Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Tue, 14 Nov 2023 09:05:32 -0600
Subject: [PATCH 56/61] Update clock-client.js
increase arrow stroke width to 4
---
lib/client/clock-client.js | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 1bcf2346472..1887751ccb8 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -230,16 +230,16 @@ client.render = function render () {
// Insert the trend arrow.
let trendArrow = {
- 'NONE': '
',
- 'Flat': '
',
- 'FortyFiveDown': '
',
- 'FortyFiveUp': '
',
- 'SingleDown': '
',
- 'SingleUp': '
',
- 'DoubleDown': '
',
- 'DoubleUp': '
',
- 'TripleDown': '
',
- 'TripleUp': '
'
+ 'NONE': '
',
+ 'Flat': '
',
+ 'FortyFiveDown': '
',
+ 'FortyFiveUp': '
',
+ 'SingleDown': '
',
+ 'SingleUp': '
',
+ 'DoubleDown': '
',
+ 'DoubleUp': '
',
+ 'TripleDown': '
',
+ 'TripleUp': '
'
};
let arrow = $(trendArrow[(!rec.direction || rec.direction === 'NOT COMPUTABLE' ? 'NONE' : rec.direction)]);
$('.ar').html(arrow);
From c8410fc8185ff5e2da63cb82092f13932bdaf408 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Tue, 14 Nov 2023 09:33:26 -0600
Subject: [PATCH 57/61] Update clock-client.js
comma first
---
lib/client/clock-client.js | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 1887751ccb8..90c9b53a2ef 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -7,7 +7,7 @@ var latestProperties = {};
client.query = function query () {
var parts = (location.search || '?').substring(1).split('&');
var token = '';
- parts.forEach(function(val) {
+ parts.forEach(function (val) {
if (val.startsWith('token=')) {
token = val.substring('token='.length);
}
@@ -230,16 +230,16 @@ client.render = function render () {
// Insert the trend arrow.
let trendArrow = {
- 'NONE': '
',
- 'Flat': '
',
- 'FortyFiveDown': '
',
- 'FortyFiveUp': '
',
- 'SingleDown': '
',
- 'SingleUp': '
',
- 'DoubleDown': '
',
- 'DoubleUp': '
',
- 'TripleDown': '
',
- 'TripleUp': '
'
+ 'NONE': '
'
+ , 'Flat': '
'
+ , 'FortyFiveDown': '
'
+ , 'FortyFiveUp': '
'
+ , 'SingleDown': '
'
+ , 'SingleUp': '
'
+ , 'DoubleDown': '
'
+ , 'DoubleUp': '
'
+ , 'TripleDown': '
'
+ , 'TripleUp': '
'
};
let arrow = $(trendArrow[(!rec.direction || rec.direction === 'NOT COMPUTABLE' ? 'NONE' : rec.direction)]);
$('.ar').html(arrow);
From c5bdb4372f33b435a6dd07402d90a440dc6a3df9 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Tue, 5 Dec 2023 08:41:30 -0600
Subject: [PATCH 58/61] Update clock-client.js
body color white
---
lib/client/clock-client.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 90c9b53a2ef..13aaba0633f 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -251,7 +251,8 @@ client.render = function render () {
$('.color').css('color', 'black');;
$('.ar').css('filter', 'brightness(0%)');
} else {
- $('body').css('color', bgColor ? 'white' : 'grey');
+ //$('body').css('color', bgColor ? 'white' : 'grey');
+ $('body').css('color', 'white');
$('.ar').not('.color').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)');
$('.ar.color').css('filter','brightness(100%)');
}
From 78e70973e91f158b1bb8b189d12c1c34d1b19e7b Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Wed, 6 Dec 2023 10:07:20 -0600
Subject: [PATCH 59/61] Update clock-client.js
ARROW COLOR WHITE
---
lib/client/clock-client.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index 13aaba0633f..d21c1e90884 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -251,10 +251,10 @@ client.render = function render () {
$('.color').css('color', 'black');;
$('.ar').css('filter', 'brightness(0%)');
} else {
- //$('body').css('color', bgColor ? 'white' : 'grey');
- $('body').css('color', 'white');
- $('.ar').not('.color').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)');
- $('.ar.color').css('filter','brightness(100%)');
+ $('body').css('color', bgColor ? 'white' : 'grey');
+ /*$('.ar').not('.color').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)');
+ $('.ar.color').css('filter','brightness(100%)');*/
+ $('.ar').css('filter','brightness(100%)');
}
updateClock();
From 4c31afb21bb4b9580c076795465496bdbbc0c09c Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Wed, 6 Dec 2023 10:12:08 -0600
Subject: [PATCH 60/61] Update clock-client.js
---
lib/client/clock-client.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/client/clock-client.js b/lib/client/clock-client.js
index d21c1e90884..c412ddb1814 100644
--- a/lib/client/clock-client.js
+++ b/lib/client/clock-client.js
@@ -251,9 +251,10 @@ client.render = function render () {
$('.color').css('color', 'black');;
$('.ar').css('filter', 'brightness(0%)');
} else {
- $('body').css('color', bgColor ? 'white' : 'grey');
- /*$('.ar').not('.color').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)');
+ /*$('body').css('color', bgColor ? 'white' : 'grey');
+ $('.ar').not('.color').css('filter', bgColor ? 'brightness(100%)' : 'brightness(50%)');
$('.ar.color').css('filter','brightness(100%)');*/
+ $('body').css('color', 'white');
$('.ar').css('filter','brightness(100%)');
}
From 6f1f9b6a9b6866008d72f769f117696d96953ec1 Mon Sep 17 00:00:00 2001
From: JaredDRobbins <45437025+JaredDRobbins@users.noreply.github.com>
Date: Wed, 6 Dec 2023 10:16:54 -0600
Subject: [PATCH 61/61] Update clock-client.js
white text/arrow