-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
199 lines (184 loc) · 8.81 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
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
<!DOCTYPE html>
<html>
<head>
<title>XMPP Client Strophe</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-wip/css/bootstrap.min.css">
<link rel="stylesheet" href="css/client.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-wip/js/bootstrap.min.js"></script>
<script src='js/strophe.js'></script>
<script type="text/javascript" src="js/strophe.pubsub.min.js"></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/knockout/2.3.0/knockout-min.js'></script>
<script src='js/xmpp_client.js'></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Strophe XMPP Chat Client</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Login</a></li>
<li><a href="#about">Contacts</a></li>
<li><a href="#contact">Message</a></li>
<li><a href="#contact">PubSub-Publish</a></li>
<li><a href="#contact">PubSub-Subscribe</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div class="login-box panel customBorder">
<div class="panel-heading pHead">Login</div>
<div class="panel-body">
<div class="input-group">
<span class="input-group-addon">UserName:</span>
<input type="text" class="form-control" placeholder="JID" id='jid' data-bind="value:jid">
<span class="input-group-addon">Password:</span>
<input type='password' class="form-control" placeholder="" id='pass' data-bind="value:password">
<span class="input-group-addon">Priority:</span>
<input type="text" class="form-control" placeholder="-10,0,10" default="0" id="priority" >
</div>
<input type="button" class="btn btn-default " data-bind="click: connect" id='connect' value="Connect" />
<div data-bind="style: {color: connectText() == 'Connected!' ? 'green' : 'black'}">
<div class="" data-bind="visible: connecting" id="connecting">
<div data-bind="text:connectText"></div>
</div>
</div>
</div>
</div>
<div class="login-box panel customBorder" >
<div class="panel-heading pHead">Contacts</div>
<div class="panel-body" data-bind="visible: connecting">
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
<th>JID</th>
<th>Online/Offline</th>
</tr>
</thead>
<tbody data-bind='foreach: contacts'>
<tr data-bind="style:{color: status() == 'Offline' ? 'black' : 'green'}">
<td data-bind="text: name"></td>
<td data-bind="text:jid"></td>
<td data-bind="text:status"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="login-box panel customBorder">
<div class="panel-heading pHead" >Message</div>
<div class="panel-body" data-bind="visible: connecting">
<h3 class="pInnerHead">Send a Message</h3>
<div class="input-group">
<span class="input-group-addon">Message</span>
<input type="text" class="form-control" placeholder="Username" data-bind="value:sendUsername" >
<textarea type="text" class="form-control" placeholder="Message here..." rows="4" data-bind="value:sendMessageText"></textarea>
</div>
<button type="button" class="btn btn-default" id="sendButton" data-bind="click:sendMessage">Send</button>
<div data-bind="visible:firstMessageSent">
<h3 class="pInnerHead">Messages Sent</h3>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>To</th>
<th>Message</th>
</tr>
</thead>
<tbody data-bind='foreach: sentMessages'>
<tr>
<td data-bind="text: to"></td>
<td data-bind="text:message"></td>
</tr>
</tbody>
</table>
</div>
<div data-bind="visible:firstMessageReceived">
<h3 class="pInnerHead">Messages Received</h3>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>From</th>
<th>Message</th>
</tr>
</thead>
<tbody data-bind='foreach: receivedMessages'>
<tr>
<td data-bind="text: from"></td>
<td data-bind="text: body"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="login-box panel customBorder">
<div class="panel-heading pHead">Publish Subscribe</div>
<div class="panel-body" data-bind="visible: connecting">
<h3 class="pInnerHead">Publish A Message to All Subscribers</h3>
<div class="input-group">
<span class="input-group-addon">Node Name</span>
<input type="text" class="form-control" placeholder="Node" data-bind="value: publishNode">
<!--<span class="input-group-addon">Message</span>-->
<!--<textarea type="text" class="form-control" placeholder="Message here..." rows="4" data-bind="value: publishText"></textarea>-->
</div>
<div class="input-group" data-bind="visible:nodeCreated" id="nodeMessage">
<span class="input-group-addon">Message</span>
<textarea type="text" class="form-control" placeholder="Message here..." rows="4" data-bind="value: publishText"></textarea>
</div>
<!--<button type="button" class="btn btn-default" id="logInButton" data-bind="click:publishMessage">Publish</button>-->
<input type="button" class="btn btn-default " data-bind="click:publishMessage,value:pubButton" id="logInButton" />
<div data-bind="visible:nodeCreated">
<h3 class="pInnerHead">PubSub Messages Sent</h3>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Publisher</th>
<th>Message</th>
</tr>
</thead>
<tbody data-bind='foreach: publishedMessage'>
<tr>
<td data-bind="text: from"></td>
<td data-bind="text: body"></td>
</tr>
</tbody>
</table>
</div>
<div class="input-group sub" id="subscribe">
<span class="input-group-addon">Subscribe</span>
<input type="text" class="form-control" placeholder="Node" data-bind="value:subscribeNode">
</div>
<button type="button" class="btn btn-default" id="subscribeButton" data-bind="click:pubSubscribe">Subscribe</button>
<div data-bind="visible: clientSubscribed">
<h3 class="pInnerHead">PubSub Messages Received</h3>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Subscription</th>
<th>Message</th>
</tr>
</thead>
<tbody data-bind='foreach: subscribedMessages'>
<tr>
<td data-bind="text: from"></td>
<td data-bind="text: body"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>Project Page:<a href="https://github.com/ramonrovirosa/xmpp_client_strophejs">XMPP Client Strophe.js</a></div>
</div><!-- /.container -->
</body>
</html>