forked from mrchimp/tock
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
Latest commit
101 lines (87 loc) · 2.64 KB
/
Copy pathexample.html
File metadata and controls
101 lines (87 loc) · 2.64 KB
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>
<title>Tock</title>
<scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<scriptsrc="tock.min.js"></script>
<style>
#laptimes {
border:1px solid #ddd;
padding:10px;
width:200px;
}
</style>
<script>
window.onload=function(){
vartimer=newTock({
callback: function(){
$('#clockface').val(timer.msToTime(timer.lap()));
}
});
$('#start').on('click',function(){
timer.start();
});
$('#lap').on('click',function(){
$('#laptimes').append(timer.msToTime(timer.lap())+'<br>');
});
$('#stop').on('click',function(){
timer.stop();
});
$('#reset').on('click',function(){
timer.reset();
$('#clockface').val('');
$('#laptimes').html('');
});
varcountdown=newTock({
countdown: true,
interval: 251,
callback: function(){
$('#countdown_clock').val(timer.msToTime(countdown.lap()));
},
complete: function(){
alert("Time's up!");
}
});
$('#startCountdown').on('click',function(){
countdown.start(countdown.timeToMS($('#countdown_clock').val()));
});
$('#stopCountdown').on('click',function(){
countdown.stop();
});
$('#resetCountdown').on('click',function(){
countdown.reset();
});
}
</script>
</head>
<body>
<h1>Tock</h1>
<p>
by <ahref="http://github.com/mrchimp/tock">Mr Chimp</a>
</p>
<section>
<h2>Timer</h2>
<p>
<buttonid="start">Start</button>
<buttonid="lap">Lap</button>
<buttonid="stop">Stop</button>
<buttonid="reset">Reset</button>
</p>
<p>
<inputid="clockface" placeholder="00:00:00">
</p>
<p>
<divid="laptimes"></div>
</p>
</section>
<section>
<h2>Countdown</h2>
<p>
<buttonid="startCountdown">Start</button>
<buttonid="stopCountdown">Stop</button>
<buttonid="resetCountdown">Reset</button>
<inputid="countdown_clock" placeholder="00:00" value="10:00">
</p>
</section>
</body>
</html>