forked from jbinary/jslix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
82 lines (81 loc) · 3.88 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
<!doctype html>
<html>
<head>
<title></title>
<script src="libs/require.js"></script>
<script src="require-config.js"></script>
<script>
require(['jslix/client', 'jslix/disco', 'jslix/caps', 'jslix/version',
'jslix/stanzas', 'libs/jquery', 'jslix/sasl.mechanisms.plain',
'jslix/sasl.mechanisms.digest_md5', 'jslix/sasl.mechanisms.anonymous',
'jslix/connection.transports.websocket', 'jslix/connection.transports.bosh'],
function(Client, Disco, Caps, Version, stanzas, $){
$(function(){
$(document).on('submit', '#loginForm', function(evt){
evt.preventDefault();
var options = {
bosh_uri: this.bosh_uri.value,
websocket_uri: this.websocket_uri.value,
jid: this.jid.value,
password: this.password.value,
register: this.register.checked
},
client = new Client(options);
client.connect().done(function(){
var disco_plugin = client.registerPlugin(Disco),
plugins_options = {
'disco_plugin': disco_plugin,
'storage': sessionStorage,
'name': 'jslix',
'version': 'beta'
};
disco_plugin.registerIdentity('client', 'web', 'jslix');
client.registerPlugin(Version, plugins_options).init();
disco_plugin.init();
client.registerPlugin(Caps, plugins_options);
client.send(stanzas.PresenceStanza.create());
});
window.client = client;
});
});
});
</script>
</head>
<body>
<div id="login_pane">
<form id="loginForm" action="" method="post">
<table>
<tr>
<th><label for="bosh_uri">BOSH URI</label></th><td>
<input type="text" name="bosh_uri" id="bosh_uri" tabindex="1" value=""/>
</td>
</tr>
<tr>
<th><label for="websocket_uri">WebSocket URI</label></th><td>
<input type="text" name="websocket_uri" id="websocket_uri" tabindex="2" value=""/>
</td>
<tr>
<th><label for="jid">JID</label></th><td>
<input type="text" name="jid" id="jid" tabindex="3" value=""/>
</td>
</tr>
<tr>
<th><label for="password">Password</label></th><td>
<input type="password" name="password" id="password" tabindex="4" value=""/>
</td>
</tr>
<tr>
<th></th><td>
<input type="checkbox" name="register" id="register_checkbox" tabindex="5"/>
<label for="register_checkbox">Register new account</label></td>
</tr>
<tr>
<td> </td><td>
<input type="submit" value="Login" tabindex="6">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>