ui: scroll to bottom when receiving activeBufferChanged signal
Triggers the ui manipulation code when the rootScope receives the signal. Supports multiple ways of changing the buffer (clicking, shortcuts, etc.) without having to duplicate this code.
This commit is contained in:
parent
fb0ce21fc5
commit
14a40c1039
|
@ -430,6 +430,13 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
}
|
||||
|
||||
|
||||
$rootScope.$on('activeBufferChanged', function() {
|
||||
$rootScope.scrollToBottom();
|
||||
document.getElementById('sendMessage').focus();
|
||||
var ab = models.getActiveBuffer();
|
||||
$rootScope.pageTitle = ab.shortName + ' | ' + ab.title;
|
||||
});
|
||||
|
||||
$scope.buffers = models.model.buffers;
|
||||
$scope.activeBuffer = models.getActiveBuffer
|
||||
|
||||
|
@ -451,11 +458,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
|
||||
$scope.setActiveBuffer = function(key) {
|
||||
models.setActiveBuffer(key);
|
||||
$rootScope.scrollToBottom();
|
||||
document.getElementById('sendMessage').focus();
|
||||
var ab = models.getActiveBuffer();
|
||||
$rootScope.pageTitle = ab.shortName + ' | ' + ab.title;
|
||||
|
||||
};
|
||||
|
||||
$rootScope.scrollToBottom = function() {
|
||||
|
|
Loading…
Reference in New Issue