Use scrollDown and make sure newly created chatboxes are scrolled down
This commit is contained in:
parent
d27c69d7b9
commit
eaf39165ae
16
converse.js
16
converse.js
@ -328,7 +328,7 @@
|
|||||||
var $chat_content = this.$el.find('.chat-content');
|
var $chat_content = this.$el.find('.chat-content');
|
||||||
$chat_content.find('div.chat-event').remove().end()
|
$chat_content.find('div.chat-event').remove().end()
|
||||||
.append($('<div class="chat-event"></div>').text(message));
|
.append($('<div class="chat-event"></div>').text(message));
|
||||||
$chat_content.scrollTop($chat_content[0].scrollHeight);
|
this.scrollDown();
|
||||||
},
|
},
|
||||||
|
|
||||||
showMessage: function (message) {
|
showMessage: function (message) {
|
||||||
@ -351,9 +351,9 @@
|
|||||||
'username': message.get('fullname'),
|
'username': message.get('fullname'),
|
||||||
'extra_classes': message.get('delayed') && 'delayed' || ''
|
'extra_classes': message.get('delayed') && 'delayed' || ''
|
||||||
}));
|
}));
|
||||||
$chat_content.scrollTop($chat_content[0].scrollHeight);
|
|
||||||
}
|
}
|
||||||
xmppchat.updateMsgCounter();
|
xmppchat.updateMsgCounter();
|
||||||
|
this.scrollDown();
|
||||||
},
|
},
|
||||||
|
|
||||||
isDifferentDay: function (prev_date, next_date) {
|
isDifferentDay: function (prev_date, next_date) {
|
||||||
@ -473,17 +473,12 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (){
|
initialize: function (){
|
||||||
// boxviewinit
|
|
||||||
$('body').append(this.$el.hide());
|
|
||||||
this.model.messages.on('add', this.showMessage, this);
|
this.model.messages.on('add', this.showMessage, this);
|
||||||
|
|
||||||
this.model.on('show', this.show, this);
|
this.model.on('show', this.show, this);
|
||||||
this.model.on('destroy', function (model, response, options) {
|
this.model.on('destroy', function (model, response, options) { this.$el.hide('fast'); }, this);
|
||||||
this.$el.hide('fast');
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
xmppchat.roster.on('change', this.rosterChanged, this);
|
xmppchat.roster.on('change', this.rosterChanged, this);
|
||||||
|
|
||||||
|
this.$el.appendTo(xmppchat.chatboxesview.$el);
|
||||||
this.render().show().model.messages.fetch({add: true});
|
this.render().show().model.messages.fetch({add: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -541,6 +536,7 @@
|
|||||||
scrollDown: function () {
|
scrollDown: function () {
|
||||||
var $content = this.$el.find('.chat-content');
|
var $content = this.$el.find('.chat-content');
|
||||||
$content.scrollTop($content[0].scrollHeight);
|
$content.scrollTop($content[0].scrollHeight);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -715,6 +711,7 @@
|
|||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
// Override the one in ChatBoxView
|
// Override the one in ChatBoxView
|
||||||
|
this.$el.appendTo(xmppchat.chatboxesview.$el);
|
||||||
this.model.on('change', $.proxy(function (item, changed) {
|
this.model.on('change', $.proxy(function (item, changed) {
|
||||||
if (_.has(item.changed, 'connected')) {
|
if (_.has(item.changed, 'connected')) {
|
||||||
this.render().appendRoster();
|
this.render().appendRoster();
|
||||||
@ -1123,7 +1120,6 @@
|
|||||||
view = new xmppchat.ChatBoxView({model: item});
|
view = new xmppchat.ChatBoxView({model: item});
|
||||||
}
|
}
|
||||||
this.views[item.get('id')] = view;
|
this.views[item.get('id')] = view;
|
||||||
view.$el.appendTo(this.$el);
|
|
||||||
} else {
|
} else {
|
||||||
view.model = item;
|
view.model = item;
|
||||||
view.initialize();
|
view.initialize();
|
||||||
|
Loading…
Reference in New Issue
Block a user