hexo-theme-solitude 1.9.2 → 1.9.3

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/.github/ISSUE_TEMPLATE/config.yml +5 -1
  2. package/CODE_OF_CONDUCT.md +53 -93
  3. package/_config.yml +11 -0
  4. package/languages/default.yml +12 -7
  5. package/languages/en.yml +12 -7
  6. package/languages/zh-CN.yml +8 -3
  7. package/languages/zh-TW.yml +7 -4
  8. package/layout/includes/head/opengraph.pug +1 -0
  9. package/layout/includes/inject/head.pug +2 -2
  10. package/layout/includes/page/message.pug +5 -0
  11. package/layout/includes/page/music.pug +2 -2
  12. package/layout/includes/widgets/aside/asideArchive.pug +1 -1
  13. package/layout/includes/widgets/page/message/content.pug +9 -0
  14. package/layout/includes/widgets/page/message/js.pug +8 -0
  15. package/layout/includes/widgets/page/message/twikoo.pug +44 -0
  16. package/layout/includes/widgets/page/message/valine.pug +48 -0
  17. package/layout/includes/widgets/page/message/waline.pug +0 -0
  18. package/layout/includes/widgets/randomlink.pug +10 -4
  19. package/layout/includes/widgets/third-party/news-comment/artalk.pug +3 -3
  20. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +3 -3
  21. package/layout/includes/widgets/third-party/news-comment/valine.pug +3 -3
  22. package/layout/includes/widgets/third-party/news-comment/waline.pug +3 -3
  23. package/layout/page.pug +2 -0
  24. package/package.json +2 -2
  25. package/plugins.yml +6 -6
  26. package/scripts/event/cdn.js +6 -1
  27. package/source/css/_global/index.styl +8 -13
  28. package/source/css/_highlight/highlight/diff.styl +6 -2
  29. package/source/css/_highlight/highlight/index.styl +1 -0
  30. package/source/css/_layout/article-container.styl +9 -3
  31. package/source/css/_layout/aside.styl +1 -0
  32. package/source/css/_layout/console.styl +3 -1
  33. package/source/css/_page/index.styl +1 -1
  34. package/source/css/_page/message.styl +63 -0
  35. package/source/css/_page/music.styl +1 -1
  36. package/source/css/_page/tag.styl +1 -0
  37. package/source/css/_tags/note.styl +5 -0
  38. package/source/css/third_party/snackbar.min.css +1 -1
  39. package/source/js/third_party/barrage.min.js +6 -0
  40. package/source/js/third_party/efu_ai.min.js +4 -4
  41. package/source/js/third_party/envelope.min.js +5 -0
  42. package/source/js/third_party/universe.min.js +1 -1
  43. package/source/css/_page/douban.styl +0 -127
  44. package/source/js/barrage_comment.js +0 -77
@@ -5,9 +5,13 @@ contact_links:
5
5
  about: 一些使用上碰到的问题 Discussion 询问。 Please ask questions in Discussion.
6
6
 
7
7
  - name: Solitude Q&A
8
- url: https://solitude-docs.efu.me/faq
8
+ url: https://docs.efu.me/faq
9
9
  about: Solitude Q&A
10
10
 
11
+ - name: QQ群
12
+ url: https://qm.qq.com/q/mxfomMvJPG
13
+ about: 新建立的QQ群
14
+
11
15
  - name: Discord
12
16
  url: https://discord.gg/Y8VEvVgW
13
17
  about: 'Official Discord Group'
@@ -1,128 +1,88 @@
1
- # Contributor Covenant Code of Conduct
2
1
 
3
- ## Our Pledge
2
+ # 贡献者公约
4
3
 
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, religion, or sexual identity
10
- and orientation.
4
+ ## 我们的承诺
11
5
 
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
6
+ 身为社区成员、贡献者和领袖,我们承诺使社区参与者不受骚扰,无论其年龄、体型、可见或不可见的缺陷、族裔、性征、性别认同和表达、经验水平、教育程度、社会与经济地位、国籍、相貌、种族、种姓、肤色、宗教信仰、性倾向或性取向如何。
14
7
 
