hexo-theme-solitude 1.7.13 → 1.8.0

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.
Files changed (44) hide show
  1. package/README.md +25 -25
  2. package/{README_zh-cn.md → README_en.md} +25 -25
  3. package/README_zh-tw.md +3 -3
  4. package/_config.yml +41 -30
  5. package/languages/en.yml +4 -0
  6. package/languages/zh-CN.yml +4 -0
  7. package/languages/zh-TW.yml +4 -0
  8. package/layout/includes/body/mode.pug +6 -3
  9. package/layout/includes/head/config.pug +0 -28
  10. package/layout/includes/head/page_config.pug +9 -0
  11. package/layout/includes/head.pug +4 -1
  12. package/layout/includes/inject/body.pug +1 -29
  13. package/layout/includes/inject/head.pug +11 -87
  14. package/layout/includes/widgets/nav/right.pug +4 -41
  15. package/layout/includes/widgets/post/postMeta.pug +25 -19
  16. package/layout/includes/widgets/third-party/comments/artalk.pug +61 -0
  17. package/layout/includes/widgets/third-party/comments/comment.pug +48 -10
  18. package/layout/includes/widgets/third-party/comments/twikoo.pug +78 -27
  19. package/layout/includes/widgets/third-party/comments/valine.pug +52 -22
  20. package/layout/includes/widgets/third-party/comments/waline.pug +52 -30
  21. package/layout/includes/widgets/third-party/news-comment/artalk.pug +88 -0
  22. package/layout/includes/widgets/third-party/news-comment/newest-comment.pug +8 -6
  23. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +48 -55
  24. package/layout/includes/widgets/third-party/news-comment/valine.pug +8 -8
  25. package/layout/includes/widgets/third-party/news-comment/waline.pug +6 -6
  26. package/layout/includes/widgets/third-party/pjax.pug +1 -0
  27. package/package.json +1 -1
  28. package/plugins.yml +8 -4
  29. package/scripts/event/cdn.js +2 -12
  30. package/scripts/event/merge_config.js +280 -255
  31. package/scripts/filter/comment.js +13 -0
  32. package/source/css/_comments/comment.styl +73 -12
  33. package/source/css/_comments/valine.styl +1 -1
  34. package/source/css/_highlight/index.styl +1 -0
  35. package/source/css/_layout/header.styl +48 -48
  36. package/source/css/_tags/link.styl +7 -2
  37. package/source/js/barrage_comment.js +78 -0
  38. package/source/js/main.js +86 -17
  39. package/source/js/third_party/efu_ai.min.js +1 -1
  40. package/source/js/tw_cn.js +3 -3
  41. package/source/js/utils.js +62 -0
  42. package/source/js/commentBarrage/twikoo.js +0 -151
  43. package/source/js/commentBarrage/valine.js +0 -156
  44. package/source/js/commentBarrage/waline.js +0 -153
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [简体中文](README_zh-cn.md)丨[繁体中文](README_zh-tw.md)丨English
1
+ 简体中文丨[繁体中文](README_zh-tw.md)丨[English](README_en.md)
2
2
 
3
3
  <div align="center">
4
4
 
@@ -6,10 +6,10 @@
6
6
 
7
7
  <h1>Hexo Theme Solitude</h1>
8
8
 
