aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Daniel Smith <rdnlsmith@gmail.com> 2019-05-15 21:59:46 -0400
committerGravatar Daniel Smith <rdnlsmith@gmail.com> 2019-05-15 21:59:46 -0400
commit595d70975585f32e917c7a1a56a0201e28f14beb (patch)
tree406862553f16d23d1e67f3302fa9ea236ce71b2f /app
parenta568ca8eebb3071b474da99737a767914eec5278 (diff)
Implement basic clock face
Diffstat (limited to 'app')
-rw-r--r--app/index.js37
1 files changed, 16 insertions, 21 deletions
diff --git a/app/index.js b/app/index.js
index c466b90..6c8d4cc 100644
--- a/app/index.js
+++ b/app/index.js
@@ -6,14 +6,13 @@ import * as messaging from "messaging";
import { preferences } from "user-settings";
import * as util from "./utils";
-const SETTINGS_TYPE = "cbor";
-const SETTINGS_FILE = "settings.cbor";
+// const SETTINGS_TYPE = "cbor";
+// const SETTINGS_FILE = "settings.cbor";
-let settings = loadSettings();
-applyTheme(settings.background, settings.foreground);
+// let settings = loadSettings();
+// applyTheme(settings.background, settings.foreground);
// TIME
-let separator = document.getElementById("separator");
let hours1 = document.getElementById("hours1");
let hours2 = document.getElementById("hours2");
let mins1 = document.getElementById("mins1");
@@ -49,9 +48,6 @@ clock.ontick = evt => {
// MINUTES
let minute = ("0" + d.getMinutes()).slice(-2);
setMins(minute);
-
- // BLINK SEPARATOR
- setSeparator(d.getSeconds());
}
// Apply theme colors to elements
@@ -68,11 +64,6 @@ function applyTheme(background, foreground) {
settings.foreground = foreground;
}
-// Blink time separator
-function setSeparator(val) {
- separator.style.display = (val % 2 === 0 ? "inline" : "none");
-}
-
function setHours(val) {
if (val > 9) {
drawDigit(Math.floor(val / 10), hours1);
@@ -88,8 +79,8 @@ function setMins(val) {
}
function setDate(val) {
- drawDigit(Math.floor(val / 10), date1);
- drawDigit(Math.floor(val % 10), date2);
+ drawDateDigit(Math.floor(val / 10), date1);
+ drawDateDigit(Math.floor(val % 10), date2);
}
function setDay(val) {
@@ -97,21 +88,25 @@ function setDay(val) {
}
function drawDigit(val, place) {
- place.image = `${val}.png`;
+ place.image = `numerals/${val}.png`;
+}
+
+function drawDateDigit(val, place) {
+ place.image = `dates/${val}.png`
}
function getDayImg(index) {
let days = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
- return `day_${days[index]}.png`;
+ return `dates/${days[index]}.png`;
}
// Listen for the onmessage event
-messaging.peerSocket.onmessage = evt => {
- applyTheme(evt.data.background, evt.data.foreground);
-}
+// messaging.peerSocket.onmessage = evt => {
+// applyTheme(evt.data.background, evt.data.foreground);
+// }
// Register for the unload event
-me.onunload = saveSettings;
+// me.onunload = saveSettings;
function loadSettings() {
try {