15
- ## Our Standards
8
+ 我们承诺以有助于建立开放、友善、多样化、包容、健康社区的方式行事和互动。
16
9
 
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
10
+ ## 我们的准则
19
11
 
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the
26
- overall community
12
+ 有助于为我们的社区创造积极环境的行为例子包括但不限于:
27
13
 
28
- Examples of unacceptable behavior include:
14
+ * 表现出对他人的同情和善意
15
+ * 尊重不同的主张、观点和感受
16
+ * 提出和大方接受建设性意见
17
+ * 承担责任并向受我们错误影响的人道歉
18
+ * 注重社区共同诉求,而非个人得失
29
19
 
30
- * The use of sexualized language or imagery, and sexual attention or
31
- advances of any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email
35
- address, without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
20
+ 不当行为例子包括:
38
21
 
39
- ## Enforcement Responsibilities
22
+ * 使用情色化的语言或图像,及性引诱或挑逗
23
+ * 嘲弄、侮辱或诋毁性评论,以及人身或政治攻击
24
+ * 公开或私下的骚扰行为
25
+ * 未经他人明确许可,公布他人的私人信息,如物理或电子邮件地址
26
+ * 其他有理由认定为违反职业操守的不当行为
40
27
 
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
28
+ ## 责任和权力
45
29
 
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
30
+ 社区领袖有责任解释和落实我们所认可的行为准则,并妥善公正地对他们认为不当、威胁、冒犯或有害的任何行为采取纠正措施。
50
31
 
51
- ## Scope
32
+ 社区领导有权力和责任删除、编辑或拒绝或拒绝与本行为准则不相符的评论(comment)、提交(commits)、代码、维基(wiki)编辑、议题(issues)或其他贡献,并在适当时机知采取措施的理由。
52
33
 
53
- This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official e-mail address,
56
- posting via an official social media account, or acting as an appointed
57
- representative at an online or offline event.
34
+ ## 适用范围
58
35
 
59
- ## Enforcement
36
+ 本行为准则适用于所有社区场合,也适用于在公共场所代表社区时的个人。
60
37
 
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at
63
- o@efu.me.
64
- All complaints will be reviewed and investigated promptly and fairly.
38
+ 代表社区的情形包括使用官方电子邮件地址、通过官方社交媒体帐户发帖或在线上或线下活动中担任指定代表。
65
39
 
66
- All community leaders are obligated to respect the privacy and security of the
67
- reporter of any incident.
40
+ ## 监督
68
41
 
69
- ## Enforcement Guidelines
42
+ 辱骂、骚扰或其他不可接受的行为可通过 [插入联系方式] 向负责监督的社区领袖报告。
43
+ 所有投诉都将得到及时和公平的审查和调查。
70
44
 
71
- Community leaders will follow these Community Impact Guidelines in determining
72
- the consequences for any action they deem in violation of this Code of Conduct:
45
+ 所有社区领袖都有义务尊重任何事件报告者的隐私和安全。
73
46
 
74
- ### 1. Correction
47
+ ## 处理方针
75
48
 
76
- **Community Impact**: Use of inappropriate language or other behavior deemed
77
- unprofessional or unwelcome in the community.
49
+ 社区领袖将遵循下列社区处理方针来明确他们所认定违反本行为准则的行为的处理方式:
78
50
 
79
- **Consequence**: A private, written warning from community leaders, providing
80
- clarity around the nature of the violation and an explanation of why the
81
- behavior was inappropriate. A public apology may be requested.
51
+ ### 1. 纠正
82
52
 
83
- ### 2. Warning
53
+ **社区影响**:使用不恰当的语言或其他在社区中被认定为不符合职业道德或不受欢迎的行为。
84
54
 
85
- **Community Impact**: A violation through a single incident or series
86
- of actions.
55
+ **处理意见**:由社区领袖发出非公开的书面警告,明确说明违规行为的性质,并解释举止如何不妥。或将要求公开道歉。
87
56
 
