-
Notifications
You must be signed in to change notification settings - Fork 2
/
chat.html
206 lines (192 loc) · 8.34 KB
/
chat.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<template name="chat">
{{> messages}}
{{#if object}}
{{#with object}}
{{> puzzle_summon_modal}}
{{/with}}
<div class="bb-chat-callin {{#if solved}}solved{{/if}}">
{{#if solved}}Solved
{{else}}
{{#with object}}
{{> puzzle_summon_button}}
{{/with}}
{{/if}}
</div>
{{/if}}
<div class="navbar navbar-inverse navbar-fixed-bottom bb-chat-footer">
<div class="navbar-inner">
{{> messages_input}}
</div>
</div>
</template>
<template name="embedded_chat">
<div class="bb-message-container">
{{> messages }}
</div>
<div class="bb-chat-input bb-chat-footer">
{{> messages_input }}
</div>
</template>
<template name="chat_header">
<div class="navbar-text bb-chat-presence">
<span class="label label-inverse">
Hunters present ({{whos_here.count}}):
</span>
<span class="comma-list">
{{#each whos_here}}{{> nick_presence }}{{/each}}
</span>
</div>
</template>
<template name="messages_input">
{{#if mynick}}
<form id="messageForm" class="navbar-form">
<textarea id="messageInput" class="input-block-level" rows="1"
placeholder="Type your message and press enter..."
autocomplete="off" ></textarea>
</form>
{{/if}}
</template>
<template name="message_delete_button">
<div class="bb-delete-message"></div>
</template>
<template name="starred_messages">
{{#if messages.count}}
<div class="bb-chat-messages bb-starred-messages {{#if canModify}}can-modify-star{{/if}}">
<h3>Starred Messages</h3>
{{#each messages}}
{{> media_message }}
{{/each}}
</div>
{{/if}}
</template>
<template name="media_message">
<div class="bb-message media{{#if message.to}} bb-message-pm{{/if}}{{#if message.mail}} bb-message-mail{{/if}}{{#if message.tweet}} bb-message-tweet{{/if}}{{#if message.starred}} starred{{/if}}"
data-nick="{{message.nick}}" data-pm-to="{{message.to}}" data-read="{{#unless read}}un{{/unless}}read">
{{#if message.tweet}}
<img src="{{message.tweet.avatar}}" class="media-object pull-left img-rounded" width=48 height=48>
{{else if message.mail}}
<!-- {{gravatar id=message.nick image="wavatar" size=48 classes="media-object pull-left img-rounded" }} -->
{{else}}
<!-- {{gravatar id=email image="wavatar" size=48 classes="media-object pull-left img-rounded" }} -->
{{/if}}
<div class="media-body bb-message-body bb-message-not-from-me">
<div class="pull-right timestamp">{{pretty_ts message.timestamp}}</div>
{{#unless message.to}}
{{! can't star a PM. }}
<!-- <div class="bb-message-star"></div> -->
{{/unless}}
<!-- {{> message_delete_button}} -->
<h5 class="media-heading">
{{#if message.tweet}}
<i class="fab fa-twitter"></i> @<a href="https://twitter.com/{{message.nick}}" target="_blank">{{message.nick}}</a> <a href="https://twitter.com/{{message.nick}}/status/{{message.tweet.id_str}}" target="_blank">tweeted</a>:
{{else if message.mail}}
Mail from {{#with message.mail.sender_name}}{{this}}{{else}}{{message.nick}}{{/with}} <i class="fas fa-envelope"></i> {{message.mail.subject}}
{{else}}
<span title="{{message.nick}}">{{nickOrName message.nick}}</span>
{{#if message.to}}
<small>(Private message to {{nickOrName message.to}})</small>
{{/if}}
{{/if}}
</h5>
{{cleanup message.body}}
{{#if message.tweet.quote}}
<h6>in reply to @<a href="https://twitter.com/{{message.tweet.quote_nick}}" target="_blank">{{message.tweet.quote_nick}}</a>'s <a href="https://twitter.com/{{message.tweet.quote_nick}}/status/{{message.tweet.quote_id_str}}" target="_blank">tweet</a>:</h6>
<blockquote>{{cleanup message.tweet.quote}}</blockquote>
{{/if}}
{{#if message.poll}}{{> poll message.poll}}{{/if}}
</div>
</div>
</template>
<template name="media_message_from_me">
<div class="bb-message media{{#if message.to}} bb-message-pm{{/if}}{{#if message.mail}} bb-message-mail{{/if}}{{#if message.tweet}} bb-message-tweet{{/if}}{{#if message.starred}} starred{{/if}}"
data-nick="{{message.nick}}" data-pm-to="{{message.to}}" data-read="{{#unless read}}un{{/unless}}read">
{{#if message.tweet}}
<img src="{{message.tweet.avatar}}" class="media-object pull-left img-rounded" width=48 height=48>
{{else if message.mail}}
{{else}}
{{/if}}
<div class="media-body bb-message-body bb-message-from-me">
<div class="pull-right timestamp">{{pretty_ts message.timestamp}}</div>
{{#unless message.to}}
{{! can't star a PM. }}
{{/unless}}
{{> message_delete_button}}
<h5 class="media-heading">
{{#if message.tweet}}
<i class="fab fa-twitter"></i> @<a href="https://twitter.com/{{message.nick}}" target="_blank">{{message.nick}}</a> <a href="https://twitter.com/{{message.nick}}/status/{{message.tweet.id_str}}" target="_blank">tweeted</a>:
{{else if message.mail}}
Mail from {{#with message.mail.sender_name}}{{this}}{{else}}{{message.nick}}{{/with}} <i class="fas fa-envelope"></i> {{message.mail.subject}}
{{else}}
<span title="{{message.nick}}">{{nickOrName message.nick}}</span>
{{#if message.to}}
<small>(Private message to {{nickOrName message.to}})</small>
{{/if}}
{{/if}}
</h5>
{{cleanup message.body}}
{{#if message.tweet.quote}}
<h6>in reply to @<a href="https://twitter.com/{{message.tweet.quote_nick}}" target="_blank">{{message.tweet.quote_nick}}</a>'s <a href="https://twitter.com/{{message.tweet.quote_nick}}/status/{{message.tweet.quote_id_str}}" target="_blank">tweet</a>:</h6>
<blockquote>{{cleanup message.tweet.quote}}</blockquote>
{{/if}}
{{#if message.poll}}{{> poll message.poll}}{{/if}}
</div>
</div>
</template>
<template name="poll">
<table class="poll">
<tbody>
{{#each options}}
<tr>
<td class="option"><button class="btn btn-mini {{#if yours}}active{{/if}}" data-option="{{_id}}">{{text}}</button></td>
<td class="results">
{{#if show_votes}}
{{#each votes}}{{gravatar id=email image="wavatar" size=20 title=(nickOrName _id)}}{{/each}}
{{else}}
<div class="progress"><div class="bar {{#if leading}}bar-success{{/if}}" style="width: {{width}}%">{{votes.length}}</div></div>
{{/if}}
</td>
</tr>
{{/each}}
</tbody>
</table>
<button class="btn btn-link btn-small toggle-votes">{{#if show_votes}}Hide{{else}}Show{{/if}} Votes</button>
</template>
<template name="messages">
<div id="messages" class="row-fluid bb-chat-messages {{#if mynick}}can-modify-star{{/if}}">
{{#if ready}}
{{#if startOfChannel}}
<button disabled="" class="btn btn-small btn-block btn-info bb-chat-start">No earlier messages</button>
{{else}}
<button class="btn btn-small btn-info btn-block bb-chat-load-more">Load more messages</button>
{{/if}}
{{else}}
<button class="btn btn-small btn-info btn-block active bb-chat-loading">Loading <i class="fas fa-spin fa-spinner"></i></button>
{{/if}}
{{#each messages}}{{scrollHack}}
{{#if message.dawn_of_time}}<!-- Channel creation -->
{{else if fromMe message}}
{{#if message.action}}
<div class="bb-message-action" data-nick="{{message.nick}}" data-read="{{#unless read}}un{{/unless}}read">
<div class="pull-right timestamp">{{pretty_ts message.timestamp}}</div>
{{> message_delete_button}}
<span title="{{message.nick}}">{{nickOrName message.nick}}</span> {{cleanup message.body}}
</div>
{{else}}
{{> media_message_from_me }}
{{/if}}
{{else}}
{{#if message.action}}
<div class="bb-message-action" data-nick="{{message.nick}}" data-read="{{#unless read}}un{{/unless}}read">
<div class="pull-right timestamp">{{pretty_ts message.timestamp}}</div>
{{> message_delete_button}}
<span title="{{message.nick}}">{{nickOrName message.nick}}</span> {{cleanup message.body}}
</div>
{{else}}
{{> media_message }}
{{/if}}
{{/if}}
{{/each}}
{{! Ensure there's always a small "last-child" here to scroll to.}}
<p id="chat-bottom" data-read="unread"></p>
</div>
</template>