-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.html
47 lines (34 loc) · 1.51 KB
/
example.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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Twitter Handlebars</title>
</head>
<body>
<div id="twitterfeed"><!-- --></div>
<div id="twitterhash"><!-- --></div>
<!-- libs -->
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
<!-- Backbone API: Twitter -->
<script type="text/javascript" src="backbone.api.twitter.js"></script>
<!-- template -->
<script id="twitter-hash" type="text/x-handlebars-template">
{{#items}}
<p><img src="{{profile_image_url}}" alt="{{from_user_name}}"><strong>{{from_user_name}}</strong>{{text}}<span class='date'> {{created_at}}</span></p>
{{/items}}
</script>
<!-- init -->
<script type="text/javascript">
$(document).ready( function() {
var template = $(this.el).find("#twitter-hash").html()
var data = new Twitter.Collections.User({user:"tracend", num: 15});
var view = new Twitter.Views.Stream({el: "#twitterfeed", model: data, template: template });
var data1 = new Twitter.Collections.Hash({query:"%23AlphasOnSyfy", num: 15});
var view1 = new Twitter.Views.Stream({el: "#twitterhash", model: data1, template: template });
});
</script>
</body>
</html>