From c88e4e2feb0387c98be0dbd845c25e3bcec2ea4a Mon Sep 17 00:00:00 2001 From: Patrik Kernstock Date: Sun, 4 Jun 2017 03:26:40 +0200 Subject: [PATCH 1/3] Now using dynamic percentual appmenu limit Signed-off-by: Patrik Kernstock --- core/js/js.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/js/js.js b/core/js/js.js index 80c62e70116..2cb94c9cf2b 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1512,12 +1512,17 @@ function initCore() { var resizeMenu = function() { var appList = $('#appmenu li'); - var availableWidth = $('#header-left').width() - $('#nextcloud').width() - 44; + var usePercentualAppMenuLimit = 33; + var availableWidth = (($('#header-left').width() - $('#nextcloud').width()) / 100 * usePercentualAppMenuLimit); var appCount = Math.floor((availableWidth)/44); // show at least 2 apps in the popover if(appList.length-1-appCount >= 1) { appCount--; } + // show at least one icon + if(appCount < 1) { + appCount = 1; + } $('#more-apps a').removeClass('active'); var lastShownApp; From c0c5df31c08d6a4927a3d0128007a51d73a744b4 Mon Sep 17 00:00:00 2001 From: Patrik Kernstock Date: Sat, 10 Jun 2017 17:33:01 +0200 Subject: [PATCH 2/3] Decimal percentage, dynamic appIcon width Signed-off-by: Patrik Kernstock --- core/js/js.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index 2cb94c9cf2b..7264198dc8c 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1512,9 +1512,9 @@ function initCore() { var resizeMenu = function() { var appList = $('#appmenu li'); - var usePercentualAppMenuLimit = 33; - var availableWidth = (($('#header-left').width() - $('#nextcloud').width()) / 100 * usePercentualAppMenuLimit); - var appCount = Math.floor((availableWidth)/44); + var usePercentualAppMenuLimit = 0.33; + var availableWidth = (($('#header-left').width() - $('#nextcloud').width()) * usePercentualAppMenuLimit); + var appCount = Math.floor((availableWidth / $(appList).width())); // show at least 2 apps in the popover if(appList.length-1-appCount >= 1) { appCount--; From cec2893d3bd35ef0a99ec832c241e7a516f5da14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 14 Jun 2017 11:08:45 +0200 Subject: [PATCH 3/3] Show at least 8 icons, don't use percentage on mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/js/js.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/js/js.js b/core/js/js.js index 7264198dc8c..8f16d02f96f 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1512,9 +1512,22 @@ function initCore() { var resizeMenu = function() { var appList = $('#appmenu li'); + var headerWidth = $('#header-left').width() - $('#nextcloud').width() var usePercentualAppMenuLimit = 0.33; - var availableWidth = (($('#header-left').width() - $('#nextcloud').width()) * usePercentualAppMenuLimit); + var minAppsDesktop = 8; + var availableWidth = headerWidth - $(appList).width(); + var isMobile = $(window).width() < 768; + if (!isMobile) { + availableWidth = headerWidth * usePercentualAppMenuLimit; + } var appCount = Math.floor((availableWidth / $(appList).width())); + if (isMobile && appCount > minAppsDesktop) { + appCount = minAppsDesktop; + } + if (!isMobile && appCount < minAppsDesktop) { + appCount = minAppsDesktop; + } + // show at least 2 apps in the popover if(appList.length-1-appCount >= 1) { appCount--;