From d9829167aa4d895b291b532aa18b326554a2b07c Mon Sep 17 00:00:00 2001 From: Jerry Date: Thu, 22 Feb 2024 17:04:11 +0800 Subject: [PATCH] update --- .github/FUNDING.yml | 13 ------- layout/includes/header/post-info.pug | 2 +- layout/includes/mixins/post-ui.pug | 4 +- .../third-party/card-post-count/artalk.pug | 18 ++++----- .../includes/third-party/comments/artalk.pug | 1 - .../includes/third-party/comments/twikoo.pug | 39 +++++++++---------- .../includes/third-party/comments/waline.pug | 15 ++++--- .../third-party/newest-comments/artalk.pug | 22 +++++------ package.json | 4 +- plugins.yml | 34 +++++++--------- source/css/_layout/head.styl | 7 +--- 11 files changed, 63 insertions(+), 96 deletions(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 0cd9243..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,13 +0,0 @@ -# These are supported funding model platforms - -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry -custom: ['https://buy.stripe.com/3cs6rP6YA91sbbG5kk','https://jsd.012700.xyz/gh/jerryc127/CDN/Photo/wechat.jpg'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/layout/includes/header/post-info.pug b/layout/includes/header/post-info.pug index def2312..491dd6e 100644 --- a/layout/includes/header/post-info.pug +++ b/layout/includes/header/post-info.pug @@ -140,5 +140,5 @@ when 'Artalk' +countBlock a(href=url_for(page.path) + '#post-comment') - span.artalk-count + span#ArtalkCount i.fa-solid.fa-spinner.fa-spin \ No newline at end of file diff --git a/layout/includes/mixins/post-ui.pug b/layout/includes/mixins/post-ui.pug index 5621b6d..bd545e4 100644 --- a/layout/includes/mixins/post-ui.pug +++ b/layout/includes/mixins/post-ui.pug @@ -45,16 +45,16 @@ mixin postUI(posts) if (theme.post_meta.page.categories && article.categories.data.length > 0) span.article-meta span.article-meta-separator | - i.fas.fa-inbox each item, index in article.categories.data + i.fas.fa-inbox a(href=url_for(item.path)).article-meta__categories #[=item.name] if (index < article.categories.data.length - 1) i.fas.fa-angle-right.article-meta-link if (theme.post_meta.page.tags && article.tags.data.length > 0) span.article-meta.tags span.article-meta-separator | - i.fas.fa-tag each item, index in article.tags.data + i.fas.fa-tag a(href=url_for(item.path)).article-meta__tags #[=item.name] if (index < article.tags.data.length - 1) span.article-meta-link #[='•'] diff --git a/layout/includes/third-party/card-post-count/artalk.pug b/layout/includes/third-party/card-post-count/artalk.pug index 9e9aaed..b5a1056 100644 --- a/layout/includes/third-party/card-post-count/artalk.pug +++ b/layout/includes/third-party/card-post-count/artalk.pug @@ -8,19 +8,15 @@ script. const keyArray = Array.from(eleGroup).map(i => i.getAttribute('data-page-key')) const headerList = { - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Origin': window.location.origin - }, - body: new URLSearchParams({ - 'site_name': '!{site}', - 'type':'page_comment', - 'page_keys': keyArray - }) + method: 'GET', } - const res = await fetch('!{server}/api/stat', headerList) + const searchParams = new URLSearchParams({ + 'site_name': '!{site}', + 'page_keys': keyArray + }) + + const res = await fetch(`!{server}/api/v2/stats/page_comment?${searchParams}`, headerList) const result = await res.json() keyArray.forEach((key, index) => { diff --git a/layout/includes/third-party/comments/artalk.pug b/layout/includes/third-party/comments/artalk.pug index 6354429..e7cf9ce 100644 --- a/layout/includes/third-party/comments/artalk.pug +++ b/layout/includes/third-party/comments/artalk.pug @@ -11,7 +11,6 @@ script. site: '!{site}', pageKey: location.pathname, darkMode: document.documentElement.getAttribute('data-theme') === 'dark', - countEl: '.artalk-count' },!{JSON.stringify(option)})) if (GLOBAL_CONFIG.lightbox === 'null') return diff --git a/layout/includes/third-party/comments/twikoo.pug b/layout/includes/third-party/comments/twikoo.pug index 858fad3..b2aacf4 100644 --- a/layout/includes/third-party/comments/twikoo.pug +++ b/layout/includes/third-party/comments/twikoo.pug @@ -3,22 +3,6 @@ script. (() => { - const init = () => { - twikoo.init(Object.assign({ - el: '#twikoo-wrap', - envId: '!{envId}', - region: '!{region}', - onCommentLoaded: () => { - btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)')) - } - }, !{JSON.stringify(option)})) - } - - const loadTwikoo = () => { - if (typeof twikoo === 'object') setTimeout(init,0) - else getScript('!{url_for(theme.asset.twikoo)}').then(init) - } - const getCount = () => { const countELement = document.getElementById('twikoo-count') if(!countELement) return @@ -34,12 +18,27 @@ script. }) } + const init = () => { + twikoo.init(Object.assign({ + el: '#twikoo-wrap', + envId: '!{envId}', + region: '!{region}', + onCommentLoaded: () => { + btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)')) + } + }, !{JSON.stringify(option)})) + + !{count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : ''} + } + + const loadTwikoo = () => { + if (typeof twikoo === 'object') setTimeout(init,0) + else getScript('!{url_for(theme.asset.twikoo)}').then(init) + } + if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) { if (!{lazyload}) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo) - else { - loadTwikoo() - !{count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : ''} - } + else loadTwikoo() } else { window.loadOtherComment = loadTwikoo } diff --git a/layout/includes/third-party/comments/waline.pug b/layout/includes/third-party/comments/waline.pug index ca35f8a..6f5f07e 100644 --- a/layout/includes/third-party/comments/waline.pug +++ b/layout/includes/third-party/comments/waline.pug @@ -3,8 +3,10 @@ script. (() => { - const initWaline = () => { - const waline = Waline.init(Object.assign({ + let initFn = window.walineFn || null + + const initWaline = (Fn) => { + const waline = Fn(Object.assign({ el: '#waline-wrap', serverURL: '!{serverURL}', pageview: !{lazyload ? false : pageview}, @@ -18,15 +20,16 @@ script. } btf.addGlobalFn('pjax', destroyWaline, 'destroyWaline') - } const loadWaline = async () => { - if (typeof Waline === 'object') initWaline() + if (initFn) initWaline(initFn) else { await getCSS('!{url_for(theme.asset.waline_css)}') - await getScript('!{url_for(theme.asset.waline_js)}') - initWaline() + const { init } = await import('!{url_for(theme.asset.waline_js)}') + initFn = init || Waline.init + initWaline(initFn) + window.walineFn = initFn } } diff --git a/layout/includes/third-party/newest-comments/artalk.pug b/layout/includes/third-party/newest-comments/artalk.pug index b757b11..2df0bac 100644 --- a/layout/includes/third-party/newest-comments/artalk.pug +++ b/layout/includes/third-party/newest-comments/artalk.pug @@ -47,7 +47,7 @@ script. const getSetting = async () => { try { - const res = await fetch('!{server}/api/conf', { method: 'GET' }) + const res = await fetch('!{server}/api/v2/conf', { method: 'GET' }) return await res.json() } catch (e) { console.log(e) @@ -55,24 +55,20 @@ script. } const headerList = { - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'Origin': window.location.origin - }, - body: new URLSearchParams({ - 'site_name': '!{site}', - 'limit': '!{theme.newest_comments.limit}', - 'type':'latest_comments' - }) + method: 'GET', } + const searchParams = new URLSearchParams({ + 'site_name': '!{site}', + 'limit': '!{theme.newest_comments.limit}', + }) + const getComment = async () => { try { - const res = await fetch('!{server}/api/stat', headerList) + const res = await fetch(`!{server}/api/v2/stats/latest_comments?${searchParams}`, headerList) const result = await res.json() const avatarStr = await getSetting() - const { mirror, params, default:defaults } = avatarStr.data.frontend_conf.gravatar + const { mirror, params, default:defaults } = avatarStr.frontend_conf.gravatar const avatarCdn = !{avatarCdn} || mirror let avatarDefault = !{avatarDefault} || params || defaults avatarDefault = avatarDefault.startsWith('d=') ? avatarDefault : `d=${avatarDefault}` diff --git a/package.json b/package.json index 71a1d00..4602d98 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "4.12.0", + "version": "4.13.0", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { @@ -23,7 +23,7 @@ "email": "my@crazywong.com" }, "dependencies": { - "hexo-renderer-stylus": "^3.0.0", + "hexo-renderer-stylus": "^3.0.1", "hexo-renderer-pug": "^3.0.0" }, "homepage": "https://butterfly.js.org/", diff --git a/plugins.yml b/plugins.yml index ada0677..d8165bb 100644 --- a/plugins.yml +++ b/plugins.yml @@ -1,11 +1,11 @@ algolia_search: name: algoliasearch file: dist/algoliasearch-lite.umd.js - version: 4.22.0 + version: 4.22.1 instantsearch: name: instantsearch.js file: dist/instantsearch.production.min.js - version: 4.63.0 + version: 4.65.0 pjax: name: pjax file: pjax.min.js @@ -37,17 +37,17 @@ disqusjs_css: twikoo: name: twikoo file: dist/twikoo.all.min.js - version: 1.6.29 + version: 1.6.31 waline_js: name: '@waline/client' file: dist/waline.js other_name: waline - version: 2.15.8 + version: 3.1.2 waline_css: name: '@waline/client' file: dist/waline.css other_name: waline - version: 2.15.8 + version: 3.1.2 sharejs: name: butterfly-extsrc file: sharejs/dist/js/social-share.min.js @@ -73,7 +73,7 @@ katex_copytex: mermaid: name: mermaid file: dist/mermaid.min.js - version: 10.6.1 + version: 10.8.0 canvas_ribbon: name: butterfly-extsrc file: dist/canvas-ribbon.min.js @@ -105,7 +105,7 @@ clickShowText: lazyload: name: vanilla-lazyload file: dist/lazyload.iife.min.js - version: 17.8.5 + version: 17.8.8 instantpage: name: instant.page file: instantpage.js @@ -121,12 +121,12 @@ pangu: fancybox_css: name: '@fancyapps/ui' file: dist/fancybox/fancybox.css - version: 5.0.32 + version: 5.0.33 other_name: fancyapps-ui fancybox: name: '@fancyapps/ui' file: dist/fancybox/fancybox.umd.js - version: 5.0.32 + version: 5.0.33 other_name: fancyapps-ui medium_zoom: name: medium-zoom @@ -145,19 +145,11 @@ fontawesome: file: css/all.min.css other_name: font-awesome version: 6.5.1 -flickr_justified_gallery_js: - name: flickr-justified-gallery - file: dist/fjGallery.min.js - version: 2.1.2 -flickr_justified_gallery_css: - name: flickr-justified-gallery - file: dist/fjGallery.css - version: 2.1.2 egjs_infinitegrid: name: '@egjs/infinitegrid' other_name: egjs-infinitegrid file: dist/infinitegrid.min.js - version: 4.11.0 + version: 4.11.1 aplayer_css: name: aplayer file: dist/APlayer.min.css @@ -188,11 +180,11 @@ prismjs_autoloader: artalk_js: name: artalk file: dist/Artalk.js - version: 2.7.3 + version: 2.8.2 artalk_css: name: artalk file: dist/Artalk.css - version: 2.7.3 + version: 2.8.2 pace_js: name: pace-js other_name: pace @@ -216,4 +208,4 @@ docsearch_css: abcjs_basic_js: name: abcjs file: dist/abcjs-basic-min.js - version: 6.2.3 + version: 6.3.0 diff --git a/source/css/_layout/head.styl b/source/css/_layout/head.styl index 3c5f4ce..97cb0ff 100644 --- a/source/css/_layout/head.styl +++ b/source/css/_layout/head.styl @@ -99,14 +99,9 @@ #post-info position: absolute - bottom: 100px + bottom: 30px padding: 0 8% width: 100% - text-align: center - - +maxWidth900() - bottom: 30px - text-align: left +maxWidth768() bottom: 22px