2013-09-05 19:53:23 -04:00
|
|
|
$('#loginbox form').on('submit', function (e) {
|
|
|
|
var jid = $('#jid').val();
|
|
|
|
var password = $('#password').val();
|
2014-02-18 23:44:15 -05:00
|
|
|
var connURL = $('#connURL').val();
|
|
|
|
|
2014-02-24 16:54:08 -05:00
|
|
|
var transport;
|
2014-02-18 23:44:15 -05:00
|
|
|
var wsURL = '';
|
|
|
|
var boshURL = '';
|
2014-02-24 16:54:08 -05:00
|
|
|
if (connURL.indexOf('http') === 0) {
|
2014-02-18 23:44:15 -05:00
|
|
|
boshURL = connURL;
|
2014-02-24 16:54:08 -05:00
|
|
|
transport = 'bosh';
|
2014-02-26 16:27:33 -05:00
|
|
|
} else if (connURL.indexOf('ws') === 0) {
|
2014-02-26 15:46:51 -05:00
|
|
|
wsURL = connURL;
|
2014-02-24 16:54:08 -05:00
|
|
|
transport = 'websocket';
|
2014-02-18 23:44:15 -05:00
|
|
|
}
|
2013-09-05 19:53:23 -04:00
|
|
|
|
|
|
|
localStorage.config = JSON.stringify({
|
|
|
|
jid: jid,
|
|
|
|
server: jid.slice(jid.indexOf('@') + 1),
|
|
|
|
wsURL: wsURL,
|
2014-02-18 23:44:15 -05:00
|
|
|
boshURL: boshURL,
|
2014-02-24 16:54:08 -05:00
|
|
|
transport: transport,
|
2013-09-05 19:53:23 -04:00
|
|
|
credentials: {
|
|
|
|
password: password
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
window.location = '/';
|
2014-02-18 23:44:15 -05:00
|
|
|
|
2013-09-05 19:53:23 -04:00
|
|
|
e.preventDefault();
|
|
|
|
return false;
|
|
|
|
});
|