hexo-theme-solitude 1.8.6 → 1.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ name: Node.js Package
2
+ on:
3
+ release:
4
+ types: [created]
5
+
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - uses: actions/setup-node@v4
12
+ with:
13
+ node-version: 16
14
+ - run: npm test
15
+
16
+ publish-gpr:
17
+ needs: build
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ packages: write
21
+ contents: read
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - uses: actions/setup-node@v4
25
+ with:
26
+ node-version: 16
27
+ registry-url: https://npm.pkg.github.com/
28
+ - run: npm publish
29
+ env:
30
+ NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -1,9 +1,8 @@
1
1
  name: Node.js Package
2
2
 
3
3
  on:
4
- push:
5
- branches:
6
- - main
4
+ release:
5
+ types: [created]
7
6
 
8
7
  jobs:
9
8
  build:
package/_config.yml CHANGED
@@ -3,10 +3,10 @@
3
3
  # Author: Valor Team
4
4
  # Github: https://github.com/valor-x/hexo-theme-solitude
5
5
  #
6
- # 配置指南: https://solitude-docs.efu.me/
6
+ # 配置指南: https://docs.efu.me/
7
7
  # 你可以从指南中获得更详细的说明
8
8
  #
9
- # Guide: https://solitude-docs.efu.me/
9
+ # Guide: https://docs.efu.me/
10
10
  # You can get more detailed help from the guide
11
11
  #
12
12
  # 赞助:https://afdian.net/a/efu0u0
@@ -130,7 +130,7 @@ hometop:
130
130
  title: Solitude 主题文档
131
131
  # 点击跳转链接
132
132
  # Click the jump link
133
- url: https://solitude-docs.efu.me/
133
+ url: https://docs.efu.me/
134
134
  # 显示背景图片
135
135
  # Display background image
136
136
  img: /img/default.png
@@ -701,7 +701,7 @@ post_ai:
701
701
 
702
702
  # latex 公式支持
703
703
  # latex formula support
704
- # docs: https://solitude-docs.efu.me/configuration/extra#数学公式
704
+ # docs: https://docs.efu.me/configuration/extra#数学公式
705
705
  katex:
706
706
  enable: false
707
707
  per_page: false # 是否在每页都加载 / Whether to load on each page
@@ -709,12 +709,13 @@ katex:
709
709
 
710
710
  # 评论
711
711
  # comment
712
- # getting start: http://solitude-docs.efu.me/comments/comment
712
+ # getting start: http://docs.efu.me/comments/comment
713
713
  comment:
714
714
  use: # waline, twikoo, valine, artalk
715
715
  commentBarrage: false # 热评开关 / Hot comment switch
716
716
  lazyload: false # 懒加载
717
717
  count: false # 评论数展示
718
+ pv: false # 是否使用評論統計頁面訪問
718
719
  avatar: https://cravatar.cn # Gravatar link
719
720
  newest_comment:
720
721
  enable: false
@@ -794,7 +795,7 @@ extends:
794
795
 
795
796
  # PWA
796
797
  # https://developer.mozilla.org/zh-CN/docs/Web/Progressive_web_apps
797
- # docs: https://solitude-docs.efu.me/configuration/extra#pwa
798
+ # docs: https://docs.efu.me/configuration/extra#pwa
798
799
  pwa:
799
800
  enable: false
800
801
  manifest: /manifest.json # manifest.json 文件路径
@@ -48,10 +48,10 @@ div
48
48
  script(src=url_for(theme.cdn.efu_ai))
49
49
 
50
50
  if theme.capsule.enable || theme.music.enable
51
+ script.
52
+ var meting_api = '!{theme.meting_api}';
51
53
  script(src=url_for(theme.cdn.aplayer_js))
52
54
  script(src=url_for(theme.cdn.meting_js))
53
- script.
54
- const meting_api = '!{theme.meting_api}';
55
55
 
56
56
  if theme.post.covercolor.enable
57
57
  case theme.post.covercolor.mode
@@ -96,7 +96,7 @@ div
96
96
  GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
97
97
  sco.changeTimeFormat(document.querySelectorAll('.bber-info-time time'))
98
98
  if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv)
99
- script(async src=url_for(theme.cdn.busuanzi_js))
99
+ script(defer pjax src=url_for(theme.cdn.busuanzi_js))
100
100
 
