From 372940305c2fe6d39fe6cab2a4eacc9724a8a47c Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Sun, 28 Apr 2024 00:31:49 +0800 Subject: [PATCH] Remove muse.js --- scripts/filters/minify.js | 4 ---- source/js/next-boot.js | 1 + source/js/schemes/muse.js | 12 ------------ source/js/utils.js | 13 +++++++++++++ 4 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 source/js/schemes/muse.js diff --git a/scripts/filters/minify.js b/scripts/filters/minify.js index 310e1a8f8..4082e843b 100644 --- a/scripts/filters/minify.js +++ b/scripts/filters/minify.js @@ -40,10 +40,6 @@ hexo.extend.filter.register('after_generate', () => { hexo.route.remove('js/comments-buttons.js'); } - if (theme.scheme === 'Pisces' || theme.scheme === 'Gemini') { - hexo.route.remove('js/schemes/muse.js'); - } - if (theme.sidebar.display === 'remove') { hexo.route.remove('js/sidebar.js'); } diff --git a/source/js/next-boot.js b/source/js/next-boot.js index fceb80bb2..2e656c37e 100644 --- a/source/js/next-boot.js +++ b/source/js/next-boot.js @@ -6,6 +6,7 @@ NexT.boot.registerEvents = function() { NexT.utils.registerScrollPercent(); NexT.utils.registerCanIUseTag(); + NexT.utils.updateFooterPosition(); // Mobile top menu bar. document.querySelector('.site-nav-toggle .toggle').addEventListener('click', event => { diff --git a/source/js/schemes/muse.js b/source/js/schemes/muse.js deleted file mode 100644 index bdd9fc51e..000000000 --- a/source/js/schemes/muse.js +++ /dev/null @@ -1,12 +0,0 @@ -document.addEventListener('DOMContentLoaded', () => { - - function updateFooterPosition() { - const footer = document.querySelector('.footer'); - const containerHeight = document.querySelector('.main').offsetHeight + footer.offsetHeight; - footer.classList.toggle('footer-fixed', containerHeight <= window.innerHeight); - } - - updateFooterPosition(); - window.addEventListener('resize', updateFooterPosition); - window.addEventListener('scroll', updateFooterPosition, { passive: true }); -}); diff --git a/source/js/utils.js b/source/js/utils.js index 808d838fe..ebd85526a 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -415,6 +415,19 @@ NexT.utils = { sidebar.classList.replace(activeClassNames[1 - index], activeClassNames[index]); }, + updateFooterPosition: function() { + if (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') return; + function updateFooterPosition() { + const footer = document.querySelector('.footer'); + const containerHeight = document.querySelector('.main').offsetHeight + footer.offsetHeight; + footer.classList.toggle('footer-fixed', containerHeight <= window.innerHeight); + } + + updateFooterPosition(); + window.addEventListener('resize', updateFooterPosition); + window.addEventListener('scroll', updateFooterPosition, { passive: true }); + }, + getScript: function(src, options = {}, legacyCondition) { if (typeof options === 'function') { return this.getScript(src, {