|
@@ -2252,26 +2252,38 @@
|
|
|
return this;
|
|
|
},
|
|
|
|
|
|
- show: _.debounce(function (focus) {
|
|
|
- if (this.$el.is(':visible') && this.$el.css('opacity') === "1") {
|
|
|
- if (focus) { this.focus(); }
|
|
|
- return this;
|
|
|
+ show: function (focus) {
|
|
|
+ if (typeof this.debouncedShow === 'undefined') {
|
|
|
+ /* We wrap the method in a debouncer and set it on the
|
|
|
+ * instance, so that we have it debounced per instance.
|
|
|
+ * Debouncing it on the class-level is too broad.
|
|
|
+ */
|
|
|
+ this.debouncedShow = _.debounce(function (focus) {
|
|
|
+ if (this.$el.is(':visible') && this.$el.css('opacity') === "1") {
|
|
|
+ if (focus) { this.focus(); }
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+ this.initDragResize().setDimensions();
|
|
|
+ // We call trimChats before fading in, to avoid ugly transition
|
|
|
+ // effects.
|
|
|
+ converse.chatboxviews.trimChats(this);
|
|
|
+ this.$el.fadeIn(function () {
|
|
|
+ if (converse.connection.connected) {
|
|
|
+ // Without a connection, we haven't yet initialized
|
|
|
+ // localstorage
|
|
|
+ this.model.save();
|
|
|
+ }
|
|
|
+ this.setChatState(converse.ACTIVE);
|
|
|
+ this.scrollDown();
|
|
|
+ if (focus) {
|
|
|
+ this.focus();
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+ }, 250, true);
|
|
|
}
|
|
|
- this.initDragResize().setDimensions();
|
|
|
- this.$el.fadeIn(function () {
|
|
|
- if (converse.connection.connected) {
|
|
|
- // Without a connection, we haven't yet initialized
|
|
|
- // localstorage
|
|
|
- this.model.save();
|
|
|
- }
|
|
|
- this.setChatState(converse.ACTIVE);
|
|
|
- this.scrollDown();
|
|
|
- if (focus) {
|
|
|
- this.focus();
|
|
|
- }
|
|
|
- }.bind(this));
|
|
|
+ this.debouncedShow.apply(this, arguments);
|
|
|
return this;
|
|
|
- }, 250, true),
|
|
|
+ },
|
|
|
|
|
|
scrollDownMessageHeight: function ($message) {
|
|
|
if (this.$content.is(':visible')) {
|