2017-05-17 21:32:03 +00:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
|
2017-05-25 18:28:31 +00:00
|
|
|
var FIVE_SECONDS = 5 * 1000;
|
|
|
|
|
2017-05-17 21:32:03 +00:00
|
|
|
Whisper.LastSeenIndicatorView = Whisper.View.extend({
|
|
|
|
className: 'last-seen-indicator-view',
|
|
|
|
templateName: 'last-seen-indicator-view',
|
|
|
|
initialize: function(options) {
|
|
|
|
options = options || {};
|
|
|
|
this.count = options.count || 0;
|
2017-05-25 18:28:31 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
increment: function(count) {
|
|
|
|
this.count += count;
|
|
|
|
this.render();
|
2017-05-17 21:32:03 +00:00
|
|
|
},
|
|
|
|
|
2017-06-01 18:54:57 +00:00
|
|
|
getCount: function() {
|
|
|
|
return this.count;
|
|
|
|
},
|
|
|
|
|
2017-05-17 21:32:03 +00:00
|
|
|
render_attributes: function() {
|
|
|
|
var unreadMessages = this.count === 1 ? i18n('unreadMessage')
|
|
|
|
: i18n('unreadMessages', [this.count]);
|
|
|
|
|
|
|
|
return {
|
|
|
|
unreadMessages: unreadMessages
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|