From bb7e05d17478316ea8685f18dde7f8fbe2450974 Mon Sep 17 00:00:00 2001 From: XPoet Date: Tue, 5 Jan 2021 17:01:15 +0800 Subject: [PATCH] fix: fixed js files load error --- layout/_partial/pjax/pjax.ejs | 2 +- scripts/helpers/export-config.js | 1 + source/js/main.js | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/layout/_partial/pjax/pjax.ejs b/layout/_partial/pjax/pjax.ejs index cec107d..4edac82 100644 --- a/layout/_partial/pjax/pjax.ejs +++ b/layout/_partial/pjax/pjax.ejs @@ -10,11 +10,11 @@ history: true, debug: false, cacheBust: false, + timeout: 0, // analytics: false, // currentUrlFullReload: false, // scrollRestoration: false, // scrollTo: true, - // timeout: 0, }); window.addEventListener('pjax:complete', () => { diff --git a/scripts/helpers/export-config.js b/scripts/helpers/export-config.js index 9f36161..63d641f 100644 --- a/scripts/helpers/export-config.js +++ b/scripts/helpers/export-config.js @@ -40,6 +40,7 @@ hexo.extend.helper.register('export_config', function () { toc: theme.toc, style: theme.style, local_search: theme.local_search, + code_copy: theme.code_copy, side_tools: theme.side_tools, pjax: theme.pjax, version: theme.version, diff --git a/source/js/main.js b/source/js/main.js index 1d7df8f..6c42b24 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -11,9 +11,15 @@ window.addEventListener('DOMContentLoaded', () => { KEEP.initUtils(); KEEP.initHeaderShrink(); KEEP.initModeToggle(); - KEEP.initLocalSearch(); KEEP.initBack2Top(); - KEEP.initCodeCopy(); + + if (KEEP.theme_config.local_search.enable === true) { + KEEP.initLocalSearch(); + } + + if (KEEP.theme_config.code_copy.enable === true) { + KEEP.initCodeCopy(); + } } KEEP.refresh();