From dd97c0f316bc2f557cfe1fc8cfd3e8066bb8200a Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 4 Mar 2021 17:00:47 +0100 Subject: [PATCH] Fix darkmode in mobile theme --- pixelegg/js/fw_mobile.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pixelegg/js/fw_mobile.js b/pixelegg/js/fw_mobile.js index 6df3f2f5b9..a84566af64 100644 --- a/pixelegg/js/fw_mobile.js +++ b/pixelegg/js/fw_mobile.js @@ -404,6 +404,7 @@ $avatar.off().on('click',function(){ $sidebar.toggleClass('avatarSubmenu',!$sidebar.hasClass('avatarSubmenu')); }); + jQuery('#topmenu_info_darkmode').click(function(){window.framework.toggle_darkmode(this);}); }, /** @@ -1039,21 +1040,23 @@ * * @param node */ - toggle_darkmode: function() + toggle_darkmode: function(_node) { - let node = document.getElementById('topmenu_darkmode'); + let node = _node || document.getElementById('topmenu_darkmode'); let state = node.classList.contains('darkmode_on'); egw.set_preference('common', 'darkmode',state?'0':'1'); this._setDarkMode(state?'0':'1'); if (state == 1) { node.classList.remove('darkmode_on'); + if (node.hasChildNodes()) node.children[0].classList.remove('darkmode_on'); node.title = egw.lang('light mode'); } else { node.classList.add('darkmode_on'); node.title = egw.lang('dark mode'); + if (node.hasChildNodes()) node.children[0].classList.add('darkmode_on'); } } });