From 736638058bcad536ccd6b95481181844614433ae Mon Sep 17 00:00:00 2001 From: CCKNBC Date: Sun, 12 Mar 2023 18:06:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(yuque):=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- _config.butterfly.yml | 17 +++++--- package.json | 2 +- themes/butterfly/README.md | 2 +- themes/butterfly/README_CN.md | 2 +- themes/butterfly/_config.yml | 18 +++----- .../layout/includes/additional-js.pug | 2 +- themes/butterfly/layout/includes/head.pug | 4 +- .../layout/includes/loading/pace.pug | 9 ++++ .../third-party/card-post-count/fb.pug | 2 +- .../includes/third-party/chat/gitter.pug | 43 ------------------- .../includes/third-party/chat/index.pug | 2 - .../includes/third-party/chat/messenger.pug | 2 +- .../comments/facebook_comments.pug | 2 +- .../includes/third-party/search/algolia.pug | 4 +- themes/butterfly/package.json | 2 +- themes/butterfly/plugins.yml | 20 ++++----- themes/butterfly/scripts/events/cdn.js | 15 ++++--- .../butterfly/scripts/filters/random_cover.js | 2 +- themes/butterfly/scripts/helpers/page.js | 2 +- themes/butterfly/scripts/tag/gallery.js | 15 ++----- .../butterfly/source/css/_layout/aside.styl | 2 +- themes/butterfly/source/js/utils.js | 25 ++++++++++- 23 files changed, 89 insertions(+), 109 deletions(-) delete mode 100644 themes/butterfly/layout/includes/third-party/chat/gitter.pug diff --git a/README.md b/README.md index a8a4b915..95956904 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ ## [CC的部落格](https://blog.ccknbc.cc) -路过点个star吧,不为什么就是求求了 +一个全是Bug的部落格 ## 镜像站点 -{% note success flat %} 以下排名不分先后,请选择适合自己访问较快的即可
**[GitHub](https://github.blog.ccknbc.cc) | [GitLab](https://gitlab.blog.ccknbc.cc) | [Gitee](https://ccknbc.gitee.io) | [Bitbucket](https://ccknbc.bitbucket.io) | [Vercel](https://vercel.blog.ccknbc.cc) | [Netlify](https://netlify.blog.ccknbc.cc) | [CloudFlare](https://cloudflare.blog.ccknbc.cc)** {% endnote %} +以下排名不分先后,请选择适合自己访问较快的即可
**[GitHub](https://github.blog.ccknbc.cc) | [GitLab](https://gitlab.blog.ccknbc.cc) | [Gitee](https://ccknbc.gitee.io) | [Bitbucket](https://ccknbc.bitbucket.io) | [Vercel](https://vercel.blog.ccknbc.cc) | [Netlify](https://netlify.blog.ccknbc.cc) | [CloudFlare](https://cloudflare.blog.ccknbc.cc)** ## 站点源码 diff --git a/_config.butterfly.yml b/_config.butterfly.yml index 7266a6ea..04954527 100644 --- a/_config.butterfly.yml +++ b/_config.butterfly.yml @@ -1094,9 +1094,10 @@ CDN: # translate: # local_search: # algolia_js: - - # algolia_search_v4: - # instantsearch_v4: + # algolia_search: + # instantsearch: + # docsearch_js: + # docsearch_css: # pjax: # gitalk: # gitalk_css: @@ -1112,7 +1113,6 @@ CDN: # mathjax: # katex: # katex_copytex: - # katex_copytex_css: # mermaid: # canvas_ribbon: # canvas_fluttering_ribbon: @@ -1121,8 +1121,8 @@ CDN: # instantpage: # typed: # pangu: - # fancybox_css_v4: - # fancybox_v4: + # fancybox_css: + # fancybox: # medium_zoom: # snackbar_css: # snackbar: @@ -1130,7 +1130,7 @@ CDN: # fireworks: # click_heart: # ClickShowText: - # fontawesomeV6: + # fontawesome: # flickr_justified_gallery_js: # flickr_justified_gallery_css: # aplayer_css: @@ -1139,6 +1139,9 @@ CDN: # prismjs_js: # prismjs_lineNumber_js: # prismjs_autoloader: + # artalk_js: + # artalk_css: + # busuanzi: # other ccknbc: https://cdn.jsdelivr.ren/gh/ccknbc-backup/cdn/js/ccknbc.js \ No newline at end of file diff --git a/package.json b/package.json index 2d5292ba..fe9c2456 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "login": "ccknbc", "repo": "blog", "onlyPublished": true, - "onlyPublic": true + "onlyPublic": false }, "hexo": { "version": "6.3.0" diff --git a/themes/butterfly/README.md b/themes/butterfly/README.md index 8b7b6e36..284ff412 100644 --- a/themes/butterfly/README.md +++ b/themes/butterfly/README.md @@ -81,7 +81,7 @@ npm i hexo-theme-butterfly - [x] Share (AddThis/Sharejs/Addtoany) - [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk) - [x] Multiple Comment System Support -- [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp/messenger) +- [x] Online Chats (Chatra/Tidio/Daovoice/Crisp/messenger) - [x] Web analytics - [x] Google AdSense - [x] Webmaster Verification diff --git a/themes/butterfly/README_CN.md b/themes/butterfly/README_CN.md index 1dcfc962..f67c2e38 100644 --- a/themes/butterfly/README_CN.md +++ b/themes/butterfly/README_CN.md @@ -81,7 +81,7 @@ theme: butterfly - [x] 多種分享系統(AddThis/Sharejs/Addtoany) - [X] 多種評論系統(Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk) - [x] 支持雙評論部署 -- [x] 多種在線聊天(Chatra/Tidio/Daovoice/Gitter/Crisp/messenger) +- [x] 多種在線聊天(Chatra/Tidio/Daovoice/Crisp/messenger) - [x] 多種分析系統 - [x] 谷歌廣告/手動廣告位置 - [x] 各種站長驗證(Google/Bing/Baidu/360/Yandex) diff --git a/themes/butterfly/_config.yml b/themes/butterfly/_config.yml index dea86a33..db176703 100644 --- a/themes/butterfly/_config.yml +++ b/themes/butterfly/_config.yml @@ -416,12 +416,6 @@ daovoice: enable: false app_id: -# gitter -# https://gitter.im/ -gitter: - enable: false - room: - # crisp # https://crisp.chat/en/ crisp: @@ -907,7 +901,7 @@ CDN: # when set it to local, you need to install hexo-butterfly-extjs third_party_provider: jsdelivr - # Add version number to CDN, true or false + # Add version number to url, true or false version: false # Custom format @@ -921,8 +915,8 @@ CDN: # translate: # local_search: # algolia_js: - # algolia_search_v4: - # instantsearch_v4: + # algolia_search: + # instantsearch: # docsearch_js: # docsearch_css: # pjax: @@ -948,8 +942,8 @@ CDN: # instantpage: # typed: # pangu: - # fancybox_css_v4: - # fancybox_v4: + # fancybox_css: + # fancybox: # medium_zoom: # snackbar_css: # snackbar: @@ -957,7 +951,7 @@ CDN: # fireworks: # click_heart: # ClickShowText: - # fontawesomeV6: + # fontawesome: # flickr_justified_gallery_js: # flickr_justified_gallery_css: # aplayer_css: diff --git a/themes/butterfly/layout/includes/additional-js.pug b/themes/butterfly/layout/includes/additional-js.pug index 3490dc10..869751d9 100644 --- a/themes/butterfly/layout/includes/additional-js.pug +++ b/themes/butterfly/layout/includes/additional-js.pug @@ -12,7 +12,7 @@ div if theme.medium_zoom script(src=url_for(theme.asset.medium_zoom)) else if theme.fancybox - script(src=url_for(theme.asset.fancybox_v4)) + script(src=url_for(theme.asset.fancybox)) if theme.instantpage script(src=url_for(theme.asset.instantpage), type='module') diff --git a/themes/butterfly/layout/includes/head.pug b/themes/butterfly/layout/includes/head.pug index c254c035..4efb48e8 100644 --- a/themes/butterfly/layout/includes/head.pug +++ b/themes/butterfly/layout/includes/head.pug @@ -42,13 +42,13 @@ if (theme.pwa && theme.pwa.enable) //- main css link(rel='stylesheet', href=url_for(theme.asset.main_css)) -link(rel='stylesheet', href=url_for(theme.asset.fontawesomeV6) media="print" onload="this.media='all'") +link(rel='stylesheet', href=url_for(theme.asset.fontawesome) media="print" onload="this.media='all'") if (theme.snackbar && theme.snackbar.enable) link(rel='stylesheet', href=url_for(theme.asset.snackbar_css) media="print" onload="this.media='all'") if theme.fancybox - link(rel='stylesheet' href=url_for(theme.asset.fancybox_css_v4) media="print" onload="this.media='all'") + link(rel='stylesheet' href=url_for(theme.asset.fancybox_css) media="print" onload="this.media='all'") //- google_adsense !=partial('includes/head/google_adsense', {}, {cache: true}) diff --git a/themes/butterfly/layout/includes/loading/pace.pug b/themes/butterfly/layout/includes/loading/pace.pug index c45c4fbd..c610c2c6 100644 --- a/themes/butterfly/layout/includes/loading/pace.pug +++ b/themes/butterfly/layout/includes/loading/pace.pug @@ -1,2 +1,11 @@ +script. + window.paceOptions = { + restartOnPushState: false + } + + document.addEventListener('pjax:send', () => { + Pace.restart() + }) + link(rel="stylesheet", href=url_for(theme.preloader.pace_css_url || theme.asset.pace_default_css)) script(data-pace-options='{ "restartOnRequestAfter":false,"eventLag":false}', src=url_for(theme.asset.pace_js)) \ No newline at end of file diff --git a/themes/butterfly/layout/includes/third-party/card-post-count/fb.pug b/themes/butterfly/layout/includes/third-party/card-post-count/fb.pug index eee1974b..75d6b4a5 100644 --- a/themes/butterfly/layout/includes/third-party/card-post-count/fb.pug +++ b/themes/butterfly/layout/includes/third-party/card-post-count/fb.pug @@ -1,4 +1,4 @@ -- const fbSDKVer = 'v15.0' +- const fbSDKVer = 'v16.0' - const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}` script. diff --git a/themes/butterfly/layout/includes/third-party/chat/gitter.pug b/themes/butterfly/layout/includes/third-party/chat/gitter.pug deleted file mode 100644 index 46f979a9..00000000 --- a/themes/butterfly/layout/includes/third-party/chat/gitter.pug +++ /dev/null @@ -1,43 +0,0 @@ -if theme.chat_btn - script. - ((window.gitter = {}).chat = {}).options = { - disableDefaultChat: true, - }; - document.addEventListener('gitter-sidecar-ready', (e) => { - const GitterChat = e.detail.Chat - let chat - - function initGitter () { - chat = new GitterChat({ - room: '#{theme.gitter.room}', - activationElement: '#chat_btn' - }); - } - - initGitter() - - if (!{theme.pjax.enable}) { - document.addEventListener('pjax:complete', () => { - chat.destroy() - initGitter() - }) - } - - }) -else - script. - ((window.gitter = {}).chat = {}).options = { - room: '#{theme.gitter.room}', - }; - - if (!{theme.chat_hide_show}) { - function chatBtnHide () { - document.getElementsByClassName('gitter-open-chat-button')[0].style.display= 'none' - } - - function chatBtnShow () { - document.getElementsByClassName('gitter-open-chat-button')[0].style.display= 'block' - } - } - -script(src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer) diff --git a/themes/butterfly/layout/includes/third-party/chat/index.pug b/themes/butterfly/layout/includes/third-party/chat/index.pug index dc6d0f83..4b6bda68 100644 --- a/themes/butterfly/layout/includes/third-party/chat/index.pug +++ b/themes/butterfly/layout/includes/third-party/chat/index.pug @@ -4,8 +4,6 @@ else if theme.tidio && theme.tidio.enable include ./tidio.pug else if theme.daovoice && theme.daovoice.enable include ./daovoice.pug -else if theme.gitter && theme.gitter.enable - include ./gitter.pug else if theme.crisp && theme.crisp.enable include ./crisp.pug else if theme.messenger && theme.messenger.enable diff --git a/themes/butterfly/layout/includes/third-party/chat/messenger.pug b/themes/butterfly/layout/includes/third-party/chat/messenger.pug index e7798ee8..e5c9d885 100644 --- a/themes/butterfly/layout/includes/third-party/chat/messenger.pug +++ b/themes/butterfly/layout/includes/third-party/chat/messenger.pug @@ -9,7 +9,7 @@ script. window.fbAsyncInit = function() { FB.init({ xfbml: true, - version: 'v15.0' + version: 'v16.0' }); }; diff --git a/themes/butterfly/layout/includes/third-party/comments/facebook_comments.pug b/themes/butterfly/layout/includes/third-party/comments/facebook_comments.pug index 5d4d399b..71726871 100644 --- a/themes/butterfly/layout/includes/third-party/comments/facebook_comments.pug +++ b/themes/butterfly/layout/includes/third-party/comments/facebook_comments.pug @@ -1,4 +1,4 @@ -- const fbSDKVer = 'v15.0' +- const fbSDKVer = 'v16.0' - const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}` script. diff --git a/themes/butterfly/layout/includes/third-party/search/algolia.pug b/themes/butterfly/layout/includes/third-party/search/algolia.pug index fc4405f1..064d8efa 100644 --- a/themes/butterfly/layout/includes/third-party/search/algolia.pug +++ b/themes/butterfly/layout/includes/third-party/search/algolia.pug @@ -17,6 +17,6 @@ #search-mask - script(src=url_for(theme.asset.algolia_search_v4)) - script(src=url_for(theme.asset.instantsearch_v4)) + script(src=url_for(theme.asset.algolia_search)) + script(src=url_for(theme.asset.instantsearch)) script(src=url_for(theme.asset.algolia_js)) \ No newline at end of file diff --git a/themes/butterfly/package.json b/themes/butterfly/package.json index f35e7197..ca6f00d7 100644 --- a/themes/butterfly/package.json +++ b/themes/butterfly/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "4.7.0", + "version": "4.8.0-b1", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/themes/butterfly/plugins.yml b/themes/butterfly/plugins.yml index fd85cfd1..ce2ba0fd 100644 --- a/themes/butterfly/plugins.yml +++ b/themes/butterfly/plugins.yml @@ -1,11 +1,11 @@ -algolia_search_v4: +algolia_search: name: algoliasearch file: dist/algoliasearch-lite.umd.js version: 4.14.3 -instantsearch_v4: +instantsearch: name: instantsearch.js file: dist/instantsearch.production.min.js - version: 4.51.0 + version: 4.51.1 pjax: name: pjax file: pjax.min.js @@ -123,15 +123,15 @@ pangu: name: pangu file: dist/browser/pangu.min.js version: 4.0.7 -fancybox_css_v4: +fancybox_css: name: '@fancyapps/ui' - file: dist/fancybox.css - version: 4.0.31 + file: dist/fancybox/fancybox.css + version: 5.0.3 other_name: fancyapps-ui -fancybox_v4: +fancybox: name: '@fancyapps/ui' - file: dist/fancybox.umd.js - version: 4.0.31 + file: dist/fancybox/fancybox.umd.js + version: 5.0.3 other_name: fancyapps-ui medium_zoom: name: medium-zoom @@ -145,7 +145,7 @@ snackbar: name: node-snackbar file: dist/snackbar.min.js version: 0.1.16 -fontawesomeV6: +fontawesome: name: '@fortawesome/fontawesome-free' file: css/all.min.css other_name: font-awesome diff --git a/themes/butterfly/scripts/events/cdn.js b/themes/butterfly/scripts/events/cdn.js index 9c1b2c1d..708420cb 100644 --- a/themes/butterfly/scripts/events/cdn.js +++ b/themes/butterfly/scripts/events/cdn.js @@ -41,7 +41,7 @@ hexo.extend.filter.register('before_generate', () => { } } - const minFile = (file) => { + const minFile = file => { return file.replace(/(? '.min' + ext) } @@ -54,7 +54,7 @@ hexo.extend.filter.register('before_generate', () => { const cdnjs_file = file.replace(/^[lib|dist]*\/|browser\//g, '') const min_cdnjs_file = minFile(cdnjs_file) if (cond === 'internal') file = `source/${file}` - const verType = CDN.version ? `@${version}` : '' + const verType = CDN.version ? (type === 'local' ? `?v=${version}` : `@${version}`) : '' const value = { version, @@ -67,7 +67,7 @@ hexo.extend.filter.register('before_generate', () => { } const cdnSource = { - local: cond === 'internal' ? cdnjs_file : `/pluginsSrc/${name}/${file}`, + local: cond === 'internal' ? `${cdnjs_file + verType}` : `/pluginsSrc/${name}/${file + verType}`, jsdelivr: `https://cdn.jsdelivr.net/npm/${name}${verType}/${min_file}`, unpkg: `https://unpkg.com/${name}${verType}/${file}`, cdnjs: `https://cdnjs.cloudflare.com/ajax/libs/${cdnjs_name}/${version}/${min_cdnjs_file}`, @@ -77,7 +77,7 @@ hexo.extend.filter.register('before_generate', () => { data[key] = cdnSource[type] }) - if (cond === 'internal') data.main_css = 'css/index.css' + if (cond === 'internal') data.main_css = 'css/index.css' + (CDN.version ? `?v=${version}` : '') return data } @@ -90,6 +90,9 @@ hexo.extend.filter.register('before_generate', () => { return obj } - themeConfig.asset = Object.assign(createCDNLink(internalSrc, CDN.internal_provider, 'internal'), - createCDNLink(thirdPartySrc, CDN.third_party_provider), deleteNullValue(CDN.option)) + themeConfig.asset = Object.assign( + createCDNLink(internalSrc, CDN.internal_provider, 'internal'), + createCDNLink(thirdPartySrc, CDN.third_party_provider), + deleteNullValue(CDN.option) + ) }) diff --git a/themes/butterfly/scripts/filters/random_cover.js b/themes/butterfly/scripts/filters/random_cover.js index ffb61e4c..4ecedcec 100644 --- a/themes/butterfly/scripts/filters/random_cover.js +++ b/themes/butterfly/scripts/filters/random_cover.js @@ -6,7 +6,7 @@ 'use strict' hexo.extend.filter.register('before_post_render', function (data) { - const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/ + const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/i let randomCover let coverVal = data.cover diff --git a/themes/butterfly/scripts/helpers/page.js b/themes/butterfly/scripts/helpers/page.js index 676907c7..c2801689 100644 --- a/themes/butterfly/scripts/helpers/page.js +++ b/themes/butterfly/scripts/helpers/page.js @@ -94,7 +94,7 @@ hexo.extend.helper.register('findArchivesTitle', function (page, menu, date) { }) hexo.extend.helper.register('isImgOrUrl', function (path) { - const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/ + const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/i if (path.indexOf('//') !== -1 || imgTestReg.test(path)) { return true } diff --git a/themes/butterfly/scripts/tag/gallery.js b/themes/butterfly/scripts/tag/gallery.js index adf46f3e..632c5141 100644 --- a/themes/butterfly/scripts/tag/gallery.js +++ b/themes/butterfly/scripts/tag/gallery.js @@ -15,18 +15,10 @@ function gallery (args, content) { args = args.join(' ').split(',') let rowHeight, limit, lazyload, type, dataStr - // url,[link],[lazyload],[rowHeight],[limit] if (args[0] === 'url') { - dataStr = args[1] - lazyload = args[2] === 'true' - rowHeight = args[3] || 220 - limit = args[4] || 10 - type = ' url' + [type, dataStr, lazyload, rowHeight = 220, limit = 10] = args // url,[link],[lazyload],[rowHeight],[limit] } else { - rowHeight = args[1] || 220 - limit = args[2] || 10 - lazyload = args[0] === 'true' - type = ' data' + [lazyload, rowHeight = 220, limit = 10] = args // [lazyload],[rowHeight],[limit] const regex = /!\[(.*?)\]\(([^\s]*)\s*(?:["'](.*?)["']?)?\s*\)/g let m const arr = [] @@ -44,7 +36,8 @@ function gallery (args, content) { dataStr = JSON.stringify(arr) } - const lazyloadClass = lazyload ? 'lazyload' : '' + type = type ? ' url' : ' data' + const lazyloadClass = lazyload === 'true' ? 'lazyload' : '' return `