From 11c649e97b93bead3c9ac72c8b322c7c57607dd7 Mon Sep 17 00:00:00 2001 From: git710 <710789755@qq.com> Date: Sun, 8 Nov 2020 13:19:36 +0800 Subject: [PATCH] fix: report an error when 'side_tools' config is false --- source/js/dark-light-toggle.js | 2 +- source/js/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/js/dark-light-toggle.js b/source/js/dark-light-toggle.js index 398bfcb..ee7c494 100644 --- a/source/js/dark-light-toggle.js +++ b/source/js/dark-light-toggle.js @@ -56,7 +56,7 @@ window.addEventListener('DOMContentLoaded', () => { }, initModeToggleButton() { - this.modeToggleButton_dom.addEventListener('click', () => { + this.modeToggleButton_dom && this.modeToggleButton_dom.addEventListener('click', () => { if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { this.setItemUtil('light-mode', 'dark'); } else { diff --git a/source/js/utils.js b/source/js/utils.js index ca902c7..8ffa9cf 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -72,7 +72,7 @@ ILS.utils = { this.toolsMenuButton_dom = document.querySelector('.tools-button'); this.toolsWrapperList_dom = document.querySelectorAll('.tools-wrapper li'); - this.toolsMenuButton_dom.addEventListener('click', e => { + this.toolsMenuButton_dom && this.toolsMenuButton_dom.addEventListener('click', e => { isOpen = !isOpen; const toolsMenuButtonIcon = this.toolsMenuButton_dom.querySelector('i');