88
- **Consequence**: A warning with consequences for continued behavior. No
89
- interaction with the people involved, including unsolicited interaction with
90
- those enforcing the Code of Conduct, for a specified period of time. This
91
- includes avoiding interactions in community spaces as well as external channels
92
- like social media. Violating these terms may lead to a temporary or
93
- permanent ban.
57
+ ### 2. 警告
94
58
 
95
- ### 3. Temporary Ban
59
+ **社区影响**:单个或一系列违规行为。
96
60
 
97
- **Community Impact**: A serious violation of community standards, including
98
- sustained inappropriate behavior.
61
+ **处理意见**:警告并对连续性行为进行处理。在指定时间内,不得与相关人员互动,包括主动与行为准则执行者互动。这包括避免在社区场所和外部渠道中的互动。违反这些条款可能会导致临时或永久封禁。
99
62
 
100
- **Consequence**: A temporary ban from any sort of interaction or public
101
- communication with the community for a specified period of time. No public or
102
- private interaction with the people involved, including unsolicited interaction
103
- with those enforcing the Code of Conduct, is allowed during this period.
104
- Violating these terms may lead to a permanent ban.
63
+ ### 3. 临时封禁
105
64
 
106
- ### 4. Permanent Ban
65
+ **社区影响**: 严重违反社区准则,包括持续的不当行为。
107
66
 
108
- **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
110
- individual, or aggression toward or disparagement of classes of individuals.
67
+ **处理意见**: 在指定时间内,暂时禁止与社区进行任何形式的互动或公开交流。在此期间,不得与相关人员进行公开或私下互动,包括主动与行为准则执行者互动。违反这些条款可能会导致永久封禁。
111
68
 
112
- **Consequence**: A permanent ban from any sort of public interaction within
113
- the community.
69
+ ### 4. 永久封禁
114
70
 
115
- ## Attribution
71
+ **社区影响**:行为模式表现出违反社区准则,包括持续的不当行为、骚扰个人或攻击或贬低某个类别的个体。
116
72
 
117
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
- version 2.0, available at
119
- https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
73
+ **处理意见**:永久禁止在社区内进行任何形式的公开互动。
120
74
 
