Remove the default_box_size setting.
Instead, get the height from how it's rendered in the browser (i.e. from CSS)
This commit is contained in:
parent
f3e2de9945
commit
a9c2b7d99f
41
converse.js
41
converse.js
@ -315,7 +315,6 @@
|
|||||||
csi_waiting_time: 0, // Support for XEP-0352. Seconds before client is considered idle and CSI is sent out.
|
csi_waiting_time: 0, // Support for XEP-0352. Seconds before client is considered idle and CSI is sent out.
|
||||||
debug: false,
|
debug: false,
|
||||||
domain_placeholder: __(" e.g. conversejs.org"), // Placeholder text shown in the domain input on the registration form
|
domain_placeholder: __(" e.g. conversejs.org"), // Placeholder text shown in the domain input on the registration form
|
||||||
default_box_height: 400, // The default height, in pixels, for the control box, chat boxes and chatrooms.
|
|
||||||
expose_rid_and_sid: false,
|
expose_rid_and_sid: false,
|
||||||
forward_messages: false,
|
forward_messages: false,
|
||||||
hide_muc_server: false,
|
hide_muc_server: false,
|
||||||
@ -356,7 +355,6 @@
|
|||||||
xhr_user_search_url: ''
|
xhr_user_search_url: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
_.extend(this, this.default_settings);
|
_.extend(this, this.default_settings);
|
||||||
// Allow only whitelisted configuration attributes to be overwritten
|
// Allow only whitelisted configuration attributes to be overwritten
|
||||||
_.extend(this, _.pick(settings, Object.keys(this.default_settings)));
|
_.extend(this, _.pick(settings, Object.keys(this.default_settings)));
|
||||||
@ -941,8 +939,9 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.ChatBox = Backbone.Model.extend({
|
this.ChatBox = Backbone.Model.extend({
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
var height = converse.applyHeightResistance(this.get('height'));
|
var height = this.get('height');
|
||||||
if (this.get('box_id') !== 'controlbox') {
|
if (this.get('box_id') !== 'controlbox') {
|
||||||
this.messages = new converse.Messages();
|
this.messages = new converse.Messages();
|
||||||
this.messages.browserStorage = new Backbone.BrowserStorage[converse.storage](
|
this.messages.browserStorage = new Backbone.BrowserStorage[converse.storage](
|
||||||
@ -952,7 +951,7 @@
|
|||||||
// and we listen for change:chat_state, so shouldn't set it to ACTIVE here.
|
// and we listen for change:chat_state, so shouldn't set it to ACTIVE here.
|
||||||
'chat_state': undefined,
|
'chat_state': undefined,
|
||||||
'box_id' : b64_sha1(this.get('jid')),
|
'box_id' : b64_sha1(this.get('jid')),
|
||||||
'height': height,
|
'height': height ? converse.applyHeightResistance(height) : undefined,
|
||||||
'minimized': this.get('minimized') || false,
|
'minimized': this.get('minimized') || false,
|
||||||
'num_unread': this.get('num_unread') || 0,
|
'num_unread': this.get('num_unread') || 0,
|
||||||
'otr_status': this.get('otr_status') || UNENCRYPTED,
|
'otr_status': this.get('otr_status') || UNENCRYPTED,
|
||||||
@ -963,7 +962,7 @@
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.set({
|
this.set({
|
||||||
'height': height,
|
'height': height ? converse.applyHeightResistance(height) : undefined,
|
||||||
'time_opened': moment(0).valueOf(),
|
'time_opened': moment(0).valueOf(),
|
||||||
'num_unread': this.get('num_unread') || 0
|
'num_unread': this.get('num_unread') || 0
|
||||||
});
|
});
|
||||||
@ -1238,6 +1237,9 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
if (typeof this.model.get('height') == 'undefined') {
|
||||||
|
this.model.set('height', this.$el.find('.box-flyout').height());
|
||||||
|
}
|
||||||
this.$content = this.$el.find('.chat-content');
|
this.$content = this.$el.find('.chat-content');
|
||||||
this.renderToolbar().renderAvatar();
|
this.renderToolbar().renderAvatar();
|
||||||
this.$content.on('scroll', _.debounce(this.onScroll.bind(this), 100));
|
this.$content.on('scroll', _.debounce(this.onScroll.bind(this), 100));
|
||||||
@ -1312,7 +1314,15 @@
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initHeight: function () {
|
||||||
|
if (typeof this.model.get('height') == 'undefined') {
|
||||||
|
this.model.set('height', this.$el.find('.box-flyout').height());
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
initDragResize: function () {
|
initDragResize: function () {
|
||||||
|
this.initHeight();
|
||||||
this.prev_pageY = 0; // To store last known mouse position
|
this.prev_pageY = 0; // To store last known mouse position
|
||||||
if (converse.connection.connected) {
|
if (converse.connection.connected) {
|
||||||
this.height = this.model.get('height');
|
this.height = this.model.get('height');
|
||||||
@ -2386,6 +2396,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
render: function () {
|
||||||
|
if (!converse.connection.connected || !converse.connection.authenticated || converse.connection.disconnecting) {
|
||||||
|
// TODO: we might need to take prebinding into consideration here.
|
||||||
|
this.renderLoginPanel();
|
||||||
|
} else if (!this.contactspanel || !this.contactspanel.$el.is(':visible')) {
|
||||||
|
this.renderContactsPanel();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
giveFeedback: function (message, klass) {
|
giveFeedback: function (message, klass) {
|
||||||
var $el = this.$('.conn-feedback');
|
var $el = this.$('.conn-feedback');
|
||||||
$el.addClass('conn-feedback').text(message);
|
$el.addClass('conn-feedback').text(message);
|
||||||
@ -2424,16 +2444,6 @@
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
|
||||||
if (!converse.connection.connected || !converse.connection.authenticated || converse.connection.disconnecting) {
|
|
||||||
// TODO: we might need to take prebinding into consideration here.
|
|
||||||
this.renderLoginPanel();
|
|
||||||
} else if (!this.contactspanel || !this.contactspanel.$el.is(':visible')) {
|
|
||||||
this.renderContactsPanel();
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
renderLoginPanel: function () {
|
renderLoginPanel: function () {
|
||||||
var $feedback = this.$('.conn-feedback'); // we want to still show any existing feedback.
|
var $feedback = this.$('.conn-feedback'); // we want to still show any existing feedback.
|
||||||
this.$el.html(converse.templates.controlbox(this.model.toJSON()));
|
this.$el.html(converse.templates.controlbox(this.model.toJSON()));
|
||||||
@ -5945,7 +5955,6 @@
|
|||||||
return this.chatboxes.add({
|
return this.chatboxes.add({
|
||||||
id: 'controlbox',
|
id: 'controlbox',
|
||||||
box_id: 'controlbox',
|
box_id: 'controlbox',
|
||||||
height: this.default_box_height,
|
|
||||||
closed: !this.show_controlbox_by_default
|
closed: !this.show_controlbox_by_default
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user