Don't steal focus when the chatbox opens automatically

- Adding a new parameter "focus" to ChatBoxView.show
- Removing the parameter "callback" not used
This commit is contained in:
rlanvin 2016-02-15 18:19:14 +02:00
parent 76ed0b7b85
commit 6599b70602
2 changed files with 7 additions and 6 deletions

View File

@ -2174,22 +2174,22 @@
return this; return this;
}, },
show: function (callback) { show: function (focus) {
if (this.$el.is(':visible') && this.$el.css('opacity') === "1") { if (this.$el.is(':visible') && this.$el.css('opacity') === "1") {
return this.focus(); return this.focus();
} }
this.initDragResize().setDimensions(); this.initDragResize().setDimensions();
this.$el.fadeIn(function () { this.$el.fadeIn(function () {
if (typeof callback === "function") {
callback.apply(this, arguments);
}
if (converse.connection.connected) { if (converse.connection.connected) {
// Without a connection, we haven't yet initialized // Without a connection, we haven't yet initialized
// localstorage // localstorage
this.model.save(); this.model.save();
} }
this.setChatState(ACTIVE); this.setChatState(ACTIVE);
this.scrollDown().focus(); this.scrollDown();
if ( focus ) {
this.focus();
}
}.bind(this)); }.bind(this));
return this; return this;
}, },
@ -3923,7 +3923,7 @@
if (chatbox.get('minimized')) { if (chatbox.get('minimized')) {
chatbox.maximize(); chatbox.maximize();
} else { } else {
chatbox.trigger('show'); chatbox.trigger('show', true);
} }
return chatbox; return chatbox;
} }

View File

@ -5,6 +5,7 @@
- #261 show_controlbox_by_default config not working [diditopher] - #261 show_controlbox_by_default config not working [diditopher]
- #573 xgettext build error: `'javascript' unknown` - #573 xgettext build error: `'javascript' unknown`
- Save scroll position on minimize and restore it on maximize [rlanvin] - Save scroll position on minimize and restore it on maximize [rlanvin]
- #566 Do not steal the focus when the chatbox opens automatically [rlanvin]
## 0.10.1 (2016-02-06) ## 0.10.1 (2016-02-06)