Commit 1c26e901 authored by JC Brand's avatar JC Brand

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
parent 8fe07b9d
...@@ -207,6 +207,7 @@ ...@@ -207,6 +207,7 @@
'xhr_user_search', 'xhr_user_search',
'xhr_user_search_url' 'xhr_user_search_url'
])); ]));
$.fx.off = !this.animate;
// Only allow OTR if we have the capability // Only allow OTR if we have the capability
this.allow_otr = this.allow_otr && HAS_CRYPTO; this.allow_otr = this.allow_otr && HAS_CRYPTO;
...@@ -917,7 +918,7 @@ ...@@ -917,7 +918,7 @@
this.showMessage({'message': text, 'sender': 'them'}); this.showMessage({'message': text, 'sender': 'them'});
}, this); }, this);
this.updateVCard(); 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}); this.render().show().focus().model.messages.fetch({add: true});
if (this.model.get('status')) { if (this.model.get('status')) {
this.showStatusMessage(this.model.get('status')); this.showStatusMessage(this.model.get('status'));
...@@ -932,9 +933,7 @@ ...@@ -932,9 +933,7 @@
this.$el.attr('id', this.model.get('box_id')) this.$el.attr('id', this.model.get('box_id'))
.html( .html(
converse.templates.chatbox( converse.templates.chatbox(
_.extend( _.extend(this.model.toJSON(), {
this.model.toJSON(),
{
show_toolbar: converse.show_toolbar, show_toolbar: converse.show_toolbar,
label_personal_message: __('Personal message') label_personal_message: __('Personal message')
} }
...@@ -943,6 +942,9 @@ ...@@ -943,6 +942,9 @@
); );
this.renderToolbar().renderAvatar(); this.renderToolbar().renderAvatar();
converse.emit('onChatBoxOpened', this); converse.emit('onChatBoxOpened', this);
setTimeout(function () {
converse.refreshWebkit();
}, 50);
return this; return this;
}, },
...@@ -1441,9 +1443,8 @@ ...@@ -1441,9 +1443,8 @@
}, },
hide: function () { hide: function () {
var speed = converse.animate ? 'fast' : null;
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") { 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); converse.emit('onChatBoxClosed', this);
} }
}, },
...@@ -1452,12 +1453,7 @@ ...@@ -1452,12 +1453,7 @@
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") { if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
return this; return this;
} }
if (converse.animate) { this.$el.show(callback);
this.$el.show(callback);
} else {
this.$el.show();
if (typeof callback === 'function') { callback(); }
}
if (converse.connection) { if (converse.connection) {
// Without a connection, we haven't yet initialized // Without a connection, we haven't yet initialized
// localstorage // localstorage
...@@ -1795,7 +1791,7 @@ ...@@ -1795,7 +1791,7 @@
}, },
initialize: function () { initialize: function () {
this.$el.appendTo(converse.chatboxviews.$el); this.$el.insertAfter(converse.controlboxtoggle.$el);
this.model.on('change', $.proxy(function (item, changed) { this.model.on('change', $.proxy(function (item, changed) {
var i; var i;
if (_.has(item.changed, 'connected')) { if (_.has(item.changed, 'connected')) {
...@@ -2508,10 +2504,6 @@ ...@@ -2508,10 +2504,6 @@
delete view.model; // Remove ref to old model to help garbage collection delete view.model; // Remove ref to old model to help garbage collection
view.model = item; view.model = item;
view.initialize(); view.initialize();
if (item.get('id') !== 'controlbox') {
// XXX: Why is it necessary to again append chatboxes?
view.$el.appendTo(this.$el);
}
} }
}, this); }, this);
}, },
......
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
allow_otr: true, allow_otr: true,
auto_list_rooms: false, auto_list_rooms: false,
auto_subscribe: 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 , debug: true ,
hide_muc_server: false, hide_muc_server: false,
i18n: locales['en'], // Refer to ./locale/locales.js to see which locales are supported i18n: locales['en'], // Refer to ./locale/locales.js to see which locales are supported
......
...@@ -68,6 +68,7 @@ config = { ...@@ -68,6 +68,7 @@ config = {
'crypto.sha1': { deps: ['crypto.core'] }, 'crypto.sha1': { deps: ['crypto.core'] },
'crypto.sha256': { deps: ['crypto.core'] }, 'crypto.sha256': { deps: ['crypto.core'] },
'jquery.tinysort': { deps: ['jquery'] }, 'jquery.tinysort': { deps: ['jquery'] },
'jquery.browser': { deps: ['jquery'] },
'strophe': { deps: ['jquery'] }, 'strophe': { deps: ['jquery'] },
'strophe.disco': { deps: ['strophe'] }, 'strophe.disco': { deps: ['strophe'] },
'strophe.muc': { deps: ['strophe', 'jquery'] }, 'strophe.muc': { deps: ['strophe', 'jquery'] },
......
...@@ -37,7 +37,6 @@ require([ ...@@ -37,7 +37,6 @@ require([
"jasmine-html" "jasmine-html"
], function($, converse, mock, jasmine) { ], function($, converse, mock, jasmine) {
// Set up converse.js // Set up converse.js
$.fx.off = true;
window.converse_api = converse; window.converse_api = converse;
window.localStorage.clear(); window.localStorage.clear();
converse.initialize({ converse.initialize({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment