From d44786e9b7249553099673827d7edb5b0e475d1b Mon Sep 17 00:00:00 2001 From: Patrik Kernstock Date: Fri, 26 May 2017 19:39:22 +0200 Subject: [PATCH 1/4] Closed #5121, remove appmenu limit Signed-off-by: Patrik Kernstock --- core/js/js.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index ffbe438dc9..ee4b03dd99 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1511,14 +1511,9 @@ function initCore() { } var resizeMenu = function() { - var maxApps = 8; var appList = $('#appmenu li'); var availableWidth = $('#header-left').width() - $('#nextcloud').width() - 44; var appCount = Math.floor((availableWidth)/44); - // show a maximum of 8 apps - if(appCount >= maxApps) { - appCount = maxApps; - } // show at least 2 apps in the popover if(appList.length-1-appCount >= 1) { appCount--; From 6acabd64ca1e9ecd04da7ccf2ff50a9f0b21975b Mon Sep 17 00:00:00 2001 From: Patrik Kernstock Date: Sun, 4 Jun 2017 03:26:40 +0200 Subject: [PATCH 2/4] 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 ee4b03dd99..b878cd35b7 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 073d5dbc85906da8cf0fc7556ada4fbbe8ce0db0 Mon Sep 17 00:00:00 2001 From: Patrik Kernstock Date: Sat, 10 Jun 2017 17:33:01 +0200 Subject: [PATCH 3/4] 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 b878cd35b7..80b36bad05 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 02a63e94289286f7d95d2adb31bb034e00127cb8 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 4/4] 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 80b36bad05..2aa7bf1bc5 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--;