diff --git a/layout/includes/head/config.pug b/layout/includes/head/config.pug index 88a8633..74e4b91 100644 --- a/layout/includes/head/config.pug +++ b/layout/includes/head/config.pug @@ -112,7 +112,7 @@ script. baiduPush: !{baiduPush}, highlightCopy: !{highlightCopy}, highlightLang: !{highlightLang}, - highlightShrink: !{highlightShrink}, + highlightShrink: '!{highlightShrink}', isFontAwesomeV5: !{isFontAwesomeV5} } diff --git a/source/js/main.js b/source/js/main.js index 67b359b..7762900 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -271,16 +271,16 @@ $(function () { * 代碼收縮 */ const $highlightTools = $('.highlight-tools') - if (isHighlightShrink === true) { + if (isHighlightShrink === 'true') { $highlightTools.append('') - } else if (isHighlightShrink === false) { + } else if (isHighlightShrink === 'false') { $highlightTools.append('') } $(document).on('click', '.highlight-tools >.code-expand', function () { var $table = $(this).parent().next() if ($(this).hasClass('code-closed')) { - $table.css('display', '') + $table.css('display', 'block') $(this).removeClass('code-closed') } else { $table.css('display', 'none') @@ -668,8 +668,7 @@ $(function () { var isFontAwesomeV5 = GLOBAL_CONFIG.isFontAwesomeV5 var $darkModeButtom = $('#darkmode') if (typeof autoChangeMode !== 'undefined') { - if (Cookies.get('theme') === 'dark') changeLightIcon() - else changeDarkIcon() + document.documentElement.getAttribute('data-theme') === 'dark' ? changeLightIcon() : changeDarkIcon() } function changeLightIcon () {