-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
101 lines (85 loc) · 3.4 KB
/
index.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
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css" />
<script src="js/main.js"></script>
</head>
<body class="grey lighten-5">
<div class="container" style="text-align:center;">
<div class="row">
<div class="col s2"></div>
<div class="col s8">
<div class="row">
<div class="col s4">
<div id="clock">
<div class="pointers">
<span class="secondsPointer"></span>
<span class="minutesPointer"></span>
<span class="HoursPointer"></span>
</div>
<div class="dots"></div>
</div>
</div>
<div class="col s8">
<div id="relogio"></div>
<input type="time" id="alarm" />
</div>
</div>
</div>
<div class="col s2"></div>
</div>
</div>
</body>
<script type="text/javascript">
var relogio = new clock();
relogio.iniciar();
var dismiss = false;
var soneca = false;
var checkAlarm = function(now) {
var alarm = $("#alarm");
if (alarm.val().length == 0) {
return;
}
var hourset = alarm.val().split(":")[0];
var minuteset = alarm.val().split(":")[1];
if (soneca) {
minuteset = parseInt(minuteset) + 5;
}
if (parseInt(hourset) == now.getHours() && now.getMinutes() == parseInt(minuteset) && !dismiss) {
dismiss = !confirm("Alarme! soneca?");
soneca = !dismiss;
}
}
var verHorario = function() {
var now = new Date();
second = now.getSeconds() * 6,
minute = now.getMinutes() * 6 + second / 60,
hour = ((now.getHours() % 12) / 12) * 360 + 90 + minute / 12;
//document.getElementById("relogio").innerHTML = relogio.verHora();
document.getElementById("relogio").innerHTML = now;
$(".secondsPointer").css('transform', "rotate(" + second + "deg)");
$(".minutesPointer").css('transform', "rotate(" + minute + "deg)");
$(".HoursPointer").css('transform', "rotate(" + hour + "deg)");
checkAlarm(now);
}
setInterval(verHorario, 1001);
var rotatedeg = 6;
for (let x = 0; x < 59; x++) {
let minuteDot = `<i class="dot minutes minute_${x}" style="transform:rotate(${(6*x)}deg)"></i>`
}
var clock = document.getElementById("clock");
clock.style.height = clock.offsetWidth + "px";
window.addEventListener("resize", function() {
clock.style.height = clock.offsetWidth + "px";
});
</script>
</html>