From d5cbdf2d4a4e33b51c4ffb5d43954c8787931cbd Mon Sep 17 00:00:00 2001 From: David Cormier Date: Thu, 27 Feb 2014 08:28:01 -0500 Subject: [PATCH] Respect mobile users settings Do not set the values for "nonicklist" "noembed" and "notimestamp" regardless of what the mobile user had set. Only change the default values for the bindings if none has been set. Fix #147 --- js/glowingbear.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 81ec6fd..b250517 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -646,31 +646,38 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $store.bind($scope, "password", ""); } + // If we are on mobile change some defaults + // We use 968 px as the cutoff, which should match the value in glowingbear.css + var nonicklist = false; + var noembed = false; + var notimestamp = false; + + if ($rootScope.isMobileDevice()) { + nonicklist = true; + noembed = true; + notimestamp = true; + } + + // Save setting for displaying only buffers with unread messages $store.bind($scope, "onlyUnread", false); - // Save setting for not showing timestamp - $store.bind($scope, "notimestamp", false); + // Save setting for syncing hotlist $store.bind($scope, "hotlistsync", true); // Save setting for displaying nicklist - $store.bind($scope, "nonicklist", false); + $store.bind($scope, "nonicklist", nonicklist); // Save setting for displaying embeds - $store.bind($scope, "noembed", false); + $store.bind($scope, "noembed", noembed); // Save setting for channel ordering $store.bind($scope, "orderbyserver", false); // Save setting for updating favicon $store.bind($scope, "useFavico", true); + // Save setting for notimestamp + $store.bind($scope, "notimestamp", notimestamp); + // Save setting for displaying embeds in rootScope so it can be used from service $rootScope.visible = $scope.noembed === false; - // If we are on mobile chhange some defaults - // We use 968 px as the cutoff, which should match the value in glowingbear.css - if ($rootScope.isMobileDevice()) { - $scope.nonicklist = true; - $scope.noembed = true; - $scope.notimestamp = true; - } - // Open and close panels while on mobile devices through swiping $scope.swipeSidebar = function() { if ($rootScope.isMobileDevice()) {