101
101
 
102
102
  if theme.footer.randomlink
@@ -27,7 +27,7 @@ include ../head/pwa.pug
27
27
 
28
28
  script.
29
29
  console.log(
30
- "%c Program: Hexo %c Theme: Solitude %c Version: v1.8.6",
30
+ "%c Program: Hexo %c Theme: Solitude %c Version: v1.8.8",
31
31
  "border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
32
32
  "padding: 5px 10px;color:white;background:#3e9f50;",
33
33
  "border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
@@ -11,14 +11,14 @@
11
11
  .webinfo-item-title
12
12
  i.item-icon.solitude.st-visitor-line
13
13
  .item-name= __('aside.pv')
14
- span#busuanzi_value_site_pv
14
+ span#busuanzi_site_pv
15
15
  i.solitude.st-loading-line
16
16
  if theme.aside.siteinfo.uv
17
17
  .webinfo-item
18
18
  .webinfo-item-title
19
19
  i.item-icon.solitude.st-team-fill
20
20
  .item-name= __('aside.uv')
21
- span#busuanzi_value_site_uv
21
+ span#busuanzi_site_uv
22
22
  i.solitude.st-loading-line
23
23
  if theme.aside.siteinfo.runtimeenable
24
24
  .webinfo-item
@@ -40,7 +40,7 @@
40
40
  if theme.post.meta.pv
41
41
  a.post-meta-pv(href=url_for(page.path), title=_p('post.pv'))
42
42
  i.post-meta-icon.solitude.st-fire-fill
43
- if theme.comment.use
43
+ if theme.comment.use && theme.comment.pv
44
44
  case theme.comment.use[0]
45
45
  when "Twikoo"
46
46
  span#twikoo_visitors
@@ -57,7 +57,7 @@
57
57
  i.solitude.st-loading-line
58
58
  else
59
59
  if theme.busuanzi
60
- span#busuanzi_value_page_pv
60
+ span#busuanzi_page_pv
61
61
  i.solitude.st-loading-line
62
62
  if theme.post.meta.comment && page.comment && theme.comment.count && theme.comment.use
63
63
  span.post-meta-commentcount(title=_p('post.comment'), onclick="sco.scrollTo('post-comment')")
@@ -5,7 +5,7 @@
5
5
  .comment-headline
6
6
  i.solitude.st-chat-fill
7
7
  span=' ' + _p('comment.title')
8
- if count
8
+ if count && is_post()
9
9
  span.count
10
10
  = ' ('
11
11
  each name in use
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "1.8.6",
3
+ "version": "1.8.8",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by the efu.",
5
5
  "main": "package.json",
6
6
  "scripts": {
package/plugins.yml CHANGED
@@ -78,9 +78,9 @@ swiper_js:
78
78
  version: 11.0.5
79
79
  other_name: Swiper
80
80
  busuanzi_js:
81
- name: busuanzi
82
- file: bsz.pure.mini.js
83
- version: 2.3.0
81
+ name: pearssauce-busuanzi
82
+ file: bsz.pure.min.js
83
+ version: 1.0.0
84
84
  snackbar:
85
85
  name: node-snackbar
86
86
  file: dist/snackbar.min.js
@@ -67,9 +67,6 @@
67
67
  text-align left
68
68
  letter-spacing .6px
69
69
 
70
- img
71
- margin auto
72
-
73
70
  a
74
71
  &:not(.fancybox)
75
72
  text-decoration none
package/source/js/main.js CHANGED
@@ -37,14 +37,12 @@ const sidebarFn = () => {
37
37
  const scrollFn = function () {
38
38
  const innerHeight = window.innerHeight;
39
39
  if (document.body.scrollHeight <= innerHeight) return;
40
-
41
40
  let initTop = 0;
42
41
  const $header = document.getElementById('page-header');
43
- window.addEventListener('scroll', utils.throttle(function (e) {
44
- initThemeColor()
42
+ const throttledScroll = utils.throttle(function (e) {
43
+ initThemeColor();
45
44
  const currentTop = window.scrollY || document.documentElement.scrollTop;
46
45
  const isDown = scrollDirection(currentTop);
47
-
48
46
  if (currentTop > 0) {
49
47
  if (isDown) {
50
48
  if ($header.classList.contains('nav-visible')) $header.classList.remove('nav-visible');
@@ -53,12 +51,15 @@ const scrollFn = function () {
53
51
  }
54
52
  $header.classList.add('nav-fixed');
55
53
  } else {
56
- if (currentTop ===0){
57
54
  $header.classList.remove('nav-fixed', 'nav-visible');
58
- }
59
55
  }
60
- }, 200));
61
-
56
+ }, 200);
57
+ window.addEventListener('scroll', function(e) {
58
+ throttledScroll(e);
59
+ if (window.scrollY === 0) {
60
+ $header.classList.remove('nav-fixed', 'nav-visible');
61
+ }
62
+ });
62
63
  function scrollDirection(currentTop) {
63
64
  const result = currentTop > initTop;
64
65
  initTop = currentTop;
@@ -67,34 +68,26 @@ const scrollFn = function () {
67
68
  }
68
69
 
69
70
  const percent = () => {
70
- let scrollTop = document.documentElement.scrollTop || window.pageYOffset
71
- let totalHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - document.documentElement.clientHeight
72
- let scrollPercent = Math.round(scrollTop / totalHeight * 100)
73
- let percentElement = document.querySelector("#percent")
74
- let viewportBottom = window.scrollY + document.documentElement.clientHeight
75
- let remainingScroll = totalHeight - scrollTop
76
-
77
- if ((document.getElementById("post-comment") || document.getElementById("footer"))?.offsetTop < viewportBottom || scrollPercent > 90) {
78
- document.querySelector("#nav-totop").classList.add("long")
79
- percentElement.innerHTML = GLOBAL_CONFIG.lang.backtop
71
+ const docEl = document.documentElement;
72
+ const body = document.body;
73
+ const scrollPos = window.pageYOffset || docEl.scrollTop;
74
+ const scrollHeight = Math.max(body.scrollHeight, docEl.scrollHeight, body.offsetHeight, docEl.offsetHeight, body.clientHeight, docEl.clientHeight);
75
+ const viewportHeight = docEl.clientHeight;
76
+ const totalScrollableHeight = scrollHeight - viewportHeight;
77
+ const scrolledPercent = Math.round((scrollPos / totalScrollableHeight) * 100);
78
+ const navToTop = document.querySelector("#nav-totop");
79
+ const percentDisplay = document.querySelector("#percent");
80
+ const commentOrFooter = document.getElementById("post-comment") || document.getElementById("footer");
81
+ const isNearEnd = (window.scrollY + viewportHeight) >= commentOrFooter.offsetTop;
82
+ if (isNearEnd || scrolledPercent > 90) {
83
+ navToTop.classList.add("long");
84
+ percentDisplay.textContent = GLOBAL_CONFIG.lang.backtop;
80
85
  } else {
81
- document.querySelector("#nav-totop").classList.remove("long")
82
- if (scrollPercent >= 0) {
83
- percentElement.innerHTML = scrollPercent + ""
84
- }
86
+ navToTop.classList.remove("long");
87
+ percentDisplay.textContent = scrolledPercent;
85
88
  }
86
-
87
- let elementsToHide = document.querySelectorAll(".needEndHide")
88
- if (remainingScroll < 100) {
89
- elementsToHide.forEach(function (element) {
90
- element.classList.add("hide")
91
- })
92
- } else {
93
- elementsToHide.forEach(function (element) {
94
- element.classList.remove("hide")
95
- })
96
- }
97
-
89
+ const elementsToHide = document.querySelectorAll(".needEndHide");
90
+ elementsToHide.forEach(item => item.classList.toggle("hide", totalScrollableHeight - scrollPos < 100));
98
91
  window.onscroll = percent
99
92
  }
100
93
 
@@ -892,12 +885,12 @@ window.refreshFn = () => {
892
885
 
893
886
  document.addEventListener('DOMContentLoaded', function () {
894
887
  sco.initAdjust()
895
- percent()
896
888
  initObserver()
897
889
  addCopyright()
898
890
  sco.initConsoleState()
899
891
  window.refreshFn()
900
892
  asideStatus()
893
+ percent()
901
894
  })
902
895
 
903
896
  window.onkeydown = function (e) {