diff --git a/_config.yml b/_config.yml index e846571..1cf5d95 100644 --- a/_config.yml +++ b/_config.yml @@ -628,7 +628,10 @@ aside: button: true mobile: true # display on mobile position: right # left or right - archives: true + display: + archive: true + tag: true + category: true card_author: enable: true description: diff --git a/layout/archive.pug b/layout/archive.pug index faa485c..815cdd1 100644 --- a/layout/archive.pug +++ b/layout/archive.pug @@ -3,6 +3,7 @@ extends includes/layout.pug block content include ./includes/mixins/article-sort.pug #archive - .article-sort-title= _p('page.articles') + ' - ' + site.posts.length + - const archiveLength = findArchiveLength(fragment_cache) + .article-sort-title= _p('page.articles') + ' - ' + archiveLength +articleSort(page.posts) include includes/pagination.pug \ No newline at end of file diff --git a/layout/includes/header/post-info.pug b/layout/includes/header/post-info.pug index b75f804..6b951c4 100644 --- a/layout/includes/header/post-info.pug +++ b/layout/includes/header/post-info.pug @@ -66,18 +66,23 @@ if commentUse[0] === 'Valine' && theme.valine.visitor +pvBlock(url_for(page.path),'leancloud_visitors',page.title) span.leancloud-visitors-count + i.fa-solid.fa-spinner.fa-spin else if commentUse[0] === 'Waline' && theme.waline.pageview +pvBlock('','','') span.waline-pageview-count(data-path=url_for(page.path)) + i.fa-solid.fa-spinner.fa-spin else if commentUse[0] === 'Twikoo' && theme.twikoo.visitor +pvBlock('','','') span#twikoo_visitors + i.fa-solid.fa-spinner.fa-spin else if theme.busuanzi.page_pv +pvBlock('','post-meta-pv-cv','') span#busuanzi_value_page_pv + i.fa-solid.fa-spinner.fa-spin else if theme.busuanzi.page_pv +pvBlock('','post-meta-pv-cv','') span#busuanzi_value_page_pv + i.fa-solid.fa-spinner.fa-spin if comments.count && !comments.lazyload && page.comments !== false && comments.use - var whichCount = comments.use[0] @@ -95,31 +100,39 @@ +countBlock span.disqus-comment-count a(href=full_url_for(page.path) + '#disqus_thread') + i.fa-solid.fa-spinner.fa-spin when 'Disqusjs' +countBlock a(href=full_url_for(page.path) + '#disqusjs') span.disqus-comment-count(data-disqus-url=full_url_for(page.path)) + i.fa-solid.fa-spinner.fa-spin when 'Valine' +countBlock a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl") span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount") + i.fa-solid.fa-spinner.fa-spin when 'Waline' +countBlock a(href=url_for(page.path) + '#post-comment') span.waline-comment-count(data-path=url_for(page.path)) + i.fa-solid.fa-spinner.fa-spin when 'Gitalk' +countBlock a(href=url_for(page.path) + '#post-comment') span.gitalk-comment-count + i.fa-solid.fa-spinner.fa-spin when 'Twikoo' +countBlock a(href=url_for(page.path) + '#post-comment') span#twikoo-count + i.fa-solid.fa-spinner.fa-spin when 'Facebook Comments' +countBlock a(href=url_for(page.path) + '#post-comment') span.fb-comments-count(data-href=urlNoIndex()) + i.fa-solid.fa-spinner.fa-spin when 'Remark42' +countBlock a(href=url_for(page.path) + '#post-comment') - span.remark42__counter(data-url=urlNoIndex()) \ No newline at end of file + span.remark42__counter(data-url=urlNoIndex()) + i.fa-solid.fa-spinner.fa-spin \ No newline at end of file diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug index aabce94..414b45d 100644 --- a/layout/includes/layout.pug +++ b/layout/includes/layout.pug @@ -1,5 +1,5 @@ - var htmlClassHideAside = theme.aside.enable && theme.aside.hide ? 'hide-aside' : '' -- page.aside = is_archive() ? theme.aside.archives : page.aside +- page.aside = is_archive() ? theme.aside.display.archive: is_category() ? theme.aside.display.category : is_tag() ? theme.aside.display.tag : page.aside - var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : '' - var pageType = is_post() ? 'post' : 'page' diff --git a/layout/includes/mixins/post-ui.pug b/layout/includes/mixins/post-ui.pug index ef2b10b..3d8619b 100644 --- a/layout/includes/mixins/post-ui.pug +++ b/layout/includes/mixins/post-ui.pug @@ -5,7 +5,7 @@ mixin postUI(posts) let link = article.link || article.path let title = article.title || _p('no_title') const position = theme.cover.position - let leftOrRight = position === 'both' + let leftOrRight = position === 'both' ? index%2 == 0 ? 'left' : 'right' : position === 'left' ? 'left' : 'right' let post_cover = article.cover @@ -72,29 +72,36 @@ mixin postUI(posts) when 'Disqus' +countBlockInIndex a(href=full_url_for(link) + '#disqus_thread') + i.fa-solid.fa-spinner.fa-spin when 'Disqusjs' +countBlockInIndex a(href=full_url_for(link) + '#disqusjs') span.disqus-comment-count(data-disqus-url=full_url_for(link)) + i.fa-solid.fa-spinner.fa-spin when 'Valine' +countBlockInIndex a(href=url_for(link) + '#post-comment') span.valine-comment-count(data-xid=url_for(link)) + i.fa-solid.fa-spinner.fa-spin when 'Waline' +countBlockInIndex a(href=url_for(link) + '#post-comment') span.waline-comment-count(id=url_for(link)) + i.fa-solid.fa-spinner.fa-spin when 'Twikoo' +countBlockInIndex a.twikoo-count(href=url_for(link) + '#post-comment') + i.fa-solid.fa-spinner.fa-spin when 'Facebook Comments' +countBlockInIndex a(href=url_for(link) + '#post-comment') span.fb-comments-count(data-href=urlNoIndex(article.permalink)) + i.fa-solid.fa-spinner.fa-spin when 'Remark42' +countBlockInIndex a(href=url_for(link) + '#post-comment') span.remark42__counter(data-url=urlNoIndex(article.permalink)) + i.fa-solid.fa-spinner.fa-spin //- Display the article introduction on homepage case theme.index_post_content.method diff --git a/layout/includes/widget/card_webinfo.pug b/layout/includes/widget/card_webinfo.pug index 3bff545..9ff3de0 100644 --- a/layout/includes/widget/card_webinfo.pug +++ b/layout/includes/widget/card_webinfo.pug @@ -12,20 +12,24 @@ if theme.aside.card_webinfo.enable .webinfo-item .item-name= _p('aside.card_webinfo.runtime.name') + " :" .item-count#runtimeshow(data-publishDate=date_xml(theme.runtimeshow.publish_date)) + i.fa-solid.fa-spinner.fa-spin if theme.wordcount.enable && theme.wordcount.total_wordcount .webinfo-item .item-name=_p('aside.card_webinfo.site_wordcount') + " :" .item-count=totalcount(site) - if theme.busuanzi.site_uv + if theme.busuanzi.site_uv .webinfo-item .item-name= _p('aside.card_webinfo.site_uv_name') + " :" .item-count#busuanzi_value_site_uv + i.fa-solid.fa-spinner.fa-spin if theme.busuanzi.site_pv .webinfo-item .item-name= _p('aside.card_webinfo.site_pv_name') + " :" .item-count#busuanzi_value_site_pv + i.fa-solid.fa-spinner.fa-spin if theme.aside.card_webinfo.last_push_date .webinfo-item .item-name= _p('aside.card_webinfo.last_push_date.name') + " :" .item-count#last-push-date(data-lastPushDate=date_xml(Date.now())) + i.fa-solid.fa-spinner.fa-spin diff --git a/package.json b/package.json index dac10e9..1ac9e18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "4.3.0-b3", + "version": "4.3.0-b4", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/plugins.yml b/plugins.yml index 9d29626..d9043d9 100644 --- a/plugins.yml +++ b/plugins.yml @@ -5,7 +5,7 @@ algolia_search_v4: instantsearch_v4: name: instantsearch.js file: dist/instantsearch.production.min.js - version: 4.41.0 + version: 4.41.2 pjax: name: pjax file: pjax.min.js @@ -42,12 +42,12 @@ waline_js: name: '@waline/client' file: dist/waline.js other_name: waline - version: 2.5.1 + version: 2.6.1 waline_css: name: '@waline/client' file: dist/waline.css other_name: waline - version: 2.5.1 + version: 2.6.1 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: 9.1.1 + version: 9.1.2 canvas_ribbon: name: butterfly-extsrc file: dist/canvas-ribbon.min.js @@ -122,10 +122,12 @@ fancybox_css_v4: name: '@fancyapps/ui' file: dist/fancybox.css version: 4.0.27 + other_name: fancyapps-ui fancybox_v4: name: '@fancyapps/ui' file: dist/fancybox.umd.js version: 4.0.27 + other_name: fancyapps-ui medium_zoom: name: medium-zoom file: dist/medium-zoom.min.js @@ -146,11 +148,11 @@ fontawesomeV6: flickr_justified_gallery_js: name: flickr-justified-gallery file: dist/fjGallery.min.js - version: 2.0.0 + version: 2.1.2 flickr_justified_gallery_css: name: flickr-justified-gallery file: dist/fjGallery.css - version: 2.0.0 + version: 2.1.2 aplayer_css: name: aplayer file: dist/APlayer.min.css @@ -177,4 +179,4 @@ prismjs_autoloader: name: prismjs file: plugins/autoloader/prism-autoloader.min.js other_name: prism - version: 1.28.0 + version: 1.28.0 \ No newline at end of file diff --git a/scripts/helpers/findArchiveLength.js b/scripts/helpers/findArchiveLength.js new file mode 100644 index 0000000..e55dc0f --- /dev/null +++ b/scripts/helpers/findArchiveLength.js @@ -0,0 +1,58 @@ +hexo.extend.helper.register('findArchiveLength', function (func) { + const allPostsLength = this.site.posts.length; + if (hexo.config.archive_generator && hexo.config.archive_generator.enable === false ) return allPostsLength + const { yearly, monthly, daily } = hexo.config.archive_generator + const { year, month, day } = this.page + if (yearly === false || !year) return allPostsLength + + const posts = this.site.posts.sort('date') + + const compareFunc = (type,y1,m1,d1,y2,m2,d2) => { + if (type === 'year') { + return y1 === y2 + } else if (type === 'month') { + return y1 === y2 && m1 === m2 + } else if (type === 'day') { + return y1 === y2 && m1 === m2 && d1 === d2 + } + } + + const generateDateObj = (type) => { + let dateObj = [] + let length = 0 + + posts.forEach(post => { + let date = post.date.clone() + const year = date.year() + const month = date.month() + 1 + const day = date.date() + let lastData = dateObj[length - 1] + + if (!lastData || !compareFunc(type, lastData.year, lastData.month, lastData.day, year, month, day)) { + const name = type === 'year' ? year : type === 'month' ? `${year}-${month}` : `${year}-${month}-${day}` + length = dateObj.push({ + name, + year, + month, + day, + count: 1 + }) + } else { + lastData.count++ + } + }); + + return dateObj + } + + const data = func('createArchiveObj', ()=> { + const yearObj = yearly ? generateDateObj('year') : [] + const monthObj = monthly ? generateDateObj('month') : [] + const dayObj = daily ? generateDateObj('day') : [] + const fullObj = [...yearObj, ...monthObj, ...dayObj] + return fullObj + }) + + const name = month ? day ? `${year}-${month}-${day}` : `${year}-${month}` : year + return data.find(item => item.name === name).count +}) \ No newline at end of file diff --git a/scripts/tag/note.js b/scripts/tag/note.js index ec4e8b5..aa19129 100644 --- a/scripts/tag/note.js +++ b/scripts/tag/note.js @@ -17,7 +17,7 @@ function postNote (args, content) { const iconArray = args[args.length - 2] if (iconArray && iconArray.startsWith('fa')) { icon = `` - args[args.length - 2] = 'icon' + args[args.length - 2] = 'icon-padding' } return `