From 7a003f8227e463f0c4dce72bb8b42c8fd5c35c82 Mon Sep 17 00:00:00 2001 From: Felix Eckhofer Date: Mon, 24 Feb 2014 10:47:17 +0100 Subject: [PATCH 1/3] Focus input bar when not on mobile This improves the UX on desktop while avoiding the virtual keyboard popping up on touch devices --- js/glowingbear.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 41da5a5..0babf57 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -486,7 +486,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', }); } - var mobile_cutoff = 968; + $scope.mobile_cutoff = 968; $rootScope.countWatchers = function () { var root = $(document.getElementsByTagName('body')); @@ -663,7 +663,7 @@ 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 < mobile_cutoff) { + if (document.body.clientWidth < $scope.mobile_cutoff) { $scope.nonicklist = true; $scope.noembed = true; $scope.notimestamp = true; @@ -671,13 +671,13 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', // Open and close panels while on mobile devices through swiping $scope.swipeSidebar = function() { - if (document.body.clientWidth < mobile_cutoff) { + if (document.body.clientWidth < $scope.mobile_cutoff) { $scope.showSidebar = !$scope.showSidebar; } }; $scope.openNick = function() { - if (document.body.clientWidth < mobile_cutoff) { + if (document.body.clientWidth < $scope.mobile_cutoff) { if($scope.nonicklist) { $scope.nonicklist = false; } @@ -685,7 +685,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', }; $scope.closeNick = function() { - if (document.body.clientWidth < mobile_cutoff) { + if (document.body.clientWidth < $scope.mobile_cutoff) { if(!$scope.nonicklist) { $scope.nonicklist = true; } @@ -718,7 +718,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 < mobile_cutoff) { + if (document.body.clientWidth < $scope.mobile_cutoff) { $scope.showSidebar = false; } return models.setActiveBuffer(bufferId, key); @@ -1001,11 +1001,11 @@ weechat.directive('inputBar', function() { models) { // Focuses itself when active buffer is changed - /* $rootScope.$on('activeBufferChanged', function() { - angular.element('#sendMessage').focus(); + if (document.body.clientWidth >= $scope.mobile_cutoff) { + angular.element('#sendMessage').focus(); + } }); - */ $scope.completeNick = function() { // input DOM node From b3b4651e3316e6c742d942a31becaaf59c05619b Mon Sep 17 00:00:00 2001 From: Felix Eckhofer Date: Mon, 24 Feb 2014 11:28:43 +0100 Subject: [PATCH 2/3] Remove trailing spaces --- js/glowingbear.js | 10 +++++----- js/plugins.js | 2 +- js/websockets.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 0babf57..b2a192c 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -675,20 +675,20 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $scope.showSidebar = !$scope.showSidebar; } }; - + $scope.openNick = function() { if (document.body.clientWidth < $scope.mobile_cutoff) { - if($scope.nonicklist) { + if($scope.nonicklist) { $scope.nonicklist = false; - } + } } }; $scope.closeNick = function() { if (document.body.clientWidth < $scope.mobile_cutoff) { - if(!$scope.nonicklist) { + if(!$scope.nonicklist) { $scope.nonicklist = true; - } + } } }; diff --git a/js/plugins.js b/js/plugins.js index 63420a3..8e8c0df 100644 --- a/js/plugins.js +++ b/js/plugins.js @@ -279,7 +279,7 @@ plugins.factory('userPlugins', function() { } }); asciinemaPlugin.name = "ascii cast"; - + return { plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin] }; diff --git a/js/websockets.js b/js/websockets.js index 3e49781..598da14 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -3,10 +3,10 @@ var websockets = angular.module('ngWebsockets', []); websockets.factory('ngWebsockets', ['$rootScope','$q', function($rootScope, $q) { - + this.protocol = null; - + var ws = null; var callbacks = {}; var currentCallBackId = 0; @@ -24,7 +24,7 @@ function($rootScope, $q) { }; - + /* * Returns the current callback id */ From 18dd4eae1fe1864510419522fb4c99dc5c65af42 Mon Sep 17 00:00:00 2001 From: Felix Eckhofer Date: Mon, 24 Feb 2014 11:29:50 +0100 Subject: [PATCH 3/3] Replace tabs with spaces --- js/plugins.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/plugins.js b/js/plugins.js index 8e8c0df..ba6fa87 100644 --- a/js/plugins.js +++ b/js/plugins.js @@ -271,12 +271,12 @@ plugins.factory('userPlugins', function() { */ var asciinemaPlugin = new Plugin(function(message) { - var regexp = /http(s){0,1}:\/\/(www\.){0,1}asciinema.org\/a\/(\d+)/; - var match = message.match(regexp); - if (match) { + var regexp = /http(s){0,1}:\/\/(www\.){0,1}asciinema.org\/a\/(\d+)/; + var match = message.match(regexp); + if (match) { var id = match[3]; return ""; - } + } }); asciinemaPlugin.name = "ascii cast";