-
Notifications
You must be signed in to change notification settings - Fork 76
/
index.html
36 lines (34 loc) · 1.37 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
Quote Stream
</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js"></script>
<script type="text/javascript" src="http://localhost:4000/socket.io/socket.io.js"></script>
</head>
<script type="text/javascript">
'use strict';
$(document).ready(function() {
var ticker = location.hash.substr(1);
var socket = io.connect('http://localhost:4000'); // jshint ignore:line
socket.emit('ticker', ticker);
socket.on(ticker, function(response) {
var data = $('<pre>' + response + '</pre><hr />');
$('#quotes').append(data);
$('html, body').animate({ scrollTop: $(document).height() }, 100);
$(data).show('slide', { direction: 'up' }, 300);
$(data).effect('highlight', {}, 1500);
});
$(window).on('hashchange', function() {
var ticker = location.hash.substr(1);
socket.emit('ticker', ticker);
});
});
</script>
<body>
<div id="quotes"></div>
</body>
</html>