From f7aa7a0871b373a8f650f2c9671eef663a21c69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Wed, 13 Aug 2014 08:39:32 +0100 Subject: [PATCH 1/3] Hide sidebar when focusing input bar This is for mobile --- directives/input.html | 2 +- js/glowingbear.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/directives/input.html b/directives/input.html index 58a72ed..6f1e4b6 100644 --- a/directives/input.html +++ b/directives/input.html @@ -1,6 +1,6 @@
- diff --git a/js/glowingbear.js b/js/glowingbear.js index 0efde02..d31695a 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -909,7 +909,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', document.getElementById('content').setAttribute('sidebar-state', 'visible'); }; - $scope.hideSidebar = function() { + $rootScope.hideSidebar = function() { if ($rootScope.isMobileUi()) { document.getElementById('sidebar').setAttribute('data-state', 'hidden'); document.getElementById('content').setAttribute('sidebar-state', 'hidden'); @@ -1394,6 +1394,10 @@ weechat.directive('inputBar', function() { return document.querySelector('textarea#' + $scope.inputId); }; + $scope.hideSidebar = function() { + $rootScope.hideSidebar(); + }; + $scope.completeNick = function() { // input DOM node var inputNode = $scope.getInputNode(); From e46efba5cfb7d5e37f3097367eaa87c4abfc8ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Wed, 13 Aug 2014 08:39:56 +0100 Subject: [PATCH 2/3] Update angular version from beta 8 to beta 18 ngFocus is broken in beta8 --- index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 6cae901..1d034f1 100644 --- a/index.html +++ b/index.html @@ -14,10 +14,10 @@ - - - - + + + + From ae5f0effcf9b725d046744cddd9e7475289fc58f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Wed, 13 Aug 2014 09:22:41 +0100 Subject: [PATCH 3/3] Auto-close keyboard when opening sidebar (bufferlist) This is for mobile --- js/glowingbear.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/glowingbear.js b/js/glowingbear.js index d31695a..ac4cd1e 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -907,6 +907,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $scope.showSidebar = function() { document.getElementById('sidebar').setAttribute('data-state', 'visible'); document.getElementById('content').setAttribute('sidebar-state', 'visible'); + if ($rootScope.isMobileUi()) { + // de-focus the input bar when opening the sidebar on mobile, so that the keyboard goes down + _.each(document.getElementsByTagName('textarea'), function(elem) { + elem.blur(); + }); + } }; $rootScope.hideSidebar = function() {