Fixed chatbox positioning and better disabling of effects

* The animate config option now disables jQuery effects
* Make sure the controlbox is always to the right of all other chatboxes
* Make sure new chatboxes are always created immediately left of the controlbox
This commit is contained in:
JC Brand 2014-04-24 07:58:35 +02:00
parent 8fe07b9ddd
commit 1c26e9016c
4 changed files with 11 additions and 19 deletions

View File

@ -207,6 +207,7 @@
'xhr_user_search',
'xhr_user_search_url'
]));
$.fx.off = !this.animate;
// Only allow OTR if we have the capability
this.allow_otr = this.allow_otr && HAS_CRYPTO;
@ -917,7 +918,7 @@
this.showMessage({'message': text, 'sender': 'them'});
}, this);
this.updateVCard();
this.$el.appendTo(converse.chatboxviews.$el);
this.$el.insertAfter(converse.chatboxviews.get("controlbox").$el);
this.render().show().focus().model.messages.fetch({add: true});
if (this.model.get('status')) {
this.showStatusMessage(this.model.get('status'));
@ -932,9 +933,7 @@
this.$el.attr('id', this.model.get('box_id'))
.html(
converse.templates.chatbox(
_.extend(
this.model.toJSON(),
{
_.extend(this.model.toJSON(), {
show_toolbar: converse.show_toolbar,
label_personal_message: __('Personal message')
}
@ -943,6 +942,9 @@
);
this.renderToolbar().renderAvatar();
converse.emit('onChatBoxOpened', this);
setTimeout(function () {
converse.refreshWebkit();
}, 50);
return this;
},
@ -1441,9 +1443,8 @@
},
hide: function () {
var speed = converse.animate ? 'fast' : null;
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
this.$el.hide(speed, converse.refreshWebkit);
this.$el.hide('fast', converse.refreshWebkit);
converse.emit('onChatBoxClosed', this);
}
},
@ -1452,12 +1453,7 @@
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
return this;
}
if (converse.animate) {
this.$el.show(callback);
} else {
this.$el.show();
if (typeof callback === 'function') { callback(); }
}
if (converse.connection) {
// Without a connection, we haven't yet initialized
// localstorage
@ -1795,7 +1791,7 @@
},
initialize: function () {
this.$el.appendTo(converse.chatboxviews.$el);
this.$el.insertAfter(converse.controlboxtoggle.$el);
this.model.on('change', $.proxy(function (item, changed) {
var i;
if (_.has(item.changed, 'connected')) {
@ -2508,10 +2504,6 @@
delete view.model; // Remove ref to old model to help garbage collection
view.model = item;
view.initialize();
if (item.get('id') !== 'controlbox') {
// XXX: Why is it necessary to again append chatboxes?
view.$el.appendTo(this.$el);
}
}
}, this);
},

View File

@ -193,7 +193,7 @@
allow_otr: true,
auto_list_rooms: false,
auto_subscribe: false,
bosh_service_url: 'http://devbox:5280/http-bind', // Please use this connection manager only for testing purposes
bosh_service_url: 'https://bind.conversejs.org', // Please use this connection manager only for testing purposes
debug: true ,
hide_muc_server: false,
i18n: locales['en'], // Refer to ./locale/locales.js to see which locales are supported

View File

@ -68,6 +68,7 @@ config = {
'crypto.sha1': { deps: ['crypto.core'] },
'crypto.sha256': { deps: ['crypto.core'] },
'jquery.tinysort': { deps: ['jquery'] },
'jquery.browser': { deps: ['jquery'] },
'strophe': { deps: ['jquery'] },
'strophe.disco': { deps: ['strophe'] },
'strophe.muc': { deps: ['strophe', 'jquery'] },

View File

@ -37,7 +37,6 @@ require([
"jasmine-html"
], function($, converse, mock, jasmine) {
// Set up converse.js
$.fx.off = true;
window.converse_api = converse;
window.localStorage.clear();
converse.initialize({