-
Notifications
You must be signed in to change notification settings - Fork 1
/
timeSelector.html
75 lines (67 loc) · 2.12 KB
/
timeSelector.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
<!DOCTYPE html>
<html lang="es">
<link rel="stylesheet" href="./css/photon.min.css">
<head>
<title>Cuenta atrás</title>
</head>
<body>
<div class="window">
<div class="window-content">
<div class="padded-more">
<form>
<div class="form-group">
<label>Horas</label>
<input class="form-control" id="horas" type="number" step="1" min="0"></input>
</div>
<div class="form-group">
<label>Minutos</label>
<input class="form-control" id="minutos" type="number" step="1" min="0" max="59"></input>
</div>
<div class="form-group">
<label>Segundos</label>
<input class="form-control" id="segundos" type="number" step="1" min="0" max="59"></input>
</div>
<button type="submit" class="btn btn-form btn-primary">Elegir cuenta atrás</button>
</form>
</div>
</div>
</div>
</body>
<script>
const sp = require('serialport');
const electron = require("electron")
const storage = require('electron-store');
const {ipcRenderer} = electron;
const store = new storage();
let horasDOM = document.querySelector("#horas");
let minutosDOM = document.querySelector("#minutos");
let segundosDOM = document.querySelector("#segundos");
horasDOM.value = store.get("countdownHoras") || 0;
minutosDOM.value = store.get("countdownMinutos") || 0;
segundosDOM.value = store.get("countdownSegundos") || 0;
const form = document.querySelector("form");
form.addEventListener("submit", submitForm);
document.addEventListener("keyup", function(e){
e.preventDefault();
if (e.keyCode === 13){
submitForm(e);
}
});
function submitForm(e){
e.preventDefault();
let horas =document.querySelector("#horas").value || 0;
let minutos = document.querySelector("#minutos").value || 0;
let segundos = document.querySelector("#segundos").value || 0;
if(minutos>59){
minutos = 59;
}
if(segundos>59){
segundos = 59;
}
store.set("countdownHoras", horas);
store.set("countdownMinutos", minutos);
store.set("countdownSegundos", segundos);
ipcRenderer.send("config:countdown-save");
}
</script>
</html>