Debian Codegraph @

example/index.html

raw
1 <!DOCTYPE HTML>
2 <html>
3
4 <head>
5 <title>JSXC example application</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <meta name="viewport" content="width=device-width, initial-scale=1">
8 <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
9
10 <link href="css/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" />
11
12 <!-- require:dependencies -->
13 <link href="css/jquery-ui.min.css" media="all" rel="stylesheet" type="text/css" />
14 <link href="../build/css/jsxc.css" media="all" rel="stylesheet" type="text/css" />
15 <!-- endrequire -->
16
17 <link href="css/example.css" media="all" rel="stylesheet" type="text/css" />
18
19 <!-- require:dependencies -->
20 <script src="js/jquery.min.js"></script>
21 <script src="js/jquery-ui.min.js"></script>
22 <script src="../build/lib/jquery.slimscroll.js"></script>
23 <script src="../build/lib/jquery.fullscreen.js"></script>
24 <script src="../build/lib/jsxc.dep.js"></script>
25 <!-- endrequire -->
26
27 <script src="js/bootstrap.min.js"></script>
28
29 <!-- jsxc library -->
30 <script src="../build/jsxc.min.js"></script>
31
32 <!-- init script -->
33 <script src="js/example.js"></script>
34
35 </head>
36
37 <body>
38 <div class="container" id="content" role="main">
39
40 <div class="row">
41 <div class="col-xs-12">
42 <h1 class="page-header">JSXC <small>example</small></h1>
43
44 <div class="row">
45 <div class="col-md-6">
46 <p>This example demonstrates different types of login methods for <a href="https://www.jsxc.org/">JSXC</a>. You find further information in our <a href="https://github.com/jsxc/jsxc/wiki">wiki</a>.</p>
47
48 <p class="jsxc-org">You can use demo1 to demo5 with password demo to test JSXC (XMPP domain: jsxc.org, BOSH url: /http-bind/).</p>
49 </div>
50
51 <div class="form form-horizontal col-md-6">
52 <div class="form-group">
53 <label for="xmpp-domain" class="col-xs-4 control-label">XMPP domain:</label>
54 <div class="col-xs-8">
55 <input type="text" id="xmpp-domain" name="xmpp-domain" class="form-control" value="localhost" />
56 </div>
57 </div>
58 <div class="form-group">
59 <label for="bosh-url" class="col-xs-4 control-label">BOSH url:</label>
60 <div class="col-xs-8">
61 <input type="text" id="bosh-url" name="bosh-url" class="form-control" value="/http-bind/" />
62 <p id="server-flash"></p>
63 </div>
64 </div>
65 </div>
66 </div>
67 </div>
68 </div>
69
70 <div class="row">
71
72 <div class="col-xs-12 col-md-4">
73 <h3>Dual-Login</h3>
74
75 <p>You should use this method if you have already a login in your website.</p>
76
77 <form id="form" method="post" action="login.html" class="form form-horizontal">
78 <fieldset>
79 <div class="form-group">
80 <label for="username" class="col-xs-4 control-label">Username:</label>
81 <div class="col-xs-8">
82 <input type="text" id="username" name="username" class="form-control" />
83 </div>
84 </div>
85
86 <div class="form-group">
87 <label for="password" class="col-xs-4 control-label">Password:</label>
88 <div class="col-xs-8">
89 <input type="password" id="password" name="password" class="form-control" />
90 </div>
91 </div>
92
93 <div class="form-group">
94 <div class="col-xs-offset-4 col-xs-8">
95 <button type="submit" class="submit btn btn-primary">Log in chat and submit</button>
96 <button class="logout btn btn-default" style="display:none;">Log out</button>
97 </div>
98 </div>
99
100 </fieldset>
101 </form>
102
103 <pre>&lt;form id="form"&gt;
104 &lt;input type="text" id="username" /&gt;
105 &lt;input type="password" id="password" /&gt;
106 &lt;input type="submit" value="Submit" /&gt;
107 &lt;/form&gt;
108
109 &lt;button id="logout"&gt;Logout&lt;/button&gt;</pre>
110
111 <pre>jsxc.init({
112 loginForm: {
113 form: '#form',
114 jid: '#username',
115 pass: '#password'
116 },
117 logoutElement: $('#logout'),
118 loadSettings: function() {
119 return xmpp: {
120 url: '/http-bind/',
121 domain: 'localhost',
122 resource: 'example',
123 overwrite: true,
124 onlogin: true
125 };
126 },
127 root: '/jsxc/'
128 });</pre>
129
130 </div>
131
132 <div class="col-xs-12 col-md-4">
133 <h3>AJAX Login</h3>
134
135 <p>Do you want to login directly within your script? Choose this type.
136
137 <form id="form2" class="form form-horizontal">
138 <fieldset>
139 <div class="alert alert-warning col-xs-12" role="alert">
140 <strong>Warning!</strong> Your username or password is wrong!
141 </div>
142
143 <div class="form-group">
144 <label for="username2" class="col-xs-4 control-label">Username:</label>
145 <div class="col-xs-8">
146 <input type="text" id="username2" class="form-control" />
147 </div>
148 </div>
149
150 <div class="form-group">
151 <label for="password2" class="col-xs-4 control-label">Password:</label>
152 <div class="col-xs-8">
153 <input type="password" id="password2" class="form-control" />
154 </div>
155 </div>
156
157 <div class="form-group">
158 <div class="col-xs-offset-4 col-xs-8">
159 <button type="submit" id="submit2" class="submit btn btn-primary" data-loading-text="Logging in...">Log in chat</button>
160 <button class="logout btn btn-default">Log out</button>
161 </div>
162 </div>
163 </fieldset>
164 </form>
165
166 <pre>&lt;input type="text" id="username" /&gt;
167 &lt;input type="password" id="password" /&gt;
168 &lt;button id="submit"&gt;Log in&lt;/button&gt;</pre>
169
170 <pre>jsxc.init({
171 xmpp: {
172 url: '/http-bind/'
173 },
174 root: '/jsxc/'
175 });
176
177 $('#submit').click(function(){
178 var username = $('#username').val();
179 var password = $('#password').val();
180
181 var jid = username + '@localhost';
182
183 jsxc.start(jid , password);
184 });
185 </pre>
186 </div>
187
188 <div class="col-xs-12 col-md-4">
189 <h3>Box Login</h3>
190
191 <p>Do you look for a discrete login method? Choose this.</p>
192
193 <div class="form" id="form3">
194 <button class="submit btn btn-primary">Open Box</button>
195 <button class="logout btn btn-default">Log out</button>
196 </div>
197
198 <pre>&lt;button id="button"&gt;Open Box&lt;/button&gt;</pre>
199
200 <pre>jsxc.init({
201 loadSettings: function() {
202 return xmpp: {
203 url: '/http-bind/',
204 domain: 'localhost',
205 resource: 'example',
206 overwrite: true,
207 onlogin: true
208 };
209 },
210 root: '/jsxc/'
211 });
212
213 $('#button').click(jsxc.gui.showLoginBox);</pre>
214 </div>
215
216 </div>
217
218 <div class="row">
219 <div class="col-xs-12 col-md-4">
220 <h3>Prelogin</h3>
221
222 <p>Attach to existing BOSH connection. Helpful if you login server side.</p>
223
224 <pre>jsxc.init({
225 xmpp: {
226 url: '/http-bind/',
227 jid: 'username@localhost',
228 sid: 'SID',
229 rid: 'RID'
230 },
231 root: '/jsxc/'
232 });</pre>
233 </div>
234
235 <div class="col-xs-12 col-md-4">
236 <h3>AJAX Prelogin</h3>
237
238 <p>Attach to existing BOSH connection after JSXC was initialized.</p>
239
240 <pre>jsxc.init({
241 xmpp: {
242 url: '/http-bind/'
243 },
244 root: '/jsxc/'
245 });
246
247 function callback() {
248 jsxc.start('username@localhost', 'SID', 'RID');
249 }</pre>
250 </div>
251 </div>
252 </div>
253 </body>
254
255 </html>