|
@@ -100,6 +100,14 @@
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ converse.refresh = function () {
|
|
|
|
+ // TODO: only do this for webkit browsers
|
|
|
|
+ var conversejs = document.getElementById('conversejs');
|
|
|
|
+ conversejs.style.display = 'none';
|
|
|
|
+ conversejs.offsetHeight; // no need to store this anywhere, the reference is enough
|
|
|
|
+ conversejs.style.display = 'block';
|
|
|
|
+ };
|
|
|
|
+
|
|
converse.initialize = function (settings, callback) {
|
|
converse.initialize = function (settings, callback) {
|
|
var converse = this;
|
|
var converse = this;
|
|
|
|
|
|
@@ -1218,15 +1226,16 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- show: function () {
|
|
|
|
|
|
+ show: function (callback) {
|
|
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
|
|
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
|
|
converse.emit('onChatBoxFocused', this);
|
|
converse.emit('onChatBoxFocused', this);
|
|
return this.focus();
|
|
return this.focus();
|
|
}
|
|
}
|
|
if (converse.animate) {
|
|
if (converse.animate) {
|
|
- this.$el.css({'opacity': 0, 'display': 'inline'}).animate({opacity: '1'}, 200);
|
|
|
|
|
|
+ this.$el.css({'opacity': 0, 'display': 'inline'}).animate({opacity: '1'}, 200, null, callback);
|
|
} else {
|
|
} else {
|
|
this.$el.css({'opacity': 1, 'display': 'inline'});
|
|
this.$el.css({'opacity': 1, 'display': 'inline'});
|
|
|
|
+ callback();
|
|
}
|
|
}
|
|
if (converse.connection) {
|
|
if (converse.connection) {
|
|
// Without a connection, we haven't yet initialized
|
|
// Without a connection, we haven't yet initialized
|
|
@@ -1592,6 +1601,38 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ hide: function (callback) {
|
|
|
|
+ this.$el.hide('fast', function () {
|
|
|
|
+ converse.controlboxtoggle.show(function () {
|
|
|
|
+ converse.refresh();
|
|
|
|
+ if (typeof callback === "function") {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ show: function () {
|
|
|
|
+ converse.controlboxtoggle.hide();
|
|
|
|
+ if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (converse.animate) {
|
|
|
|
+ this.$el.css({'opacity': 0, 'display': 'inline'}).animate({opacity: '1'}, 200, null, function () {
|
|
|
|
+ converse.refresh();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$el.css({'opacity': 1, 'display': 'inline'}); converse.refresh();
|
|
|
|
+ }
|
|
|
|
+ if (converse.connection) {
|
|
|
|
+ // Without a connection, we haven't yet initialized
|
|
|
|
+ // localstorage
|
|
|
|
+ this.model.save();
|
|
|
|
+ }
|
|
|
|
+ converse.emit('onControlBoxOpened', this);
|
|
|
|
+ return this;
|
|
|
|
+ },
|
|
|
|
+
|
|
featureAdded: function (feature) {
|
|
featureAdded: function (feature) {
|
|
if ((feature.get('var') == 'http://jabber.org/protocol/muc') && (converse.allow_muc)) {
|
|
if ((feature.get('var') == 'http://jabber.org/protocol/muc') && (converse.allow_muc)) {
|
|
this.roomspanel.muc_domain = feature.get('from');
|
|
this.roomspanel.muc_domain = feature.get('from');
|
|
@@ -3187,6 +3228,14 @@
|
|
return this;
|
|
return this;
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ hide: function (callback) {
|
|
|
|
+ this.$el.hide('fast', callback);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ show: function (callback) {
|
|
|
|
+ this.$el.show('fast', callback);
|
|
|
|
+ },
|
|
|
|
+
|
|
showControlBox: function () {
|
|
showControlBox: function () {
|
|
var controlbox = converse.chatboxes.get('controlbox');
|
|
var controlbox = converse.chatboxes.get('controlbox');
|
|
if (!controlbox) {
|
|
if (!controlbox) {
|