121
- Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
- enforcement ladder](https://github.com/mozilla/diversity).
75
+ ## 参见
123
76
 
124
- [homepage]: https://www.contributor-covenant.org
77
+ 本行为准则改编自 [Contributor Covenant][homepage] 2.1 版, 参见 [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]。
78
+
79
+ 社区处理方针灵感来源于 [Mozilla's code of conduct enforcement ladder][Mozilla CoC]。
125
80
 
126
- For answers to common questions about this code of conduct, see the FAQ at
127
- https://www.contributor-covenant.org/faq. Translations are available at
128
- https://www.contributor-covenant.org/translations.
81
+ 有关本行为准则的常见问题的答案,参见 [https://www.contributor-covenant.org/faq][FAQ]。
82
+ 其他语言翻译参见 [https://www.contributor-covenant.org/translations][translations]。
83
+
84
+ [homepage]: https://www.contributor-covenant.org
85
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
86
+ [Mozilla CoC]: https://github.com/mozilla/diversity
87
+ [FAQ]: https://www.contributor-covenant.org/faq
88
+ [translations]: https://www.contributor-covenant.org/translations
package/_config.yml CHANGED
@@ -504,6 +504,17 @@ says:
504
504
  # Talk short text only shows the first n
505
505
  strip: 30
506
506
 
507
+ # 留言板
508
+ # message board
509
+ # 前置要求:需配置留言板页面
510
+ # Pre-requirements: message board page needs to be configured
511
+ envelope:
512
+ enable: false
513
+ line: 10 # 显示行数
514
+ speed: 20 # 播放速度
515
+ hover: true # 鼠标悬停暂停
516
+ loop: true # 循环播放
517
+
507
518
  # -------------------------
508
519
  # meeting-api,用于界面中的音乐胶囊和音乐馆页,可自定义api,不会请勿动。
509
520
  # meeting-api, used for music capsules and music halls in the interface, can customize api, do not move if you don't know.
@@ -1,16 +1,16 @@
1
1
  more: More
2
2
  star: Behold, those who found delight in this piece also perused
3
- random: Around
3
+ random: Random
4
4
  upload: 'datetime: '
5
5
  totalk: You don't need to delete blank lines, just type in your comments.
6
6
 
7
7
  theme:
8
- dark: dark
9
- light: light
8
+ dark: Dark
9
+ light: Light
10
10
 
11
11
  copy:
12
12
  success: Copied
13
- error: Copied failed
13
+ error: Copy failed
14
14
 
15
15
  copy_copyright:
16
16
  author: Author
@@ -139,7 +139,8 @@ link:
139
139
  banner:
140
140
  toComment: Application link
141
141
  random: Random Visit
142
- random: You are about to ⌈ ${name} ⌋ , security unknown.
142
+ random: 'Click the button to visit a random link. The safety and availability of the destination website are not guaranteed. The random link for this visit is: ⌈ ${name} ⌋ '
143
+ to: To
143
144
 
144
145
  keyboard:
145
146
  title: Blog shortcuts
@@ -190,11 +191,15 @@ about:
190
191
  oneself:
191
192
  map_title: I live in
192
193
  info_title1: Born
193
- info_title2: Now occupational
194
+ info_title2: Current occupation
194
195
  tj:
195
196
  tip: Data
196
197
  title: Access statistics
197
198
  post_tip: 'Stats from:'
198
199
  personalities:
199
200
  tip1: At
200
- tip2: 'Learn more:'
201
+ tip2: 'Learn more:'
202
+
203
+ message:
204
+ close: Hide message
205
+ open: Show message
package/languages/en.yml CHANGED
@@ -1,16 +1,16 @@
1
1
  more: More
2
2
  star: Behold, those who found delight in this piece also perused
3
- random: Around
3
+ random: Random
4
4
  upload: 'datetime: '
5
5
  totalk: You don't need to delete blank lines, just type in your comments.
6
6
 
7
7
  theme:
8
- dark: dark
9
- light: light
8
+ dark: Dark
9
+ light: Light
10
10
 
11
11
  copy:
12
12
  success: Copied
13
- error: Copied failed
13
+ error: Copy failed
14
14
 
15
15
  copy_copyright:
16
16
  author: Author
@@ -139,7 +139,8 @@ link:
139
139
  banner:
140
140
  toComment: Application link
141
141
  random: Random Visit
142
- random: You are about to ⌈ ${name} ⌋ , security unknown.
142
+ random: 'Click the button to visit a random link. The safety and availability of the destination website are not guaranteed. The random link for this visit is: ⌈ ${name} ⌋ '
143
+ to: To
143
144
 
144
145
  keyboard:
145
146
  title: Blog shortcuts
@@ -190,11 +191,15 @@ about:
190
191
  oneself:
191
192
  map_title: I live in
192
193
  info_title1: Born
193
- info_title2: Now occupational
194
+ info_title2: Current occupation
194
195
  tj:
195
196
  tip: Data
196
197
  title: Access statistics
197
198
  post_tip: 'Stats from:'
198
199
  personalities:
199
200
  tip1: At
200
- tip2: 'Learn more:'
201
+ tip2: 'Learn more:'
202
+
203
+ message:
204
+ close: Hide message
205
+ open: Show message
@@ -141,8 +141,9 @@ link:
141
141
  banner:
142
142
  toComment: 申请友链
143
143
  random: 随机访问
144
- random: 您即将前往 ${name} ⌋ , 安全性未知
145
-
144
+ random: 点击前往按钮进入随机一个友链,不保证跳转网站的安全性和可用性。本次随机到的是本站友链:⌈ ${name} ⌋
145
+ to: 前往
146
+
146
147
  keyboard:
147
148
  title: 博客快捷键
148
149
 
@@ -199,4 +200,8 @@ about:
199
200
  post_tip: 统计信息来自
200
201
  personalities:
201
202
  tip1: 在
202
- tip2: 了解更多关于
203
+ tip2: 了解更多关于
204
+
205
+ message:
206
+ close: 隐藏弹幕
207
+ open: 显示弹幕
@@ -140,9 +140,8 @@ music:
140
140
  link:
141
141
  banner:
142
142
  toComment: 申請友鏈
143
- random: 隨機訪問
144
- random: 您即將前往 ⌈ ${name} ⌋ , 安全性未知
145
-
143
+ random: 點擊前往按鈕進入隨機一個友鏈,不保證跳轉網站的安全性和可用性。本次隨機到的是本站友鏈:⌈ ${name} ⌋
144
+ to: 前往
146
145
  keyboard:
147
146
  title: 博客快捷鍵
148
147
 
@@ -199,4 +198,8 @@ about:
199
198
  post_tip: 統計信息來自
200
199
  personalities:
201
200
  tip1: 在
202
- tip2: 瞭解更多關於
201
+ tip2: 瞭解更多關於
202
+
203
+ message:
204
+ close: 隱藏彈幕
205
+ open: 顯示彈幕
@@ -8,5 +8,6 @@ if theme.OpenGraph.enable
8
8
  }
9
9
  -
10
10
  != open_graph(ogOption)
11
+ meta(name="description" content=page_description())
11
12
  else
12
13
  meta(name="description" content=page_description())
@@ -4,7 +4,7 @@ each item in theme.verify_site || []
4
4
  link(rel="stylesheet", href=url_for(theme.cdn.solitude_css))
5
5
 
6
6
  // aplayer
7
- if theme.capsule.enable || theme.music.enable || theme.says.enable
7
+ if theme.capsule.enable || theme.music.enable
8
8
  link(rel="stylesheet", href=url_for(theme.cdn.aplayer_css))
9
9
 
10
10
  // swiper
@@ -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.9.2",
30
+ "%c Program: Hexo %c Theme: Solitude %c Version: v1.9.3",
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
  "padding: 5px 10px;color:white;background:#0084ff;",
@@ -0,0 +1,5 @@
1
+ - const { line,speed,hover,loop,enable } = theme.envelope
2
+
3
+ include ../widgets/page/message/content
4
+ if enable
5
+ include ../widgets/page/message/js
@@ -1,9 +1,9 @@
1
1
  if theme.music.enable
2
2
  #Music-bg
3
3
  #Music-page
4
- meting-js(id=theme.music.id, server=theme.music.server, type=theme.music.type, mutex=theme.music.mutex, volume=theme.music.volume, preload="none", data-lrctype="0", order="random")
4
+ meting-js(id=theme.music.id server=theme.music.server type=theme.music.type mutex=theme.music.mutex ? "true" : "false" volume=theme.music.volume preload="none" data-lrctype="0" order="random")
5
5
  .Music-loading
6
- div APlayer加载中...'
6
+ div APlayer加载中...
7
7
  script(pjax).
8
8
  (async function () {
9
9
  if (typeof initializeMusicPlayer === "undefined") await utils.getScript('!{url_for(theme.cdn.music_js)}').then(() => initializeMusicPlayer())
@@ -4,7 +4,7 @@ ul.card-archive-list
4
4
  - var type = archive.type ? archive.type : 'year'
5
5
  each value, key in getArchiveLength(type)
6
6
  li.card-archive-list-item
7
- a.card-archive-list-link(onclick=`pjax.loadUrl('/archives/${key}/')`, href="javascript:void(0);")
7
+ a.card-archive-list-link(href=`/archives/${key}/`)
8
8
  span.card-archive-list-date= key
9
9
  .card-archive-list-count-group
10
10
  span.card-archive-list-count= value
@@ -0,0 +1,9 @@
1
+ #article-container
2
+ != page.content
3
+ if theme.envelope.enable
4
+ .switch_message
5
+ button.open(type='button' onclick="document.getElementById('barrage').classList.remove('hide')")
6
+ span(aria-hidden='true')= __('message.open')
7
+ button.close(type='button' onclick="document.getElementById('barrage').classList.add('hide')")
8
+ span(aria-hidden='true')= __('message.close')
9
+ #barrage
@@ -0,0 +1,8 @@
1
+ - const {use,avatar} = theme.comment
2
+
3
+ if use
4
+ case use[0]
5
+ when "Valine"
6
+ include ./valine
7
+ when "Twikoo"
8
+ include ./twikoo
@@ -0,0 +1,44 @@
1
+ - const {envId} = theme.twikoo
2
+
3
+ script(pjax).
4
+ (async () => {
5
+ if(typeof EasyDanmaku === "undefined") await utils.getScript('!{url_for(theme.cdn.envelope_js)}')
6
+ const Danmaku = new EasyDanmaku({
7
+ page: '/message/',
8
+ el: '#barrage',
9
+ line: !{line},
10
+ speed: !{speed},
11
+ hover: !{hover},
12
+ loop: !{loop},
13
+ })
14
+ const data = utils.saveToLocal.get('enevlope')
15
+ if(data){
16
+ Danmaku.batchSend(data,true)
17
+ return
18
+ }
19
+ let ls = []
20
+ fetch('!{envId}/', {
21
+ method: "POST",
22
+ body: JSON.stringify({
23
+ "event": "GET_RECENT_COMMENTS",
24
+ "includeReply": false,
25
+ "pageSize": 100
26
+ }),
27
+ headers: { 'Content-Type': 'application/json' }
28
+ }).then(res => res.json()).then(({ data }) => {
29
+ data.forEach(i => {
30
+ if (i.avatar == undefined) i.avatar = '!{avatar}/avatar/d615d5793929e8c7d70eab5f00f7f5f1?d=mp'
31
+ ls.push({ avatar: i.avatar, content: i.nick + ':' + formatDanmaku(i.comment), url: i.url + '#' + i.id })
32
+ });
33
+ Danmaku.batchSend(ls, true);
34
+ utils.saveToLocal.set('envelope', ls, 0.02)
35
+ });
36
+ function formatDanmaku(str) {
37
+ str = str.replace(/<\/*br>|[\s\uFEFF\xA0]+/g, '');
38
+ str = str.replace(/<img.*?>/g, '[!{__("console.newest_comment.image")}]');
39
+ str = str.replace(/<a.*?>.*?<\/a>/g, '[!{__("console.newest_comment.link")}]');
40
+ str = str.replace(/<pre.*?>.*?<\/pre>/g, '[!{__("console.newest_comment.code")}]');
41
+ str = str.replace(/<.*?>/g, '');
42
+ return str
43
+ }
44
+ })()
@@ -0,0 +1,48 @@
1
+ - const {serverURLs,appId,appKey} = theme.valine
2
+
3
+ script(pjax).
4
+ (async () => {
5
+ if(typeof EasyDanmaku === "undefined") await utils.getScript('!{url_for(theme.cdn.envelope_js)}')
6
+ const envel = new EasyDanmaku({
7
+ page: '/message/',
8
+ el: '#barrage',
9
+ line: !{line},
10
+ speed: !{speed},
11
+ hover: !{hover},
12
+ loop: !{loop},
13
+ })
14
+ const data = utils.saveToLocal.get('enevlope')
15
+ if(data){
16
+ envel.batchSend(data,true)
17
+ return
18
+ }
19
+ const url = new URL('!{serverURLs}/1.1/classes/Comment')
20
+ const params = {
21
+ url: window.location.pathname,
22
+ order: '-createdAt'
23
+ }
24
+ Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value))
25
+ try {
26
+ const res = await fetch(url, {
27
+ method: "GET",
28
+ headers: {
29
+ "X-LC-Id": "#{appId}",
30
+ "X-LC-Key": "#{appKey}",
31
+ "Content-Type": "application/json"
32
+ },
33
+ })
34
+ if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`)
35
+ const data = await res.json()
36
+ const init = () =>
37
+ data.results.map(item => ({
38
+ content: item.comment,
39
+ avatar: '!{avatar}/avatar/'+md5(item.mail),
40
+ url: item.url,
41
+ }))
42
+ if (typeof md5 === "undefined") await utils.getScript('!{url_for(theme.cdn.blueimp_md5)}')
43
+ envel.batchSend(init(),true)
44
+ utils.saveToLocal.set('enevlope',init(),.02)
45
+ } catch (error) {
46
+ console.error("An error occurred while fetching comments: ", error)
47
+ }
48
+ })()
@@ -11,10 +11,16 @@ script.
11
11
  const randomText = '!{_p('link.random')}'
12
12
  function travelling() {
13
13
  const link = links[utils.randomNum(links.length)];
14
- utils.snackbarShow(randomText.replace(/\$\{name}/, link.name), false, 3000);
15
- setTimeout(() => {
16
- window.open(link.link, "_blank")
17
- }, 3000)
14
+ Snackbar.show({
15
+ text: randomText.replace(/\$\{name}/,link.name),
16
+ duration: 8000,
17
+ pos: 'top-center',
18
+ actionText: '!{_p('link.to')}',
19
+ onActionClick: function(element) {
20
+ element.style.opacity = 0;
21
+ window.open(link.link, '_blank');
22
+ }
23
+ });
18
24
  }
19
25
 
20
26
  if theme.footer.randomlink
@@ -21,12 +21,12 @@ script.
21
21
  const generateHtml = (array, asideList) => {
22
22
  asideList.innerHTML = array.length ? array.map(item => `
23
23
  <div class='aside-list-item'>
24
- <a onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
24
+ <div onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
25
25
  <img src='${item.avatar}' alt='${item.nick}'>
26
26
  <div class='name'><span>${item.nick}</span></div>
27
- </a>
27
+ </div>
28
28
  <div class='content'>
29
- <a class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</a>
29
+ <div class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</div>
30
30
  <time class="datetime" datetime="${item.date}"></time>
31
31
  </div>
32
32
  </div>
@@ -17,12 +17,12 @@ script.
17
17
  const generateHtml = (array) => {
18
18
  const html = array.map(item => `
19
19
  <div class='aside-list-item'>
20
- <a onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
20
+ <div onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
21
21
  <img src='${item.avatar}' alt='${item.nick}'>
22
22
  <div class='name'><span>${item.nick}</span></div>
23
- </a>
23
+ </div>
24
24
  <div class='content'>
25
- <a class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</a>
25
+ <div class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</div>
26
26
  <time class="datetime" datetime="${item.date}"></time>
27
27
  </div>
28
28
  </div>
@@ -62,12 +62,12 @@ script.
62
62
  const $dom = document.querySelector('#card-newest-comments .aside-list')
63
63
  $dom.innerHTML = array.length ? array.map(item => `
64
64
  <div class='aside-list-item'>
65
- <a onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
65
+ <div onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
66
66
  <img src='${item.avatar}' alt='${item.nick}'>
67
67
  <div class='name'><span>${item.nick}</span></div>
68
- </a>
68
+ </div>
69
69
  <div class='content'>
70
- <a class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</a>
70
+ <div class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</div>
71
71
  <time class="datetime" datetime="${item.date}"></time>
72
72
  </div>
73
73
  </div>
@@ -52,12 +52,12 @@ script.
52
52
  const $dom = document.querySelector('#card-newest-comments .aside-list')
53
53
  $dom.innerHTML = array.length ? array.map(item => `
54
54
  <div class='aside-list-item'>
55
- <a onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
55
+ <div onclick='pjax.loadUrl("${item.url}")' class='thumbnail'>
56
56
  <img src='${item.avatar}' alt='${item.nick}'>
57
57
  <div class='name'><span>${item.nick}</span></div>
58
- </a>
58
+ </div>
59
59
  <div class='content'>
60
- <a class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</a>
60
+ <div class='comment' onclick='pjax.loadUrl("${item.url}")'>${item.content}</div>
61
61
  <time class="datetime" datetime="${item.date}"></time>
62
62
  </div>
63
63
  </div>
package/layout/page.pug CHANGED
@@ -20,6 +20,8 @@ block content
20
20
  include includes/page/equipment
21
21
  when 'music'
22
22
  include includes/page/music
23
+ when 'message'
24
+ !=partial('includes/page/message', {}, {cache: true})
23
25
  when 'banner'
24
26
  include includes/widgets/page/banner
25
27
  if page.container