From 2e5e3a45eb7d652aeee3e12ee5eac6130d87af02 Mon Sep 17 00:00:00 2001
From: David Cormier <david.cormier@savoirfairelinux.com>
Date: Wed, 19 Feb 2014 09:53:03 -0500
Subject: [PATCH] Revert "Collapse sidebar with css selector"

This reverts commit 3a5dfd5e9472c9af5068868376af2ba1a7d53e78.
---
 css/glowingbear.css | 2 +-
 js/glowingbear.js   | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/css/glowingbear.css b/css/glowingbear.css
index 5942a90..f40d06c 100644
--- a/css/glowingbear.css
+++ b/css/glowingbear.css
@@ -267,7 +267,7 @@ input[type=text], input[type=password], .badge {
     #sidebar {
         font-size: normal;
         z-index: 1;
-        width: 0;
+        width: 60%;
     }
     #sidebar.in, #sidebar.collapsing {
         -webkit-box-shadow: 0px 0px 120px #000;
diff --git a/js/glowingbear.js b/js/glowingbear.js
index 55e2f8b..21f0c0f 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -633,6 +633,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
     $rootScope.predicate = $scope.orderbyserver ? 'serverSortKey' : 'number';
 
     $scope.setActiveBuffer = function(bufferId, key) {
+        // If we are on mobile we need to collapse the menu on sidebar clicks
+        // We use 968 px as the cutoff, which should match the value in glowingbear.css
+        if (document.body.clientWidth < 968) {
+            document.querySelector('#sidebar').collapse();
+        }
         return models.setActiveBuffer(bufferId, key);
     };