9
- An elegant Hexo theme that supports lazy loading, PWA, Latex, and multiple comment systems.
9
+ 一款优雅的 Hexo 主题,支持懒加载、PWALatex以及多种评论系统。
10
+
11
+ 主题由 [@张洪Heo](https://github.com/zhheo) 作者全权授权、设计!
10
12
 
11
- Theme is fully licensed and designed by the author of [@张洪Heo](https://github.com/zhheo)!
12
-
13
13
  ![npm package](https://img.shields.io/npm/v/hexo-theme-solitude?color=blue&logo=npm)
14
14
  ![release](https://img.shields.io/github/package-json/v/valor-x/hexo-theme-solitude/master?color=%231ab1ad&label=release)
15
15
  ![license](https://img.shields.io/github/license/valor-x/hexo-theme-solitude?color=FF5531)
@@ -29,7 +29,7 @@
29
29
  [![pwa](https://img.shields.io/badge/pwa-red?logo=pwa)](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
30
30
 
31
31
  [![twiter](https://img.shields.io/badge/@efu__oo-gray?logo=x)](https://twitter.com/efu_oo)
32
- [![TG](https://img.shields.io/badge/efuome-gray?logo=Telegram&logoColor=white)](https://t.me/efuome)
32
+ [![TG](https://img.shields.io/badge/efuome-gray?logo=Telegram&logoColor=white)](https://t.me/solitudePro)
33
33
 
34
34
  ![JetBrains](https://img.shields.io/badge/jetbrains-support-black?logo=jetbrains)
35
35
  ![DuoLingo](https://img.shields.io/badge/duolingo-support-black?logo=duolingo&logoColor=white)
@@ -37,42 +37,42 @@
37
37
  [![gitee](https://img.shields.io/badge/Gitee-red?logo=gitee)](https://gitee.com/nsjjd_w/hexo-theme-solitude)
38
38
  [![gitlab](https://img.shields.io/badge/GitLab-blue?logo=gitlab)](https://gitlab.com/efu/hexo-theme-solitude)
39
39
 
40
- [Preview](https://efu.me/) 丨 [Documentation](https://solitude-docs.efu.me/)
40
+ [预览](https://efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
41
41
 
42
42
  </div>
43
43
 
44
44
  ![Screenshot](.github/screenshot.png)
45
45
 
46
- ## Features
46
+ ## 特性
47
47
 
48
- - PjaxLazyLoadPWA
49
- - Comments(Twikoo、Waline、Valine、Discuss)
50
- - ColorMode
51
- - Lightbox(medium-zoom、fancybox)
52
- - Mathematical formulas(Latex)
53
- - Featured pages: Instant Short Article, My Equipment, Online Tools, Music Gallery, Friend Chain Fish Pond, Photo Album Page, Douban Page
54
- - Article features: AI summary, code highlighting
48
+ - 页面懒加载(Pjax)、图片懒加载(LazyLoad)、离线应用(PWA
49
+ - 评论(Twikoo、Waline、Valine、Artalk),支持双评论
50
+ - 显示切换(ColorMode)
51
+ - 灯箱(medium-zoom、fancybox)
52
+ - 数学公式(Latex)
53
+ - 特色页面:即刻短文、我的装备、在线工具、音乐馆、友链鱼塘、相册页、豆瓣页
54
+ - 文章功能:AI 摘要、代码高亮
55
55
 
56
56
  ## Todo
57
57
 
58
- - [x] Support Waline
59
- - [ ] Tags plugin
60
- - [ ] Album reconstruction(Removed, to be refactored)
58
+ - [x] Waline 评论支持
59
+ - [ ] Tags plugin 插件化
60
+ - [ ] 相册页重构(已移除,待重构)
61
61
 
62
- ## Setup
62
+ ## 应用
63
63
 
64
- 1. Use the NPM package
64
+ 1. 使用 NPM 包进行安装
65
65
  ```bash
66
66
  npm i hexo-theme-solitude
67
67
  ```
68
- 2. Apply
68
+ 2. 应用主题
69
69
  ```yaml
70
70
  theme: solitude
71
71
  ```
72
+
73
+ 前往 [文档](https://solitude-docs.efu.me/) 获取更多信息。
72
74
 
73
- Check out the [Documentation](https://solitude-docs.efu.me/) for more information.
74
-
75
- ## Sponsors
75
+ ## 赞助者
76
76
 
77
77
  <p align="center">
78
78
  <a href="https://cdn.jsdelivr.net/gh/efuo/static/sponsors.svg">
@@ -80,6 +80,6 @@ Check out the [Documentation](https://solitude-docs.efu.me/) for more informatio
80
80
  </a>
81
81
  </p>
82
82
 
83
- ## License
83
+ ## 版权
84
84
 
85
- [MIT](./LICENSE) License &copy; 2023-PRESENT [Efu](https://github.com/efuo)
85
+ [MIT](./LICENSE) License &copy; 2023-至今 [Efu](https://github.com/efuo)
@@ -1,4 +1,4 @@
1
- 简体中文丨[繁体中文](README_zh-tw.md)丨[English](README.md)
1
+ [简体中文](README.md)丨[繁体中文](README_zh-tw.md)丨English
2
2
 
3
3
  <div align="center">
4
4
 
@@ -6,10 +6,10 @@
6
6
 
7
7
  <h1>Hexo Theme Solitude</h1>
8
8
 
9
- 一款优雅的 Hexo 主题,支持懒加载、PWALatex以及多种评论系统。
10
-
11
- 主题由 [@张洪Heo](https://github.com/zhheo) 作者全权授权、设计!
9
+ An elegant Hexo theme that supports lazy loading, PWA, Latex, and multiple comment systems.
12
10
 
11
+ Theme is fully licensed and designed by the author of [@张洪Heo](https://github.com/zhheo)!
12
+
13
13
  ![npm package](https://img.shields.io/npm/v/hexo-theme-solitude?color=blue&logo=npm)
14
14
  ![release](https://img.shields.io/github/package-json/v/valor-x/hexo-theme-solitude/master?color=%231ab1ad&label=release)
15
15
  ![license](https://img.shields.io/github/license/valor-x/hexo-theme-solitude?color=FF5531)
@@ -29,7 +29,7 @@
29
29
  [![pwa](https://img.shields.io/badge/pwa-red?logo=pwa)](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
30
30
 
31
31
  [![twiter](https://img.shields.io/badge/@efu__oo-gray?logo=x)](https://twitter.com/efu_oo)
32
- [![TG](https://img.shields.io/badge/efuome-gray?logo=Telegram&logoColor=white)](https://t.me/efuome)
32
+ [![TG](https://img.shields.io/badge/efuome-gray?logo=Telegram&logoColor=white)](https://t.me/solitudePro)
33
33
 
34
34
  ![JetBrains](https://img.shields.io/badge/jetbrains-support-black?logo=jetbrains)
35
35
  ![DuoLingo](https://img.shields.io/badge/duolingo-support-black?logo=duolingo&logoColor=white)
@@ -37,42 +37,42 @@
37
37
  [![gitee](https://img.shields.io/badge/Gitee-red?logo=gitee)](https://gitee.com/nsjjd_w/hexo-theme-solitude)
38
38
  [![gitlab](https://img.shields.io/badge/GitLab-blue?logo=gitlab)](https://gitlab.com/efu/hexo-theme-solitude)
39
39
 
40
- [预览](https://efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
40
+ [Preview](https://efu.me/) 丨 [Documentation](https://solitude-docs.efu.me/)
41
41
 
42
42
  </div>
43
43
 
44
44
  ![Screenshot](.github/screenshot.png)
45
45
 
46
- ## 特性
46
+ ## Features
47
47
 
48
- - 页面懒加载(Pjax)、图片懒加载(LazyLoad)、离线应用(PWA
49
- - 评论(Twikoo、Waline、Valine、Discuss)
50
- - 显示切换(ColorMode)
51
- - 灯箱(medium-zoom、fancybox)
52
- - 数学公式(Latex)
53
- - 特色页面:即刻短文、我的装备、在线工具、音乐馆、友链鱼塘、相册页、豆瓣页
54
- - 文章功能:AI 摘要、代码高亮
48
+ - PjaxLazyLoadPWA
49
+ - Comments(Twikoo、Waline、Valine、Artalk), Can double comment
50
+ - ColorMode
51
+ - Lightbox(medium-zoom、fancybox)
52
+ - Mathematical formulas(Latex)
53
+ - Featured pages: Instant Short Article, My Equipment, Online Tools, Music Gallery, Friend Chain Fish Pond, Photo Album Page, Douban Page
54
+ - Article features: AI summary, code highlighting
55
55
 
56
56
  ## Todo
57
57
 
58
- - [x] Waline 评论支持
59
- - [ ] Tags plugin 插件化
60
- - [ ] 相册页重构(已移除,待重构)
58
+ - [x] Support Waline
59
+ - [ ] Tags plugin
60
+ - [ ] Album reconstruction(Removed, to be refactored)
61
61
 
62
- ## 应用
62
+ ## Setup
63
63
 
64
- 1. 使用 NPM 包进行安装
64
+ 1. Use the NPM package
65
65
  ```bash
66
66
  npm i hexo-theme-solitude
67
67
  ```
68
- 2. 应用主题
68
+ 2. Apply
69
69
  ```yaml
70
70
  theme: solitude
71
71
  ```
72
-
73
- 前往 [文档](https://solitude-docs.efu.me/) 获取更多信息。
74
72
 
75
- ## 赞助者
73
+ Check out the [Documentation](https://solitude-docs.efu.me/) for more information.
74
+
75
+ ## Sponsors
76
76
 
77
77
  <p align="center">
78
78
  <a href="https://cdn.jsdelivr.net/gh/efuo/static/sponsors.svg">
@@ -80,6 +80,6 @@
80
80
  </a>
81
81
  </p>
82
82
 
83
- ## 版权
83
+ ## License
84
84
 
85
- [MIT](./LICENSE) License &copy; 2023-至今 [Efu](https://github.com/efuo)
85
+ [MIT](./LICENSE) License &copy; 2023-PRESENT [Efu](https://github.com/efuo)
package/README_zh-tw.md CHANGED
@@ -1,4 +1,4 @@
1
- [简体中文](README_zh-cn.md)丨繁体中文丨[English](README.md)
1
+ [简体中文](README.md)丨繁体中文丨[English](README_en.md)
2
2
 
3
3
  <div align="center">
4
4
 
@@ -29,7 +29,7 @@
29
29
  [![pwa](https://img.shields.io/badge/pwa-red?logo=pwa)](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
30
30
 
31
31
  [![twiter](https://img.shields.io/badge/@efu__oo-gray?logo=x)](https://twitter.com/efu_oo)
32
- [![TG](https://img.shields.io/badge/efuome-gray?logo=Telegram&logoColor=white)](https://t.me/efuome)
32
+ [![TG](https://img.shields.io/badge/efuome-gray?logo=Telegram&logoColor=white)](https://t.me/solitudePro)
33
33
 
34
34
  ![JetBrains](https://img.shields.io/badge/jetbrains-support-black?logo=jetbrains)
35
35
  ![DuoLingo](https://img.shields.io/badge/duolingo-support-black?logo=duolingo&logoColor=white)
@@ -46,7 +46,7 @@
46
46
  ## 特性
47
47
 
48
48
  - 頁面懶載入(Pjax)、圖片懶載入(LazyLoad)、離線應用(PWA)
49
- - 評論(Twikoo、Waline、Valine、Discuss)
49
+ - 評論(Twikoo、Waline、Valine、Artalk),支援雙評論
50
50
  - 顯示切換(ColorMode)
51
51
  - 燈箱(medium-zoom、fancybox)
52
52
  - 數學公式(Latex)
package/_config.yml CHANGED
@@ -64,7 +64,6 @@ nav:
64
64
  right:
65
65
  random: false # 随机文章跳转 / random post button
66
66
  console: false #控制台 / console
67
- top: false # 进度球 / Progress Ball
68
67
  # 自定义按钮
69
68
  # custom button
70
69
  # 左至右
@@ -709,38 +708,50 @@ katex:
709
708
 
710
709
  # 评论
711
710
  # comment
711
+ # getting start: http://solitude-docs.efu.me/comments/comment
712
712
  comment:
713
- enable: false
714
- type: # waline, twikoo
713
+ use: # waline, twikoo, valine, artalk
715
714
  commentBarrage: false # 热评开关 / Hot comment switch
716
- lazyload: true # 懒加载
717
- count: true # 评论数展示
715
+ lazyload: false # 懒加载
716
+ count: false # 评论数展示
718
717
  avatar: https://cravatar.cn # Gravatar link
719
718
  newest_comment:
720
719
  enable: false
721
- storage: .5 # 缓存时间 1: 1天 / .5 : 半天
722
- # twikoo 配置信息
723
- # twikoo settings
724
- twikoo: # https://twikoo.js.org/
725
- envId: # url: https://twikoo.sondy.top/
726
- lang: "zh-CN" # 语言
727
- accessToken: # accessToken
728
- # waline 配置信息
729
- # waline settings
730
- waline: # https://waline.js.org/
731
- envId: # url: https://waline.wzsco.top
732
- pageview: false # 是否开启页面访问量统计 / Whether to enable page access statistics
733
- option: # waline配置项 / waline configuration item
734
- # valine 配置信息
735
- # valine settings
736
- valine:
737
- appId: # leancloud application app id
738
- appKey: # leancloud application app key
739
- serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in)
740
- avatar:
741
- visitor: false
742
- option: # options list
743
-
720
+ storage: .5 # 缓存时间 1: 1天 / .5 : 半天 / Cache time 1: 1 day .5 : half a day
721
+
722
+ # twikoo 配置信息
723
+ # twikoo settings
724
+ twikoo: # https://twikoo.js.org/
725
+ envId: # url: https://twikoo.sondy.top/
726
+ region: # 环境地域,默认为 ap-shanghai,腾讯云环境填 ap-shanghai 或 ap-guangzhou;Vercel 环境不填
727
+ style: true # Use custom styles when turned on / 开启后使用自定义样式
728
+ accessToken: # AccessToken
729
+ option: # twikoo option
730
+
731
+ # waline 配置信息
732
+ # waline settings
733
+ waline: # https://waline.js.org/
734
+ envId: # url: https://waline.wzsco.top
735
+ pageview: false # 是否开启页面访问量统计 / Whether to enable page access statistics
736
+ option: # waline配置项 / waline configuration item
737
+
738
+ # valine 配置信息
739
+ # valine settings
740
+ valine:
741
+ appId: # leancloud application app id
742
+ appKey: # leancloud application app key
743
+ serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in)
744
+ avatar: # https://valine.js.org/avatar.html
745
+ visitor: false
746
+ style: true # Use custom styles when turned on / 开启后使用自定义样式
747
+ option: # options list
748
+
749
+ # artalk 配置信息
750
+ # artalk settings
751
+ artalk:
752
+ server: # server url / 后端地址
753
+ site: # site name / 站点名
754
+ option: # options
744
755
 
745
756
  # 中控台扩展 : 最新评论 + 标签 + 文章
746
757
  console_plus: false
@@ -814,7 +825,7 @@ right_menu:
814
825
  commentBarrage: false # 是否显示热评开关 / Whether to display the hot comment switch.
815
826
  # 翻译功能(仅支持简繁)
816
827
  # Translation function (Simplified and Traditional Chinese only)
817
- translate:
828
+ translate:
818
829
  enable: false
819
830
  defaultEncoding: 2 # 1: 默认繁体 2: 默认简体
820
831
  translateDelay: 0 # 首次加载翻译迟疑时间
@@ -852,7 +863,7 @@ CDN:
852
863
  internal: local
853
864
  # The CDN provider of third party scripts (第三方 js 的 cdn 配置)
854
865
  # option: jsdelivr/unpkg/cdnjs/custom
855
- third_party: custom
866
+ third_party: cdnjs
856
867
 
857
868
  # Add version number to url, true or false
858
869
  version: true
package/languages/en.yml CHANGED
@@ -101,6 +101,10 @@ console:
101
101
  switch_keyboard: Keyboard operation
102
102
  switch_music: Music switch
103
103
  archive_unit: Posts
104
+ newest_comment:
105
+ image: Image
106
+ link: Link
107
+ code: Code
104
108
 
105
109
  sidebar:
106
110
  function: Function
@@ -103,6 +103,10 @@ console:
103
103
  switch_keyboard: 键盘快捷键
104
104
  switch_music: 音乐开关
105
105
  archive_unit: 篇
106
+ newest_comment:
107
+ image: 图片
108
+ link: 链接
109
+ code: 代码
106
110
 
107
111
  sidebar:
108
112
  function: 功能
@@ -103,6 +103,10 @@ console:
103
103
  switch_keyboard: 鍵盤快捷鍵
104
104
  switch_music: 音樂開關
105
105
  archive_unit: 篇
106
+ newest_comment:
107
+ image: 圖片
108
+ link: 連結
109
+ code: 代碼
106
110
 
107
111
  sidebar:
108
112
  function: 功能
@@ -3,7 +3,7 @@ case theme.display_mode.type
3
3
  script.
4
4
  initTheme = () => {
5
5
  let isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
6
- const cachedMode = saveToLocal.get('theme');
6
+ const cachedMode = utils.saveToLocal.get('theme');
7
7
  if (cachedMode === undefined) {
8
8
  const nowMode =
9
9
  isDarkMode ? 'dark' : 'light'
@@ -11,25 +11,28 @@ case theme.display_mode.type
11
11
  } else {
12
12
  document.documentElement.setAttribute('data-theme', cachedMode);
13
13
  }
14
+ right_menu && rm.mode(cachedMode === 'dark' && isDarkMode)
14
15
  }
15
16
  initTheme()
16
17
  when "dark"
17
18
  script.
18
19
  initTheme = () => {
19
- const cachedMode = saveToLocal.get('theme');
20
+ const cachedMode = utils.saveToLocal.get('theme');
20
21
  if (cachedMode === undefined)
21
22
  document.documentElement.setAttribute('data-theme', 'dark');
22
23
  else
23
24
  document.documentElement.setAttribute('data-theme', cachedMode);
25
+ right_menu && rm.mode(cachedMode === undefined || cachedMode === 'dark')
24
26
  }
25
27
  initTheme()
26
28
  when "light"
27
29
  script.
28
30
  initTheme = () => {
29
- const cachedMode = saveToLocal.get('theme');
31
+ const cachedMode = utils.saveToLocal.get('theme');
30
32
  if (cachedMode === undefined)
31
33
  document.documentElement.setAttribute('data-theme', 'light');
32
34
  else
33
35
  document.documentElement.setAttribute('data-theme', cachedMode);
36
+ right_menu && rm.mode(cachedMode === 'dark')
34
37
  }
35
38
  initTheme()
@@ -31,34 +31,6 @@
31
31
  avatar: theme.comment.avatar,
32
32
  commentBarrage: theme.comment.commentBarrage,
33
33
  }
34
- switch (theme.comment.type) {
35
- case "twikoo":
36
- comment.url = theme.comment.twikoo.envId
37
- comment.accessToken = theme.comment.twikoo.accessToken
38
- comment.owo = {
39
- body: '.OwO-body',
40
- item: '.OwO-items li'
41
- }
42
- break
43
- case "waline":
44
- comment.url = theme.comment.waline.envId
45
- comment.owo = {
46
- body: '.wl-emoji-popup',
47
- item: '.wl-tab-wrapper button'
48
- }
49
- break
50
- case "valine":
51
- comment.url = theme.comment.valine.serverURLs
52
- comment.appId = theme.comment.valine.appId
53
- comment.appKey = theme.comment.valine.appKey
54
- comment.owo = {
55
- body: '.vwrap',
56
- item: '.vemojis i'
57
- }
58
- break
59
- default:
60
- break
61
- }
62
34
  }
63
35
 
64
36
  let post_ai = false
@@ -0,0 +1,9 @@
1
+ script#config-diff.
2
+ var PAGE_CONFIG = {
3
+ is_post: !{is_post()},
4
+ is_page: !{!is_post() && !is_home()},
5
+ is_home: !{is_home()},
6
+ page: '!{page.type}',
7
+ toc: !{!!page.toc},
8
+ comment: !{!!page.comment},
9
+ }
@@ -26,4 +26,7 @@ link(rel="stylesheet", href=url_for(theme.cdn.main_css))
26
26
  include ./inject/head.pug
27
27
 
28
28
  // global head
29
- include ./head/config.pug
29
+ include ./head/config.pug
30
+
31
+ // page-config head
32
+ include ./head/page_config
@@ -11,15 +11,9 @@ mixin katex
11
11
  })();
12
12
 
13
13
  div
14
- script(src=url_for(theme.cdn.main))
15
- script(src=url_for(theme.cdn.utils))
16
14
  script(src=url_for(theme.cdn.waterfall))
17
15
  script(src=url_for(theme.cdn.pjax))
18
16
 
19
- if theme.comment.enable && theme.comment.type === 'valine'
20
- // md5
21
- script(src=url_for(theme.cdn.blueimp_md5))
22
-
23
17
  if theme.mermaid
24
18
  script(src=url_for(theme.cdn.mermaid_js))
25
19
 
@@ -65,23 +59,10 @@ div
65
59
  script.
66
60
  const coverColorConfig = {
67
61
  api: '!{theme.post.covercolor.api}',
68
- time: !{theme.post.covercolor.time},
62
+ time: !{theme.post.covercolor.time}
69
63
  }
70
64
  script(src=url_for(theme.cdn.cover_api))
71
65
 
72
- if theme.comment.enable
73
- case theme.comment.type
74
- when 'twikoo'
75
- script(src=url_for(theme.cdn.twikoo))
76
- if theme.comment.commentBarrage
77
- case theme.comment.type
78
- when 'twikoo'
79
- script(src=url_for(theme.cdn.twikoo_commentBarrage))
80
- when 'waline'
81
- script(src=url_for(theme.cdn.waline_commentBarrage))
82
- when 'valine'
83
- script(src=url_for(theme.cdn.valine_commentBarrage))
84
-
85
66
  if theme.music.enable
86
67
  script(src=url_for(theme.cdn.music_js))
87
68
 
@@ -113,15 +94,6 @@ div#js-pjax
113
94
  if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv)
114
95
  script(async src=url_for(theme.cdn.busuanzi_js))
115
96
 
116
- script#config-diff.
117
- var PAGE_CONFIG = {
118
- is_post: !{is_post()},
119
- is_page: !{!is_post() && !is_home()},
120
- is_home: !{is_home()},
121
- page: '!{page.type}',
122
- toc: !{!!page.toc},
123
- comment: !{!!page.comment},
124
- }
125
97
 
126
98
  if theme.footer.randomlink
127
99
  include ../widgets/randomlink.pug
@@ -11,9 +11,11 @@ if theme.capsule.enable || theme.music.enable
11
11
  if (theme.says.home_mini && theme.says.enable) || theme.carousel
12
12
  link(rel="stylesheet", href=url_for(theme.cdn.swiper_css))
13
13
 
14
+ // fancybox ui
14
15
  if theme.lightbox && theme.fancybox
15
16
  link(rel="stylesheet", href=url_for(theme.cdn.fancyapps_css))
16
17
 
18
+ // katex
17
19
  if theme.katex && theme.katex.enable
18
20
  link(rel="stylesheet", href=url_for(theme.cdn.katex))
19
21
 
@@ -25,97 +27,19 @@ if theme.pwa.enable
25
27
  include ../head/pwa.pug
26
28
 
27
29
  script.
28
- (win => {
29
- win.saveToLocal = {
30
- set: function setWithExpiry(key, value, ttl) {
31
- if (ttl === 0)
32
- return
33
- const now = new Date()
34
- const expiryDay = ttl * 86400000
35
- const item = {
36
- value: value,
37
- expiry: now.getTime() + expiryDay
38
- }
39
- localStorage.setItem(key, JSON.stringify(item))
40
- },
41
-
42
- get: function getWithExpiry(key) {
43
- const itemStr = localStorage.getItem(key)
44
-
45
- if (!itemStr) {
46
- return undefined
47
- }
48
- const item = JSON.parse(itemStr)
49
- const now = new Date()
50
-
51
- if (now.getTime() > item.expiry) {
52
- localStorage.removeItem(key)
53
- return undefined
54
- }
55
- return item.value
56
- }
57
- }
58
-
59
- const DarkModeStatus = localStorage.getItem('theme')
60
- if (DarkModeStatus !== null) {
61
- if (DarkModeStatus === 'dark') {
62
- document.documentElement.setAttribute('data-theme', 'dark')
63
- } else {
64
- document.documentElement.setAttribute('data-theme', 'light')
65
- }
66
- }
67
-
68
- const asideStatus = saveToLocal.get('aside-status')
69
- if (asideStatus !== undefined) {
70
- if (asideStatus === 'hide') {
71
- document.documentElement.classList.add('hide-aside')
72
- } else {
73
- document.documentElement.classList.remove('hide-aside')
74
- }
75
- }
76
-
77
- win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
78
- const link = document.createElement('link')
79
- link.rel = 'stylesheet'
80
- link.href = url
81
- if (id) link.id = id
82
- link.onerror = reject
83
- link.onload = link.onreadystatechange = function () {
84
- const loadState = this.readyState
85
- if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
86
- link.onload = link.onreadystatechange = null
87
- resolve()
88
- }
89
- document.head.appendChild(link)
90
- })
91
-
92
- win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
93
- const script = document.createElement('script')
94
- script.src = url
95
- script.async = true
96
- script.onerror = reject
97
- script.onload = script.onreadystatechange = function () {
98
- const loadState = this.readyState
99
- if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
100
- script.onload = script.onreadystatechange = null
101
- resolve()
102
- }
103
-
104
- Object.keys(attr).forEach(key => {
105
- script.setAttribute(key, attr[key])
106
- })
107
-
108
- document.head.appendChild(script)
109
- })
110
- }
111
- )(window)
112
-
113
30
  console.log(
114
- "%c Program: Hexo %c Theme: Solitude %c Version: v1.7.13",
31
+ "%c Program: Hexo %c Theme: Solitude %c Version: v1.8.0",
115
32
  "border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
116
33
  "padding: 5px 10px;color:white;background:#3e9f50;",
117
34
  "border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
118
35
  );
36
+
119
37
  if theme.extends.head
120
38
  each item in theme.extends.head
121
- != item
39
+ != item
40
+
41
+ script(src=url_for(theme.cdn.utils))
42
+ script(src=url_for(theme.cdn.main))
43
+
44
+ if theme.comment.use.includes('Valine')
45
+ script(src=url_for(theme.cdn.blueimp_md5))