-
Notifications
You must be signed in to change notification settings - Fork 0
/
tweeter.html
125 lines (121 loc) · 4.84 KB
/
tweeter.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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<html>
<head>
<title>Firebase Reading Data Demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="nabar-header">
<a href="#" class="navbar-brand">Sui Sui Nian</a>
</div>
<ul class="nav navbar-nav">
<li><a href="/index.html">Home</a></li>
<li id="login"><a href="javascript:void(0)">Login</a></li>
<li id="logout"><a href="javascript:void(0)">Logout</a></li>
</ul>
</div>
</nav>
<!-- Markup -->
<div class="row">
<div class="col-xs-12">
<div class="page-header">
<h1>
<span>Tweeter</span>
<div id="user-select" style="float: right;"></div>
</h1>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div id="user-select"></div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div id="user-tweet-box" class="jumbotron"></div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<div id="user-timeline" style="padding: 2rem 0;"></div>
</div>
<div class="col-xs-12 col-md-6">
<div id="user-following" style="padding: 2rem 0;"></div>
</div>
</div>
<!-- Templates -->
<script type="text/template" id="user-select-template">
<div class="input-group">
<select class="form-control" class="users">
<option value="">Pick a user to impersonate</option>
<% _.each(users, function(user, key) {%>
<option value="<%= key %>">
<%= user.name %>
</option>
<% }); %>
</select>
</div>
</script>
<script type="text/template" id="user-timeline-template">
<h3>Timeline</h3>
<ul class="list-group">
<% if (timeline) { _.each(timeline, function(item) { %>
<li class="list-group-item">
<h4 class="list-group-item-heading">
<%= item.user.name %>
<small>@<%= item.user.username %></small>
<% if (item.user.key === userKey) {%>
<button class="btn btn-danger remove-tweet" tweet-key="<%= item.tweetKey %>" user-key="<%= userKey %>" style="float: right;">X</button>
<%}%>
</h4>
<p class="list-group-item-text">
<%= item.text %>
</p>
</li>
<% }); }%>
</ul>
<div style="text-align: center;">
<% if (loadMore) {%>
<button id="load-more" class="btn btn-primary">Load More</button>
<% } %>
<% if (orderByText) {%>
<button id="order-by-text" class="btn btn-primary">Order by Text</button>
<% } %>
<% if (reset) {%>
<button id="reset" class="btn btn-primary">Reset</button>
<% } %>
</div>
</script>
<script type="text/template" id="user-following-template">
<h3>Following</h3>
<ul class="list-group">
<% _.each(following, function(following) {%>
<li class="list-group-item">
<h4 class="list-group-item-heading"><%= following.name %> <small>@<%= following.username %></small></h4>
</li>
<% }); %>
</ul>
</script>
<script type="text/template" id="user-tweet-box-template">
<h3><%= user.name %> <small style="float:right;">Tweet Count: <%= user.tweetCount %></small></h3>
<form>
<div class="form-group">
<textarea id="tweet-box" class="form-control" placeholder="Tweet as <%= user.name %>"></textarea>
</div>
<div class="form-group">
<button id="tweet-button" class="btn btn-primary" disabled="disabled">Tweet</button>
<span id="tweet-length" style="margin-left: 1rem; color: gray;">140</span>
</div>
</form>
</script>
<!-- Dependencies -->
<script src="https://cdn.firebase.com/js/client/2.2.9/firebase.js"></script>
<script src="libs/jquery/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!-- Our Code -->
<script src="script.js"></script>
</body>
</html>