This repository has been archived by the owner on Jul 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
44 lines (41 loc) · 1.46 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
<html>
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
</head>
<body>
<div style="text-align:center;width:100%;height:100%;">
<h1>Da Bell</h1>
<a href="#" id="test-bell">
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Alexander_Graham_Bell.jpg/220px-Alexander_Graham_Bell.jpg"/><br />
(click to test)</a>
</div>
<audio id="sound-default">
<source src="/sounds/horn.mp3" type="audio/mp3" preload="auto"/>
</audio>
<audio id="sound-highfive">
<source src="/sounds/high5.wav" type="audio/wav" preload="auto"/>
</audio>
<script>
var ring = function(type) {
if (type === undefined) {
type = 'default';
}
var sound = $("#sound-"+type)[0];
if (sound != undefined) {
sound.load();
sound.play();
} else {
console.log('No sound found with type: '+type);
}
}
var socket = io.connect('/');
socket.on('ring', function (data) {
ring(data.type);
});
$('#test-bell').on('click', function() {
ring();
});
</script>
</body>
</html>