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
|
/* global jsxc, oc_appswebroots, OC, $ */
/**
* Make room for the roster inside the owncloud template.
*
* @param {type} event
* @param {type} state State in which the roster is
* @param {type} duration Time the roster needs to move
* @returns {undefined}
*/
function onRosterToggle(event, state, duration) {
"use strict";
var wrapper = $('#content-wrapper');
var control = $('#controls');
var roster_width = (state === 'shown') ? $('#jsxc_roster').outerWidth() : 0;
var navigation_width = $('#navigation').width();
wrapper.animate({
paddingRight: (roster_width) + 'px'
}, duration);
control.animate({
paddingRight: (roster_width + navigation_width) + 'px'
}, duration);
}
/**
* Init owncloud template for roster.
*
* @returns {undefined}
*/
function onRosterReady() {
"use strict";
var roster_width = $('#jsxc_roster').outerWidth();
var navigation_width = $('#navigation').width();
var roster_right = parseFloat($('#jsxc_roster').css('right'));
$('#content-wrapper').css('paddingRight', roster_width + roster_right);
$('#controls').css('paddingRight', roster_width + navigation_width + roster_right);
}
// initialization
$(function() {
"use strict";
$(document).on('ready.roster.jsxc', onRosterReady);
$(document).on('toggle.roster.jsxc', onRosterToggle);
jsxc.log = "";
jsxc.tmp = null;
jsxc.init({
loginForm: {
form: '#body-login form',
jid: '#user',
pass: '#password',
preJid: function(jid) {
var data = null;
$.ajax(OC.filePath('ojsxc', 'ajax', 'getsettings.php'), {
async: false,
success: function(d) {
data = d;
}
});
var resource = (data.xmppResource) ? '/' + data.xmppResource : '';
var domain = data.xmppDomain;
jsxc.storage.setItem('boshUrl', data.boshUrl);
if (jid.match(/@(.*)$/)) {
return (jid.match(/\/(.*)$/)) ? jid : jid + resource;
}
return jid + '@' + domain + resource;
}
},
logoutElement: $('#logout'),
checkFlash: false,
debug: function(msg, data) {
if (data) {
console.log(msg, data);
jsxc.log = jsxc.log + msg + ' >> ' + $("<span>").prepend(data).html() + '\n';
} else {
console.log(msg);
jsxc.log = jsxc.log + msg + '\n';
}
},
rosterAppend: 'body',
root: oc_appswebroots.ojsxc,
// @TODO: don't include get turn credentials routine into jsxc
turnCredentialsPath: OC.filePath('ojsxc', 'ajax', 'getturncredentials.php'),
displayRosterMinimized: function() {
return OC.currentUser != null;
},
otr: {
SEND_WHITESPACE_TAG: true,
WHITESPACE_START_AKE: true
}
});
// Add submit link without chat functionality
if (jsxc.el_exists($('#body-login form'))) {
var link = $('<a/>').text('Log in without chat').attr('href', '#').click(function() {
jsxc.submitLoginForm();
});
var alt = $('<p id="jsxc_alt"/>').append(link);
$('#body-login form fieldset').append(alt);
}
});
|