Skip to content

Commit

Permalink
Fix app menu calculation for random size of the right header
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Nov 2, 2018
1 parent f13c7dd commit 76fdc21
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -1562,13 +1562,14 @@ function initCore() {

var resizeMenu = function() {
var appList = $('#appmenu li');
var headerWidth = $('.header-left').outerWidth() - $('#nextcloud').outerWidth();
var rightHeaderWidth = $('.header-right').outerWidth();
var headerWidth = $('header').outerWidth();
var usePercentualAppMenuLimit = 0.33;
var minAppsDesktop = 8;
var availableWidth = headerWidth - $(appList).width();
var availableWidth = headerWidth - $('#nextcloud').outerWidth() - (rightHeaderWidth > 210 ? rightHeaderWidth : 210)
var isMobile = $(window).width() < 768;
if (!isMobile) {
availableWidth = headerWidth * usePercentualAppMenuLimit;
availableWidth = availableWidth * usePercentualAppMenuLimit;
}
var appCount = Math.floor((availableWidth / $(appList).width()));
if (isMobile && appCount > minAppsDesktop) {
Expand Down Expand Up @@ -1613,7 +1614,7 @@ function initCore() {
}
};
$(window).resize(resizeMenu);
resizeMenu();
setTimeout(resizeMenu, 0);

// just add snapper for logged in users
if($('#app-navigation').length && !$('html').hasClass('lte9')) {
Expand Down

0 comments on commit 76fdc21

Please sign in to comment.