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