2014-07-22 20:55:26 +02:00
|
|
|
var Whisper = Whisper || {};
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
Whisper.MessageListView = Whisper.ListView.extend({
|
|
|
|
tagName: 'ul',
|
2014-07-28 00:12:59 +02:00
|
|
|
className: 'discussion',
|
2014-11-11 08:16:46 +01:00
|
|
|
itemView: Whisper.MessageView,
|
|
|
|
events: {
|
2014-11-21 00:43:51 +01:00
|
|
|
'add': 'scrollToBottom',
|
|
|
|
'update *': 'scrollToBottom'
|
2014-11-11 08:16:46 +01:00
|
|
|
},
|
|
|
|
scrollToBottom: function() {
|
2014-11-21 00:43:51 +01:00
|
|
|
// TODO: Avoid scrolling if user has manually scrolled up?
|
2014-11-11 08:16:46 +01:00
|
|
|
this.$el.scrollTop(this.el.scrollHeight);
|
|
|
|
},
|
2014-11-13 23:35:37 +01:00
|
|
|
addAll: function() {
|
2014-11-21 01:30:52 +01:00
|
|
|
Whisper.ListView.prototype.addAll.apply(this, arguments); // super()
|
2014-11-17 00:30:40 +01:00
|
|
|
this.scrollToBottom();
|
2014-11-13 23:35:37 +01:00
|
|
|
},
|
2014-07-22 20:55:26 +02:00
|
|
|
});
|
|
|
|
})();
|