Merge pull request #5420 from nextcloud/stable12-appmenu-fixes
[stable12] App menu fixes
This commit is contained in:
commit
ab837da40b
|
@ -1511,18 +1511,31 @@ function initCore() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var resizeMenu = function() {
|
var resizeMenu = function() {
|
||||||
var maxApps = 8;
|
|
||||||
var appList = $('#appmenu li');
|
var appList = $('#appmenu li');
|
||||||
var availableWidth = $('#header-left').width() - $('#nextcloud').width() - 44;
|
var headerWidth = $('#header-left').width() - $('#nextcloud').width()
|
||||||
var appCount = Math.floor((availableWidth)/44);
|
var usePercentualAppMenuLimit = 0.33;
|
||||||
// show a maximum of 8 apps
|
var minAppsDesktop = 8;
|
||||||
if(appCount >= maxApps) {
|
var availableWidth = headerWidth - $(appList).width();
|
||||||
appCount = maxApps;
|
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
|
// show at least 2 apps in the popover
|
||||||
if(appList.length-1-appCount >= 1) {
|
if(appList.length-1-appCount >= 1) {
|
||||||
appCount--;
|
appCount--;
|
||||||
}
|
}
|
||||||
|
// show at least one icon
|
||||||
|
if(appCount < 1) {
|
||||||
|
appCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$('#more-apps a').removeClass('active');
|
$('#more-apps a').removeClass('active');
|
||||||
var lastShownApp;
|
var lastShownApp;
|
||||||
|
|
Loading…
Reference in New Issue