reformatted json clock
parent
eebfc56b95
commit
81755f82e8
|
|
@ -61,7 +61,8 @@ function getHr(h) {
|
|||
|
||||
function extractTime(d) {
|
||||
const out = getHr(d.getHours());
|
||||
const hr = out[0]; const amPm = out[1];
|
||||
const hr = out[0];
|
||||
const amPm = out[1];
|
||||
const m = d.getMinutes();
|
||||
return `${h}:${("0"+m).substr(-2)}${amPm}`;
|
||||
}
|
||||
|
|
@ -69,7 +70,8 @@ function extractTime(d){
|
|||
function extractDate(d) {
|
||||
const weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
||||
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
];
|
||||
|
||||
const weekday = weekdays[d.getDay()];
|
||||
const month = months[d.getMonth()];
|
||||
|
|
@ -197,18 +199,20 @@ function redraw() {
|
|||
// Value color
|
||||
if (value.startsWith('"')) {
|
||||
g.setColor(clrs.strings);
|
||||
}
|
||||
else if (value.startsWith('{') || value.startsWith('}')) {
|
||||
} else if (value.startsWith('{') || value.startsWith('}')) {
|
||||
g.setColor(clrs.brackets);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g.setColor(clrs.ints);
|
||||
}
|
||||
g.drawString(valueText, valueX, y);
|
||||
|
||||
valuePositions.push({ key, x: valueX, y, text: value });
|
||||
}
|
||||
else {
|
||||
valuePositions.push({
|
||||
key,
|
||||
x: valueX,
|
||||
y,
|
||||
text: value
|
||||
});
|
||||
} else {
|
||||
g.setColor(clrs.brackets);
|
||||
g.drawString(line, numWidth, y);
|
||||
}
|
||||
|
|
@ -237,8 +241,8 @@ function redrawValues(){
|
|||
}
|
||||
|
||||
Bangle.on('touch', (zone, e) => {
|
||||
if (e.x >= (buttonY - buttonHeight) && e.x <= (buttonX + buttonHeight)
|
||||
&& (e.y >= (buttonY - buttonHeight) && e.y <= (buttonY + buttonHeight))) {
|
||||
if (e.x >= (buttonY - buttonHeight) && e.x <= (buttonX + buttonHeight) &&
|
||||
(e.y >= (buttonY - buttonHeight) && e.y <= (buttonY + buttonHeight))) {
|
||||
load(); // Exit app
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue