-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
97 lines (92 loc) · 2.67 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
<!DOCTYPE html>
<html lang="en">
<head>
<link href='https://fonts.googleapis.com/css?family=Exo' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
font-family: 'Exo', sans-serif;
background-color: black;
color: greenyellow;
margin: 0;
padding: 0;
}
.clock {
font-size: x-large;
padding: 0;
margin: 0 auto;
width: 90vw;
height: 90vh;
max-width: 100%;
max-height: 100%;
}
.wrapper {
}
</style>
<meta charset="UTF-8">
<title>Big damn clock</title>
</head>
<body>
<div class="clock">
<div class="wrapper">
<span class="hour">00</span>
<span class="separator">:</span>
<span class="minutes">00</span>
</div>
</div>
<script src="app/bower_components/jquery/dist/jquery.min.js"></script>
<script src="app/bower_components/jquery-bigtext/jquery-bigtext.js"></script>
<script src="app/bower_components/moment/moment.js"></script>
<script type="text/javascript">
var Clock = {
currentHours: '00',
currentMinutes: '00',
$clock: null,
$hours: null,
$minutes: null,
resize: function () {
this.$clock.find('.wrapper').bigText();
},
bind: function () {
var self = this;
$(window).on('resize', function () {
self.resize();
});
this.$clock.on('clock-update', function (event, moment) {
self.resize();
var hours = moment.format('HH');
var minutes = moment.format('mm');
if (self.currentHours != hours) {
self.currentHours = hours;
self.$hours.text(hours)
}
if (self.currentMinutes != minutes) {
self.currentMinutes = minutes;
self.$minutes.text(minutes);
}
});
},
init: function ($clock) {
this.$clock = $clock;
this.$hours = $clock.find('.hour');
this.$minutes = $clock.find('.minutes');
this.bind();
this.resize();
}
};
var $clocks = $(".clock");
$clocks.each(function () {
var bigDamnClock = Object.create(Clock);
$clock = $(this);
bigDamnClock.init($(this));
$clock.find('.wrapper').bigText();
});
(function tick() {
now = moment();
$clocks.trigger('clock-update', [now]);
setTimeout(function () {
tick();
}, 750);
})();
</script>
</body>
</html>