diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-06-17 18:28:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-17 18:28:59 -0500 |
commit | ab837da40b6c2b423bec1d259bdf4b71e6a00930 (patch) | |
tree | 7ae4de2fbb341b46df359b827fbcd63c927920ff /core | |
parent | 0e608188d2cf7d38dfaf7c006ec73a0f2019fd6e (diff) | |
parent | 02a63e94289286f7d95d2adb31bb034e00127cb8 (diff) | |
download | nextcloud-server-ab837da40b6c2b423bec1d259bdf4b71e6a00930.tar.gz nextcloud-server-ab837da40b6c2b423bec1d259bdf4b71e6a00930.zip |
Merge pull request #5420 from nextcloud/stable12-appmenu-fixes
[stable12] App menu fixes
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/core/js/js.js b/core/js/js.js index ffbe438dc9a..2aa7bf1bc55 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1511,18 +1511,31 @@ 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; + var headerWidth = $('#header-left').width() - $('#nextcloud').width() + var usePercentualAppMenuLimit = 0.33; + 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--; } + // show at least one icon + if(appCount < 1) { + appCount = 1; + } $('#more-apps a').removeClass('active'); var lastShownApp; |