From 8e44757e61c20c407027f158f8cd510811efbd31 Mon Sep 17 00:00:00 2001
From: David Cormier <david.cormier@savoirfairelinux.com>
Date: Wed, 19 Feb 2014 10:15:23 -0500
Subject: [PATCH] Replace magic number 968 with variable

---
 js/glowingbear.js | 46 ++++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/js/glowingbear.js b/js/glowingbear.js
index ba68d2f..1fbebbd 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -486,6 +486,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
         });
     }
 
+    var mobile_cutoff = 968;
 
     $rootScope.countWatchers = function () {
         var root = $(document.getElementsByTagName('body'));
@@ -614,34 +615,35 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
 
     // If we are on mobile chhange some defaults
     // We use 968 px as the cutoff, which should match the value in glowingbear.css
-    if (document.body.clientWidth < 968) {
+    if (document.body.clientWidth < mobile_cutoff) {
         $scope.nonicklist = true;
         $scope.noembed = true;
         $scope.notimestamp = true;
     }
-	// Open and close panels while on mobile devices through swiping
-	$scope.swipeSidebar = function() { 
-	        if (document.body.clientWidth < 968) {
+    // Open and close panels while on mobile devices through swiping
+    $scope.swipeSidebar = function() { 
+
+        if (document.body.clientWidth < 968) {
             $('#sidebar').collapse('toggle');
         }
-	};
-	
-	
-	$scope.openNick = function() {
-		if (document.body.clientWidth < 968) {
-			if($scope.nonicklist) { 
-				$scope.nonicklist = false;
-			} 
-		}
-	};
+    };
+    
+    
+    $scope.openNick = function() {
+        if (document.body.clientWidth < 968) {
+            if($scope.nonicklist) { 
+                $scope.nonicklist = false;
+            } 
+        }
+    };
 
-	$scope.closeNick = function() {
-		if (document.body.clientWidth < 968) {
-			if(!$scope.nonicklist) { 
-				$scope.nonicklist = true;
-			} 
-		}
-	};
+    $scope.closeNick = function() {
+        if (document.body.clientWidth < 968) {
+            if(!$scope.nonicklist) { 
+                $scope.nonicklist = true;
+            } 
+        }
+    };
 
     // Watch model and update show setting when it changes
     $scope.$watch('noembed', function() {
@@ -657,7 +659,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
     $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) {
+        if (document.body.clientWidth < mobile_cutoff) {
             $('#sidebar').collapse('toggle');
         }
         return models.setActiveBuffer(bufferId, key);