-
Notifications
You must be signed in to change notification settings - Fork 1
/
timeWindow.html
88 lines (77 loc) · 2.24 KB
/
timeWindow.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html lang="es">
<link rel="stylesheet" href="./css/photon.min.css">
<link rel="stylesheet" href="./css/timewindow.css">
<head>
<title>Cuenta atrás</title>
</head>
<body>
<div class="window">
<div class="window-content">
<div class="padded-more">
<div class="clock">
<canvas id="hours-canvas"></canvas>
<label><span id="hours-count"></span> Horas</label>
</div>
<div class="clock">
<canvas id="minutes-canvas"></canvas>
<label><span id="minutes-count"></span> Minutos</label>
</div>
<div class="clock">
<canvas id="seconds-canvas"></canvas>
<label><span id="seconds-count"></span> Segundos</label>
</div>
</div>
</div>
</div>
</body>
<script>
var Clock = require("clock-timer.js");
const storage = require('electron-store');
const electron = require("electron");
const {ipcRenderer} = electron;
const store = new storage();
// TODO Epoch fail (handle +1 day problems)
var currTime = new Date();
let addSeconds = parseInt(store.get("countdownSegundos")) || 0;
let addMinutes = parseInt(store.get("countdownMinutos")) || 0;
let addHours = parseInt(store.get("countdownHoras")) || 0;
console.log(addSeconds);
console.log(addMinutes);
console.log(addHours);
console.log(currTime.toLocaleDateString("en-US", {
day: "2-digit",
month: "2-digit",
year: "numeric",
}) + " " + currTime.toLocaleDateString("es-ES", {
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
}).split(" ")[1]);
currTime.setSeconds(addSeconds);
currTime.setMinutes(addMinutes);
currTime.setHours(addHours);
let endTime = currTime.toLocaleDateString("en-US", {
day: "2-digit",
month: "2-digit",
year: "numeric",
}) + " " + currTime.toLocaleDateString("es-ES", {
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
}).split(" ")[1];
// Hacky way of formating for clock-timer.js
console.log(endTime);
clock = new Clock({
daysCanvas: false,
endDate: endTime,
secondsStrokeStyle: "#1079C0",
minutesStrokeStyle: "#1079C0",
hoursStrokeStyle: "#1079C0",
});
clock.on("end", () => {
//console.log("all good");
ipcRenderer.send("arduino:countdown-send-data-done");
})
</script>
</html>