-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.htm
98 lines (83 loc) · 2.28 KB
/
index.htm
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
<html>
<head>
<script src="/scripts/jquery-1.7.1.min"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="/scripts/system"></script>
<script src="/scripts/pomodoro"></script>
<link rel="stylesheet" href="/styles/bootstrap.min">
<script>
var host = document.location.origin;
var socket = io.connect(host);
var id = null;
var pom = new pomodoro();
var refresh = function() {
var remaining = pom.remaining();
var seconds = remaining.seconds < 10 ? "0" : "";
seconds += remaining.seconds;
$('#timeremaining').text(remaining.minutes + ':' + seconds);
}
socket.on('started', function (data) {
pom.start(data.duration);
id = setInterval( refresh, 1000 );
});
socket.on('remaining', function (data) {
$("#timeremaining").html(data.duration + ":00");
});
socket.on('done', function (data) {
if(id != null)
clearInterval(id);
$("#timeremaining").html("done");
});
$( function() {
$("#start").click( function() {
socket.emit('start');
});
});
</script>
</head>
<body>
<div class="topbar">
<div class="topbar-inner">
<div class="container"><h3><a href="/">Pomradery</a></h3></div>
</div>
</div>
<div class="container">
<header>
<div class="page-header"><h1>Pomradery</h1></div>
</header>
<div class="content">
<div class="row">
<div>
<form id="join" style="visibility: hidden">
<fieldset>
<legend>Join</legend>
<div class="clearfix">
<div class="input">
<input id="username" name="username" type="text" style="height: 28" placeholder="your name">
</div>
</div>
<div class="actions">
<input type="submit" class="btn primary disabled" disabled value="Join">
</div>
</fieldset>
</form>
</div>
</div>
<div class="row">
<div>
<form>
<fieldset>
<div class="clearfix">
<legend id="timeremaining"> </legend>
</div>
<div class="actions">
<input type="button" class="btn primary" id="start" href="#" value="Start">
</div>
</fieldset>
</form>
</div>
</div> <!-- end row -->
</div> <!-- end content -->
</div> <!-- end container -->
</body>
</html>