From 554b16698afee56f9e5962278414ccc2fa733a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Thu, 13 Mar 2014 18:49:29 +0000 Subject: [PATCH] Show sidebar when switching from mobile to desktop view (or the other way around) --- js/glowingbear.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/glowingbear.js b/js/glowingbear.js index 26990f0..b39e003 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -851,6 +851,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', window.addEventListener("resize", _.debounce(function() { // Recalculation fails when not connected if ($rootScope.connected) { + // Show the sidebar if switching away from mobile view, hide it when switching to mobile + // Wrap in a condition so we save ourselves the $apply if nothing changes (50ms or more) + if ($scope.showSidebar === $scope.isMobileDevice()) { + $scope.showSidebar = !$scope.showSidebar; + $scope.$apply(); + } $scope.calculateNumLines(); } }, 100));