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 () {
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);