Replace magic number 968 with variable

This commit is contained in:
David Cormier 2014-02-19 10:15:23 -05:00
parent 11e5b6fbda
commit 8e44757e61
1 changed files with 24 additions and 22 deletions

View File

@ -486,6 +486,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
}); });
} }
var mobile_cutoff = 968;
$rootScope.countWatchers = function () { $rootScope.countWatchers = function () {
var root = $(document.getElementsByTagName('body')); var root = $(document.getElementsByTagName('body'));
@ -614,13 +615,14 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// If we are on mobile chhange some defaults // If we are on mobile chhange some defaults
// We use 968 px as the cutoff, which should match the value in glowingbear.css // 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.nonicklist = true;
$scope.noembed = true; $scope.noembed = true;
$scope.notimestamp = true; $scope.notimestamp = true;
} }
// Open and close panels while on mobile devices through swiping // Open and close panels while on mobile devices through swiping
$scope.swipeSidebar = function() { $scope.swipeSidebar = function() {
if (document.body.clientWidth < 968) { if (document.body.clientWidth < 968) {
$('#sidebar').collapse('toggle'); $('#sidebar').collapse('toggle');
} }
@ -657,7 +659,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.setActiveBuffer = function(bufferId, key) { $scope.setActiveBuffer = function(bufferId, key) {
// If we are on mobile we need to collapse the menu on sidebar clicks // 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 // 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'); $('#sidebar').collapse('toggle');
} }
return models.setActiveBuffer(bufferId, key); return models.setActiveBuffer(bufferId, key);