perf: optimize 'side_tools' configuration item of the theme _config.yml
This commit is contained in:
parent
4ab5189cb2
commit
77892feeaa
|
@ -1,16 +1,19 @@
|
|||
<%- js([
|
||||
'js/utils.js',
|
||||
'js/header-shrink.js',
|
||||
'js/dark-light-toggle.js',
|
||||
'js/main.js'
|
||||
]) %>
|
||||
|
||||
<% if (theme.local_search.enable && config.search) { %>
|
||||
<%- js('js/local-search.js') %>
|
||||
<% if (theme.side_tools.enable) { %>
|
||||
<%- js('js/dark-light-toggle.js') %>
|
||||
|
||||
<% if (theme.back2top.enable) { %>
|
||||
<%- js('js/back2top.js') %>
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
<% if (theme.back2top.enable) { %>
|
||||
<%- js('js/back2top.js') %>
|
||||
<% if (theme.local_search.enable && config.search) { %>
|
||||
<%- js('js/local-search.js') %>
|
||||
<% } %>
|
||||
|
||||
<% if (is_post()) { %>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
</div>
|
||||
|
||||
<% if (theme.side_tools.enable) { %>
|
||||
<div class="sidebar-tools-2">
|
||||
<div class="bottom-sidebar-tools">
|
||||
<%- partial('_partial/tools2') %>
|
||||
</div>
|
||||
<% } %>
|
||||
|
|
|
@ -15,7 +15,8 @@ hexo.extend.helper.register('export_config', function () {
|
|||
localsearch: theme.local_search,
|
||||
codeblock: theme.codeblock,
|
||||
toc: theme.toc,
|
||||
back2top: theme.back2top
|
||||
back2top: theme.back2top,
|
||||
side_tools: theme.side_tools
|
||||
};
|
||||
if (config.search) {
|
||||
exportConfig.path = config.search.path;
|
||||
|
|
|
@ -166,7 +166,7 @@ $page-aside-width = 258px;
|
|||
}
|
||||
|
||||
|
||||
.sidebar-tools-2 {
|
||||
.bottom-sidebar-tools {
|
||||
position: fixed;
|
||||
bottom: $component-interspace;
|
||||
right: $component-interspace;
|
||||
|
|
|
@ -56,7 +56,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
},
|
||||
|
||||
initModeToggleButton() {
|
||||
this.modeToggleButton_dom && this.modeToggleButton_dom.addEventListener('click', () => {
|
||||
this.modeToggleButton_dom.addEventListener('click', () => {
|
||||
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
this.setItemUtil('light-mode', 'dark');
|
||||
} else {
|
||||
|
@ -64,7 +64,6 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ILS.utils.modeToggle.initModeStatus();
|
||||
|
|
|
@ -67,12 +67,13 @@ ILS.utils = {
|
|||
|
||||
// tools
|
||||
registerToolsButtonClick() {
|
||||
if (!CONFIG.side_tools.enable) return;
|
||||
|
||||
let isOpen = false
|
||||
let isOpen = false;
|
||||
this.toolsMenuButton_dom = document.querySelector('.tools-button');
|
||||
this.toolsWrapperList_dom = document.querySelectorAll('.tools-wrapper li');
|
||||
|
||||
this.toolsMenuButton_dom && this.toolsMenuButton_dom.addEventListener('click', e => {
|
||||
this.toolsMenuButton_dom.addEventListener('click', e => {
|
||||
isOpen = !isOpen;
|
||||
|
||||
const toolsMenuButtonIcon = this.toolsMenuButton_dom.querySelector('i');
|
||||
|
|
Loading…
Reference in New Issue