-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtwittoloid-client.html
52 lines (49 loc) · 1.98 KB
/
twittoloid-client.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head>
<meta charset="utf-8">
<title>Twittoloid</title>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="http://localhost:8080/socket.io/socket.io.js"></script>
<link rel="stylesheet" type="text/css" media="screen"
href="twittoloid.css" />
<script>
$(document).ready(function() {
var socket = io.connect('http://localhost:8080');
$('#startsearchbutton').click(function() {
var keyword = $('#searchfor').val();
socket.emit('searchfor', keyword);
});
socket.on("tweet-with-links", function(json) {
data = json;
$('<li class="tweet-with-links"><img class="avatar" src="'
+ data.user.profile_image_url_https
+ '"><p class="tweetdata"><span class="user">@'
+ data.user.screen_name
+ '</span><br/><span class="tweet">'
+ data.text
+'</span></p><span class="debug">'
+ data.urls[0].expanded_url
+'</span></li>').prependTo("ul");
});
socket.on("tweet-without-links", function(json) {
data = json;
$('<li class="tweet-without-links"><img class="avatar" src="'
+ data.user.profile_image_url_https
+ '"><p class="tweetdata"><span class="user">@'
+ data.user.screen_name
+ '</span><br/><span class="tweet">'
+ data.text
+'</span></p><span class="debug"></span></li>').prependTo("ul");
});
});
</script>
</head>
<body>
<h1>Twittoloid stream</h1>
<p>
<input type="text" id="searchfor"/>
<input type="button" value="find links" id="startsearchbutton"/>
</p>
<ul></ul>
</body>
</html>