diff --git a/js/glowingbear.js b/js/glowingbear.js index 3a71fe5..82d6998 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -30,6 +30,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $scope.command = ''; $scope.themes = ['dark', 'light', 'black', 'dark-spacious', 'blue', 'base16-default', 'base16-light', 'base16-mocha', 'base16-ocean-dark', 'base16-solarized-dark', 'base16-solarized-light']; + + // Current swipe status. Values: + // +1: bufferlist open, nicklist closed + // 0: bufferlist closed, nicklist closed + // -1: bufferlist closed, nicklist open $scope.swipeStatus = 1; // Initialise all our settings, this needs to include all settings @@ -171,9 +176,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', // Check if we should show nicklist or not $scope.showNicklist = $scope.updateShowNicklist(); } - if ($scope.swipeStatus <= 0 && !settings.alwaysnicklist) { - $scope.swipeStatus = $scope.showNicklist ? -1 : 0; - } if (ab.requestedLines < $scope.lines_per_screen) { // buffer has not been loaded, but some lines may already be present if they arrived after we connected @@ -336,6 +338,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', } else if ($scope.swipeStatus === 0) { $scope.showSidebar(); // updates swipe status to 1 } else if ($scope.swipeStatus === -1) { + // hide nicklist $scope.swipeStatus = 0; $scope.showNicklist = $scope.updateShowNicklist(); } else { @@ -351,6 +354,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', if ($scope.swipeStatus === 1) { $scope.hideSidebar(); // updates swipe status to 0 } else if ($scope.swipeStatus === 0) { + // show nicklist $scope.swipeStatus = -1; $scope.showNicklist = $scope.updateShowNicklist(); } else if ($scope.swipeStatus === -1) { @@ -746,9 +750,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', // Watch model and update show setting when it changes settings.addCallback('nonicklist', function() { $scope.showNicklist = $scope.updateShowNicklist(); - if ($scope.swipeStatus <= 0 && !settings.alwaysnicklist) { - $scope.swipeStatus = $scope.showNicklist ? -1 : 0; - } // restore bottom view if ($rootScope.connected && $rootScope.bufferBottom) { $timeout(function(){ @@ -756,6 +757,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', }, 500); } }); + settings.addCallback('alwaysnicklist', function() { + $scope.showNicklist = $scope.updateShowNicklist(); + }); $scope.showNicklist = false; // Utility function that template can use to check if nicklist should // be displayed for current buffer or not