From b0ded62b1f7c43a32e319fa8e4ee6beefaddf3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Fri, 25 Feb 2022 21:44:18 +0100 Subject: [PATCH] chore: update perfect-scrollbar #210 --- static/js/theme.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/static/js/theme.js b/static/js/theme.js index 865dfc3fde..8bd7d72af4 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -27,7 +27,7 @@ function getScrollBarWidth() { function setMenuHeight() { $('#sidebar .highlightable').height($('#sidebar').innerHeight() - $('#header-wrapper').height() - 40); - $('#sidebar .highlightable').perfectScrollbar('update'); + ps && ps.update(); } function fallbackMessage(action) { @@ -228,6 +228,7 @@ $(window).scroll(function() { })(jQuery, 'smartresize'); +var ps = null; jQuery(function() { restoreTabSelections(); initMermaid(); @@ -240,20 +241,17 @@ jQuery(function() { }); var sidebarStatus = searchStatus = 'open'; - $('#sidebar .highlightable').perfectScrollbar(); + ps = new PerfectScrollbar('#sidebar .highlightable'); setMenuHeight(); jQuery('#overlay').on('click', function() { jQuery(document.body).toggleClass('sidebar-hidden'); sidebarStatus = (jQuery(document.body).hasClass('sidebar-hidden') ? 'closed' : 'open'); - return false; }); - jQuery('[data-sidebar-toggle]').on('click', function() { jQuery(document.body).toggleClass('sidebar-hidden'); sidebarStatus = (jQuery(document.body).hasClass('sidebar-hidden') ? 'closed' : 'open'); - return false; }); jQuery('[data-clear-history-toggle]').on('click', function() {