From 9a8f5517b6003abf0663a650f0f75dfb29c323d8 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Wed, 13 May 2020 12:25:11 +0200 Subject: [PATCH] add a cache for the top menu update (#19) --- templates/css/stylesheet.php | 1 - templates/js/script.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/templates/css/stylesheet.php b/templates/css/stylesheet.php index 6311518..adae8c3 100644 --- a/templates/css/stylesheet.php +++ b/templates/css/stylesheet.php @@ -22,7 +22,6 @@ } - #nextcloud { display: none; diff --git a/templates/js/script.php b/templates/js/script.php index 2ce91ca..090205b 100644 --- a/templates/js/script.php +++ b/templates/js/script.php @@ -73,6 +73,8 @@ sideMenuContainer.attr('data-externalsitesintopmenu', '1') + var menuCache = null + var updateTopMenu = function() { var breakpointMobileWidth = 1024 var menu = $('#appmenu') @@ -87,6 +89,12 @@ var navigationApps = $('#apps ul') var appCount = null + var currentMenuCache = menu.html() + menu.next().html() + + if (currentMenuCache === menuCache) { + return + } + navigationApps.html('') apps.each(function(i, app) { @@ -175,6 +183,8 @@ } else { moreApps.show() } + + menuCache = menu.html() + menu.next().html() } setInterval(updateTopMenu, 50)