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.
with-route-provider
David Cormier 12 years ago
parent fb0ce21fc5
commit 14a40c1039
  1. 12
      js/websockets.js

@ -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…
Cancel
Save