diff --git a/README.md b/README.md index 0d0ac47..fac6714 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,8 @@ ![version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly) ![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff) -![hexo version](https://img.shields.io/badge/hexo-4.0+-0e83c) +![hexo version](https://img.shields.io/badge/hexo-4.2+-0e83c) ![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly?color=green) -![nodejs version](https://img.shields.io/badge/node.js-8.0+-yellow) ![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/) diff --git a/README_CN.md b/README_CN.md index 84b0645..b8b7890 100644 --- a/README_CN.md +++ b/README_CN.md @@ -2,9 +2,8 @@ ![version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly) ![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff) -![hexo version](https://img.shields.io/badge/hexo-4.0+-0e83c) +![hexo version](https://img.shields.io/badge/hexo-4.2+-0e83c) ![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly?color=green) -![nodejs version](https://img.shields.io/badge/node.js-8.0+-yellow) ![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) diff --git a/_config.yml b/_config.yml index 035c173..056433d 100644 --- a/_config.yml +++ b/_config.yml @@ -91,14 +91,14 @@ favicon: /img/favicon.png # Avatar (頭像) avatar: - img: /img/avatar.png + img: effect: false # the banner image of home page index_img: # if the banner of page not setting, it will show the top_img -default_top_img: https://i.loli.net/2020/05/01/IuWi8QbHvzjlOPw.jpg +default_top_img: # the banner image of archive page archive_img: @@ -557,9 +557,10 @@ font: # Font settings for the site title and site subtitle # 左上角網站名字 主頁居中網站名字 -blog_title_font: - font_link: https://fonts.googleapis.com/css?family=Titillium+Web&display=swap - font-family: Titillium Web, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif + +# blog_title_font: + # font_link: https://fonts.googleapis.com/css?family=Titillium+Web&display=swap + # font-family: Titillium Web, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif # The setting of divider icon (水平分隔線圖標設置) hr_icon: @@ -654,7 +655,7 @@ newest_comments: appId: # leancloud application app id appKey: # leancloud application app key serverURL: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in) - default_avatar: mp # mp/identicon/monsterid/wavatar/retro/robohash/blank + default_avatar: # mp/identicon/monsterid/wavatar/retro/robohash/blank github_issues: enable: false repo: @@ -762,7 +763,7 @@ baidu_push: false # https://instant.page/ # prefetch (預加載) -instantpage: true +instantpage: false # https://github.com/vinta/pangu.js # Insert a space between Chinese character and English character (中英文之間添加空格) @@ -773,7 +774,7 @@ pangu: # Lazyload (圖片懶加載) # https://github.com/verlok/lazyload lazyload: - enable: true + enable: false post: /img/loading.gif # PWA diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 5826612..0979f90 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -15,7 +15,7 @@ div script(src=url_for(theme.CDN.instantpage) type="module" defer) if theme.lazyload.enable - script(src=url_for(theme.CDN.lazyload) async) + script(src=url_for(theme.CDN.lazyload)) if (theme.snackbar && theme.snackbar.enable) script(src=url_for(theme.CDN.snackbar)) diff --git a/layout/includes/head.pug b/layout/includes/head.pug index 766ea79..84374ab 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -77,7 +77,7 @@ if theme.algolia_search.enable !=partial('includes/head/analytics', {}, {cache:theme.fragment_cache}) //- font -if theme.blog_title_font.font_link +if theme.blog_title_font && theme.blog_title_font.font_link link(rel='stylesheet' href=url_for(theme.blog_title_font.font_link)) //- global config diff --git a/layout/includes/head/darkmode.pug b/layout/includes/head/darkmode.pug index d83c7a3..c3e775d 100644 --- a/layout/includes/head/darkmode.pug +++ b/layout/includes/head/darkmode.pug @@ -25,7 +25,6 @@ if theme.darkmode.enable if (isLightMode) activateLightMode() else if (isDarkMode) activateDarkMode() else if (isNotSpecified || hasNoSupport) { - console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.') var now = new Date() var hour = now.getHours() var isNight = hour <= 6 || hour >= 18 diff --git a/layout/includes/head/preconnect.pug b/layout/includes/head/preconnect.pug index 19fb3a8..3d7b9e9 100644 --- a/layout/includes/head/preconnect.pug +++ b/layout/includes/head/preconnect.pug @@ -12,7 +12,7 @@ if theme.tencent_analytics if theme.cnzz_analytics link(rel="preconnect" href="//s4.cnzz.com") -if theme.blog_title_font.font_link && theme.blog_title_font.font_link.indexOf('//fonts.googleapis.com') != -1 +if theme.blog_title_font && theme.blog_title_font.font_link && theme.blog_title_font.font_link.indexOf('//fonts.googleapis.com') != -1 link(rel="preconnect" href="//fonts.googleapis.com" crossorigin) if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv diff --git a/layout/includes/header/nav.pug b/layout/includes/header/nav.pug index 570d057..332adf6 100644 --- a/layout/includes/header/nav.pug +++ b/layout/includes/header/nav.pug @@ -2,7 +2,7 @@ nav#nav span#blog_name a#site-name(href=url_for('/')) #[=config.title] - span.menus + span#menus if (theme.algolia_search.enable || theme.local_search.enable) #search_button a.site-page.social-icon.search @@ -10,7 +10,7 @@ nav#nav span=' '+_p('search') !=fragment_cache('menus', function(){return partial('includes/header/menu_item')}) - span.toggle-menu.close + span#toggle-menu.close a.site-page i.fas.fa-bars.fa-fw diff --git a/layout/includes/third-party/comments/disqus.pug b/layout/includes/third-party/comments/disqus.pug index dcbe896..fd44d2a 100644 --- a/layout/includes/third-party/comments/disqus.pug +++ b/layout/includes/third-party/comments/disqus.pug @@ -25,7 +25,7 @@ script. } if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) loadComment(document.getElementById('disqus_thread'), loadDisqus) + if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqus) else loadDisqus() } else { function loadOtherComment () { diff --git a/layout/includes/third-party/comments/disqusjs.pug b/layout/includes/third-party/comments/disqusjs.pug index 76d7b85..47e5c33 100644 --- a/layout/includes/third-party/comments/disqusjs.pug +++ b/layout/includes/third-party/comments/disqusjs.pug @@ -34,7 +34,7 @@ script. } if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) loadComment(document.getElementById('disqus_thread'), loadDisqusjs) + if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqusjs) else loadDisqusjs() } else { diff --git a/layout/includes/third-party/comments/facebook_comments.pug b/layout/includes/third-party/comments/facebook_comments.pug index 65a1fbd..cf28c34 100644 --- a/layout/includes/third-party/comments/facebook_comments.pug +++ b/layout/includes/third-party/comments/facebook_comments.pug @@ -16,7 +16,7 @@ script. } if ('!{theme.comments.use[0]}' === 'Facebook Comments' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment) + if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment) else loadFBComment() } else { function loadOtherComment () { diff --git a/layout/includes/third-party/comments/gitalk.pug b/layout/includes/third-party/comments/gitalk.pug index 834b42a..08bc422 100644 --- a/layout/includes/third-party/comments/gitalk.pug +++ b/layout/includes/third-party/comments/gitalk.pug @@ -40,7 +40,7 @@ script. } if ('!{theme.comments.use[0]}' === 'Gitalk' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) loadComment(document.getElementById('gitalk-container'), loadGitalk) + if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk) else loadGitalk() } else { function loadOtherComment () { diff --git a/layout/includes/third-party/comments/livere.pug b/layout/includes/third-party/comments/livere.pug index 45dc99e..85b6d78 100644 --- a/layout/includes/third-party/comments/livere.pug +++ b/layout/includes/third-party/comments/livere.pug @@ -16,7 +16,7 @@ script. } if ('!{theme.comments.use[0]}' === 'Livere' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) loadComment(document.getElementById('lv-container'), loadLivere) + if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('lv-container'), loadLivere) else loadLivere() } else { diff --git a/layout/includes/third-party/comments/utterances.pug b/layout/includes/third-party/comments/utterances.pug index 7911a3e..dbd422f 100644 --- a/layout/includes/third-party/comments/utterances.pug +++ b/layout/includes/third-party/comments/utterances.pug @@ -25,7 +25,7 @@ script. } if ('!{theme.comments.use[0]}' === 'Utterances' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) loadComment(document.getElementById('utterances-wrap'), loadUtterances) + if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('utterances-wrap'), loadUtterances) else loadUtterances() } else { function loadOtherComment () { diff --git a/layout/includes/third-party/comments/valine.pug b/layout/includes/third-party/comments/valine.pug index a547529..f2bf9e9 100644 --- a/layout/includes/third-party/comments/valine.pug +++ b/layout/includes/third-party/comments/valine.pug @@ -29,7 +29,7 @@ script. } if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) { - if (!{theme.comments.lazyload}) loadComment(document.querySelector('#vcomment'),loadValine) + if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#vcomment'),loadValine) else setTimeout(() => loadValine(), 0) } else { function loadOtherComment () { diff --git a/layout/includes/third-party/newest-comments/disqus-comment.pug b/layout/includes/third-party/newest-comments/disqus-comment.pug index 9563c2b..334f352 100644 --- a/layout/includes/third-party/newest-comments/disqus-comment.pug +++ b/layout/includes/third-party/newest-comments/disqus-comment.pug @@ -43,7 +43,7 @@ script. result += `
${array[i].content} -
${array[i].nick}
+
${array[i].nick}
` } diff --git a/layout/includes/third-party/newest-comments/github-issues.pug b/layout/includes/third-party/newest-comments/github-issues.pug index 9bd83a2..572cf0d 100644 --- a/layout/includes/third-party/newest-comments/github-issues.pug +++ b/layout/includes/third-party/newest-comments/github-issues.pug @@ -42,7 +42,7 @@ script. result += `
${array[i].content} -
${array[i].nick}
+
${array[i].nick}
` } diff --git a/layout/includes/third-party/newest-comments/leancloud.pug b/layout/includes/third-party/newest-comments/leancloud.pug index 5e410b9..fc927d2 100644 --- a/layout/includes/third-party/newest-comments/leancloud.pug +++ b/layout/includes/third-party/newest-comments/leancloud.pug @@ -16,8 +16,8 @@ script. const getIcon = (icon, mail) => { if (icon) return icon - let defaultIcon = '!{theme.newest_comments.leancloud.default_avatar}' || '404' - let iconUrl = `https://gravatar.loli.net/avatar/${md5(mail.toLowerCase())}?d=${defaultIcon}` + let defaultIcon = '!{ theme.newest_comments.leancloud.default_avatar ? `?d=${theme.newest_comments.leancloud.default_avatar}` : ''}' + let iconUrl = `https://gravatar.loli.net/avatar/${md5(mail.toLowerCase()) + defaultIcon}` return iconUrl } @@ -33,7 +33,7 @@ script. result += `
${array[i].content} -
${array[i].nick}
+
${array[i].nick}
` } diff --git a/layout/includes/third-party/pjax.pug b/layout/includes/third-party/pjax.pug index cd35128..f9f0559 100644 --- a/layout/includes/third-party/pjax.pug +++ b/layout/includes/third-party/pjax.pug @@ -15,7 +15,7 @@ script. '.js-pjax' ] - if (!{theme.Open_Graph_meta && theme.comments.use && theme.comments.use.includes('Livere')}) { + if (!{Boolean(theme.Open_Graph_meta && theme.comments.use && theme.comments.use.includes('Livere'))}) { pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]') } @@ -28,13 +28,13 @@ script. }) document.addEventListener('pjax:complete', function () { - refreshFn() + window.refreshFn() $('script[data-pjax]').each(function () { $(this).parent().append($(this).remove()) }) - GLOBAL_CONFIG.islazyload && lazyLoadInstance.update() + GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update() typeof chatBtnFn === 'function' && chatBtnFn() typeof panguInit === 'function' && panguInit() diff --git a/scripts/helpers/aside_archives.js b/scripts/helpers/aside_archives.js index ee7b118..9112306 100644 --- a/scripts/helpers/aside_archives.js +++ b/scripts/helpers/aside_archives.js @@ -91,7 +91,7 @@ hexo.extend.helper.register('aside_archives', function (options = {}) { if (len > Judge) { result += '
  • ' - result += ` + result += ` ${moreButton}
  • ` } result += '' diff --git a/scripts/helpers/aside_categories.js b/scripts/helpers/aside_categories.js index 03fc885..a787bad 100644 --- a/scripts/helpers/aside_categories.js +++ b/scripts/helpers/aside_categories.js @@ -83,13 +83,13 @@ hexo.extend.helper.register('aside_categories', function (categories, options) { let moreHtml = '' if (categories.length <= limit) return '' moreHtml += '
  • ' - moreHtml += ` + moreHtml += ` ${buttonLabel}
  • ` return moreHtml } - return `