hexo-theme-particlex 2.6.10 → 2.7.1

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.
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # Hexo-Theme-ParticleX
2
2
 
3
- [ParticleX](https://github.com/theme-particlex/hexo-theme-particlex) 主题,诞生原因是因为原来的 [Particle](https://github.com/korilin/hexo-theme-particle) 主题不维护了,但是我觉得还是很好的
3
+ [ParticleX](https://github.com/theme-particlex/hexo-theme-particlex) 主题,诞生原因是因为原来的 [Particle](https://github.com/korilin/hexo-theme-particle) 主题不维护了,但是我觉得还是很好的。
4
4
 
5
- 原来用的是 Vue 2 + Ant Design Vue 1,现更新到 Vue 3,去除 Ant Design Vue 采用自定义样式,图标更改为 Font Awesome 6,CDN 改为 Staticfile
5
+ 原来用的是 Vue 2 + Ant Design Vue 1,现更新到 Vue 3,去除 Ant Design Vue 采用自定义样式,图标更改为 Font Awesome 6,CDN 改为 Staticfile
6
6
 
7
7
  原项目 `README.md` 里说:
8
8
 
9
- > 目前有 Full、Night 和 Maiden **两个**主题样式
9
+ > 目前有 Full、Night 和 Maiden **两个**主题样式。
10
10
 
11
- 但是更改后只有一种了,如果你想改颜色就在 `main.css` 里替换吧
11
+ 但是更改后只有一种了,如果你想改颜色就在 `main.css` 里替换吧。
12
12
 
13
13
  # 1. 演示
14
14
 
@@ -23,7 +23,7 @@ cd themes
23
23
  git clone https://github.com/theme-particlex/hexo-theme-particlex.git particlex --depth=1
24
24
  ```
25
25
 
26
- 然后在根目录 `_config.yml` 设置主题为 ParticleX 即可
26
+ 然后在根目录 `_config.yml` 设置主题为 ParticleX 即可。
27
27
 
28
28
  ```yaml
29
29
  theme: particlex
@@ -31,7 +31,7 @@ theme: particlex
31
31
 
32
32
  ## 2.1. 关闭自带代码高亮
33
33
 
34
- Hexo 有自带的代码高亮,但是和 ParticleX 的不兼容
34
+ Hexo 有自带的代码高亮,但是和 ParticleX 的不兼容。
35
35
 
36
36
  ```yaml
37
37
  highlight:
@@ -40,7 +40,7 @@ prismjs:
40
40
  enable: false
41
41
  ```
42
42
 
43
- 如果使用 Pandoc 还需要设置一下
43
+ 如果使用 Pandoc 还需要设置一下:
44
44
 
45
45
  ```yaml
46
46
  pandoc:
@@ -50,7 +50,7 @@ pandoc:
50
50
 
51
51
  ## 2.2. 禁用年度月度归档
52
52
 
53
- Hexo 会自动生成年度月度归档,可是 ParticleX 主题没有这个功能 ~~我太懒了~~
53
+ Hexo 会自动生成年度月度归档,可是 ParticleX 主题没有这个功能。~~我太懒了~~
54
54
 
55
55
  ```yaml
56
56
  archive_generator:
@@ -61,13 +61,13 @@ archive_generator:
61
61
  daily: false
62
62
  ```
63
63
 
64
- 修改完请 `hexo cl` 清除缓存
64
+ 修改完请 `hexo cl` 清除缓存。
65
65
 
66
66
  # 3. 配置
67
67
 
68
68
  ## 3.1. 基本配置
69
69
 
70
- `background` 参数是一个列表,打开时会随机加载一个背景
70
+ `background` 参数是一个列表,打开时会随机加载一个背景。
71
71
 
72
72
  ```yaml
73
73
  # Avatar image
@@ -79,13 +79,24 @@ favicon: /images/favicon.png
79
79
  # Home page background image
80
80
  background:
81
81
  - /images/background.jpg
82
+
83
+ # Loading image
84
+ loading: /images/loading.gif
85
+
86
+ # Optional colors for category and tag
87
+ colors:
88
+ - "#ffa2c4"
89
+ - "#00bcd4"
90
+ - "#03a9f4"
91
+ - "#00a596"
92
+ - "#ff7d73"
82
93
  ```
83
94
 
84
95
  ## 3.2. 内容配置
85
96
 
86
97
  ### 3.2.1. 导航栏
87
98
 
88
- 为了方便,主题使用的图标是 Font Awesome 6 图标
99
+ 为了方便,主题使用的图标是 Font Awesome 6 图标。
89
100
 
90
101
  ```yaml
91
102
  # ParticleX theme icon is adopts the Font Awesome 6
@@ -117,9 +128,9 @@ menu:
117
128
 
118
129
  ### 3.2.2. 主页信息卡片
119
130
 
120
- `description` 支持 Markdown 格式
131
+ `description` 支持 Markdown 格式。
121
132
 
122
- 图标链接配置和导航栏配置相同
133
+ 图标链接 `iconLinks` 配置和导航栏配置相同。
123
134
 
124
135
  ```yaml
125
136
  # Side info card
@@ -135,9 +146,9 @@ card:
135
146
 
136
147
  ### 3.2.3. 页脚
137
148
 
138
- 考虑到博客部署在服务器并使用自己域名的情况,按规定需要在网站下边添加备案消息
149
+ 考虑到博客部署在服务器并使用自己域名的情况,按规定需要在网站下边添加备案消息。
139
150
 
140
- 如没有需要显示备案消息的可以关闭
151
+ 如没有需要显示备案消息的可以关闭。
141
152
 
142
153
  ```yaml
143
154
  # Footer info
@@ -154,9 +165,9 @@ footer:
154
165
 
155
166
  ### 3.3.1. Polyfill
156
167
 
157
- 使用 [Polyfill.io](https://polyfill.io) 自动根据 UA 处理新的 JS API 兼容
168
+ 使用 [Polyfill.io](https://polyfill.io) 自动根据 UA 处理新的 JS API 兼容。
158
169
 
159
- 可以配合 [Hexo-Babel](https://github.com/theme-particlex/hexo-babel) 插件处理 JS 语法兼容
170
+ 可以配合 [Hexo-Babel](https://github.com/theme-particlex/hexo-babel) 插件处理 JS 语法兼容。
160
171
 
161
172
  ```yaml
162
173
  # Polyfill
@@ -169,9 +180,9 @@ polyfill:
169
180
 
170
181
  ### 3.3.2. 代码高亮
171
182
 
172
- 使用 Highlight.js 代码高亮
183
+ 使用 Highlight.js 代码高亮。
173
184
 
174
- 样式可以在[这里](https://highlightjs.org/static/demo)选择,默认为 GitHub
185
+ 样式可以在[这里](https://highlightjs.org/static/demo)选择,默认为 GitHub
175
186
 
176
187
  ```yaml
177
188
  # Highlight.js
@@ -183,7 +194,7 @@ highlight:
183
194
 
184
195
  ### 3.3.3. 数学渲染
185
196
 
186
- 使用 KaTeX 渲染数学公式
197
+ 使用 KaTeX 渲染数学公式。
187
198
 
188
199
  ```yaml
189
200
  # KaTeX math rendering
@@ -193,7 +204,7 @@ math:
193
204
 
194
205
  ### 3.3.4. 图片预览
195
206
 
196
- 简单的点击图片放大缩小的预览
207
+ 简单的点击图片放大缩小的预览。
197
208
 
198
209
  ```yaml
199
210
  # Image preview
@@ -203,11 +214,11 @@ preview:
203
214
 
204
215
  ### 3.3.5. 文章缩略
205
216
 
206
- 一般来说,缩略展示文档只需要在文档中添加 `<!-- more -->` 即可,缩略内容在显示全文中也会出现
217
+ 一般来说,缩略展示文档只需要在文档中添加 `<!-- more -->` 即可,缩略内容在显示全文中也会出现。
207
218
 
208
- 但考虑到不想把缩略内容放在正文里,就添加了此参数,在 [Front-Matter](https://hexo.io/docs/front-matter) 里设置
219
+ 但考虑到不想把缩略内容放在正文里,就添加了此参数,在 [Front-Matter](https://hexo.io/docs/front-matter) 里设置。
209
220
 
210
- 支持 Markdown 格式
221
+ 支持 Markdown 格式。
211
222
 
212
223
  ```yaml
213
224
  description: |
@@ -216,11 +227,11 @@ description: |
216
227
 
217
228
  ### 3.3.6. 文章置顶
218
229
 
219
- 在 [Front-Matter](https://hexo.io/docs/front-matter) 里设置 `pinned` 作为置顶参数,越大越靠前,默认为 0
230
+ 在 [Front-Matter](https://hexo.io/docs/front-matter) 里设置 `pinned` 作为置顶参数,越大越靠前,默认为 0
220
231
 
221
232
  ### 3.3.7. 文章加密
222
233
 
223
- 使用 AES 加密算法,在 [Front-Matter](https://hexo.io/docs/front-matter) 里设置 `secret` 作为密码,**使用请安装插件 [Hexo-Helper-Crypto](https://github.com/theme-particlex/hexo-helper-crypto)**
234
+ 使用 AES 加密算法,在 [Front-Matter](https://hexo.io/docs/front-matter) 里设置 `secret` 作为密码,**使用请安装插件 [Hexo-Helper-Crypto](https://github.com/theme-particlex/hexo-helper-crypto)**。
224
235
 
225
236
  ```yaml
226
237
  # Article encryption
@@ -230,9 +241,9 @@ crypto:
230
241
 
231
242
  ### 3.3.8. 搜索
232
243
 
233
- 嵌入到 Archives 中的搜索
244
+ 嵌入到 Archives 中的搜索。
234
245
 
235
- 目前只支持搜索文档标题
246
+ 目前只支持搜索文档标题。
236
247
 
237
248
  ```yaml
238
249
  # Search
@@ -244,9 +255,9 @@ search:
244
255
 
245
256
  ### 3.4.1. Giscus
246
257
 
247
- Giscus 是一个由 GitHub Discussions 支持的评论系统
258
+ Giscus 是一个由 GitHub Discussions 支持的评论系统。
248
259
 
249
- 在 [Giscus.app](https://giscus.app) 设置好各项后,会在下面生成一个 `<script>` 标签,在主题内填入即可
260
+ 在 [Giscus.app](https://giscus.app) 设置好各项后,会在下面生成一个 `<script>` 标签,在主题内填入即可。
250
261
 
251
262
  ```yaml
252
263
  # Giscus
@@ -269,9 +280,9 @@ giscus:
269
280
 
270
281
  ### 3.4.2. Gitalk
271
282
 
272
- Gitalk 是一个基于 GitHub Issue 和 Preact 的评论系统
283
+ Gitalk 是一个基于 GitHub Issue 和 Preact 的评论系统。
273
284
 
274
- 由于 Gitalk 官方 CORS 代理用的是 Cloudflare,速度过慢,搭建 CORS 代理可以看[这篇文章](https://argvchs.github.io/2022/07/04/build-cors-anywhere)
285
+ 由于 Gitalk 官方 CORS 代理用的是 Cloudflare,速度过慢,搭建 CORS 代理可以看[这篇文章](https://argvchs.github.io/2022/07/04/build-cors-anywhere)
275
286
 
276
287
  ```yaml
277
288
  # Gitalk
@@ -289,7 +300,7 @@ gitalk:
289
300
 
290
301
  ### 3.4.3. Waline
291
302
 
292
- Waline 是一个简单、安全的评论系统
303
+ Waline 是一个简单、安全的评论系统。
293
304
 
294
305
  详见:[在 ParticleX 上使用 Waline | Yuzi's Blog](https://blog.yuzi.dev/posts/bcb4ff00.html)
295
306
 
@@ -323,7 +334,7 @@ waline:
323
334
 
324
335
  ### 3.4.4. Twikoo
325
336
 
326
- Twikoo 是一个一个简洁、安全、免费的静态网站评论系统
337
+ Twikoo 是一个一个简洁、安全、免费的静态网站评论系统。
327
338
 
328
339
  ```yaml
329
340
  # Twikoo
package/_config.yml CHANGED
@@ -11,6 +11,17 @@ favicon: /images/favicon.png
11
11
  background:
12
12
  - /images/background.jpg
13
13
 
14
+ # Loading image
15
+ loading: /images/loading.gif
16
+
17
+ # Optional colors for category and tag
18
+ colors:
19
+ - "#ffa2c4"
20
+ - "#00bcd4"
21
+ - "#03a9f4"
22
+ - "#00a596"
23
+ - "#ff7d73"
24
+
14
25
  # ParticleX theme icon is adopts the Font Awesome 6
15
26
  # https://fontawesome.com
16
27
 
@@ -31,19 +31,15 @@
31
31
  <span class="icon">
32
32
  <i class="fa-solid fa-tags fa-fw"></i>
33
33
  </span>
34
+ <% let prev; %>
34
35
  <% post.tags.data.forEach(tag => { %>
35
36
  <span class="tag">
36
37
  <%
37
- const color = [
38
- "color: #ffa2c4",
39
- "color: #00bcd4",
40
- "color: #03a9f4",
41
- "color: #00a596",
42
- "color: #ff7d73",
43
- ];
44
- let id = Math.floor(Math.random() * color.length);
38
+ const colors = theme.colors.filter(color => color !== prev);
39
+ let id = Math.floor(Math.random() * colors.length);
40
+ prev = colors[id];
45
41
  %>
46
- <a href="<%- url_for(tag.path) %>" style="<%- color[id] %>"><%= tag.name %></a>
42
+ <a href="<%- url_for(tag.path) %>" style="color: <%- colors[id] %>"><%= tag.name %></a>
47
43
  </span>
48
44
  <% }); %>
49
45
  </span>
@@ -1,15 +1,17 @@
1
1
  <div id="archives">
2
2
  <% let posts = []; %>
3
3
  <div class="categories-tags">
4
+ <% let prev; %>
4
5
  <% site.categories.data.forEach(category => { %>
5
6
  <%
6
- const color = is_category(category.name)
7
+ const colors = is_category(category.name)
7
8
  ? ["linear-gradient(120deg, #9abbf7 0%, #ffbbf4 100%)"]
8
- : ["#ffa2c4", "#00bcd4", "#03a9f4", "#00a596", "#ff7d73"];
9
- let id = Math.floor(Math.random() * color.length);
9
+ : theme.colors.filter(color => color !== prev);
10
+ let id = Math.floor(Math.random() * colors.length);
11
+ prev = colors[id];
10
12
  %>
11
13
  <span>
12
- <a href="<%- url_for(category.path) %>" style="background: <%- color[id] %>">
14
+ <a href="<%- url_for(category.path) %>" style="background: <%- colors[id] %>">
13
15
  <span class="icon">
14
16
  <i class="fa-solid fa-bookmark fa-fw"></i>
15
17
  </span>
@@ -48,19 +50,15 @@
48
50
  <span class="icon">
49
51
  <i class="fa-solid fa-tags fa-fw"></i>
50
52
  </span>
53
+ <% let prev; %>
51
54
  <% post.tags.data.forEach(tag => { %>
52
55
  <span class="tag">
53
56
  <%
54
- const color = [
55
- "color: #ffa2c4",
56
- "color: #00bcd4",
57
- "color: #03a9f4",
58
- "color: #00a596",
59
- "color: #ff7d73",
60
- ];
61
- let id = Math.floor(Math.random() * color.length);
57
+ const colors = theme.colors.filter(color => color !== prev);
58
+ let id = Math.floor(Math.random() * colors.length);
59
+ prev = colors[id];
62
60
  %>
63
- <a href="<%- url_for(tag.path) %>" style="<%- color[id] %>"><%= tag.name %></a>
61
+ <a href="<%- url_for(tag.path) %>" style="color: <%- colors[id] %>"><%= tag.name %></a>
64
62
  </span>
65
63
  <% }); %>
66
64
  </span>
package/layout/layout.ejs CHANGED
@@ -31,7 +31,7 @@
31
31
  <div id="loading-circle">
32
32
  <h2>LOADING</h2>
33
33
  <p>加载过慢请开启缓存 浏览器默认开启</p>
34
- <img src="<%- url_for("/images/loading.gif") %>" />
34
+ <img src="<%- url_for(theme.loading) %>" />
35
35
  </div>
36
36
  </div>
37
37
  </transition>
package/layout/post.ejs CHANGED
@@ -24,19 +24,15 @@
24
24
  <span class="icon">
25
25
  <i class="fa-solid fa-tags fa-fw"></i>
26
26
  </span>
27
+ <% let prev; %>
27
28
  <% page.tags.data.forEach(tag => { %>
28
29
  <span class="tag">
29
30
  <%
30
- const color = [
31
- "color: #ffa2c4",
32
- "color: #00bcd4",
33
- "color: #03a9f4",
34
- "color: #00a596",
35
- "color: #ff7d73",
36
- ];
37
- let id = Math.floor(Math.random() * color.length);
31
+ const colors = theme.colors.filter(color => color !== prev);
32
+ let id = Math.floor(Math.random() * colors.length);
33
+ prev = colors[id];
38
34
  %>
39
- <a href="<%- url_for(tag.path) %>" style="<%- color[id] %>"><%= tag.name %></a>
35
+ <a href="<%- url_for(tag.path) %>" style="color: <%- colors[id] %>"><%= tag.name %></a>
40
36
  </span>
41
37
  <% }); %>
42
38
  </span>
@@ -46,8 +42,8 @@
46
42
  <% const CryptoJS = crypto(); %>
47
43
  <input
48
44
  id="crypto"
49
- :class="['input', cryptoClass]"
50
- :disabled="cryptoStatus"
45
+ :class="['input', cryptoStatus]"
46
+ :disabled="cryptoStatus == 'success'"
51
47
  ref="crypto"
52
48
  placeholder="文章被加密,请输入密码"
53
49
  data-encrypted="<%- CryptoJS.AES.encrypt(page.content, page.secret).toString() %>"
@@ -55,7 +51,7 @@
55
51
  v-model="crypto"
56
52
  />
57
53
  <transition name="fade">
58
- <div class="content" ref="content" v-show="cryptoStatus"></div>
54
+ <div class="content" ref="content" v-show="cryptoStatus == 'success'"></div>
59
55
  </transition>
60
56
  <% } else { %>
61
57
  <div class="content" v-pre>
package/layout/posts.ejs CHANGED
@@ -58,19 +58,15 @@
58
58
  <i class="fa-solid fa-tags fa-fw"></i>
59
59
  </span>
60
60
  <% } %>
61
+ <% let prev; %>
61
62
  <% post.tags.data.forEach(tag => { %>
62
63
  <span class="tag">
63
64
  <%
64
- const color = [
65
- "color: #ffa2c4",
66
- "color: #00bcd4",
67
- "color: #03a9f4",
68
- "color: #00a596",
69
- "color: #ff7d73",
70
- ];
71
- let id = Math.floor(Math.random() * color.length);
65
+ const colors = theme.colors.filter(color => color !== prev);
66
+ let id = Math.floor(Math.random() * colors.length);
67
+ prev = colors[id];
72
68
  %>
73
- <a href="<%- url_for(tag.path) %>" style="<%- color[id] %>"><%= tag.name %></a>
69
+ <a href="<%- url_for(tag.path) %>" style="color: <%- colors[id] %>"><%= tag.name %></a>
74
70
  </span>
75
71
  <% }); %>
76
72
  </div>
package/layout/tags.ejs CHANGED
@@ -1,15 +1,17 @@
1
1
  <div id="archives">
2
2
  <% let posts = []; %>
3
3
  <div class="categories-tags">
4
+ <% let prev; %>
4
5
  <% site.tags.data.forEach(tag => { %>
5
6
  <%
6
- const color = is_tag(tag.name)
7
+ const colors = is_tag(tag.name)
7
8
  ? ["linear-gradient(120deg, #9abbf7 0%, #ffbbf4 100%)"]
8
- : ["#ffa2c4", "#00bcd4", "#03a9f4", "#00a596", "#ff7d73"];
9
- let id = Math.floor(Math.random() * color.length);
9
+ : theme.colors.filter(color => color !== prev);
10
+ let id = Math.floor(Math.random() * colors.length);
11
+ prev = colors[id];
10
12
  %>
11
13
  <span>
12
- <a href="<%- url_for(tag.path) %>" style="background: <%- color[id] %>">
14
+ <a href="<%- url_for(tag.path) %>" style="background: <%- colors[id] %>">
13
15
  <span class="icon">
14
16
  <i class="fa-solid fa-tags fa-fw"></i>
15
17
  </span>
@@ -33,7 +35,7 @@
33
35
  <h3><%= post.title %></h3>
34
36
  </a>
35
37
  <div class="info">
36
- <% if (post.categories && post.categories.data.length){ %>
38
+ <% if (post.categories && post.categories.data.length !== 0) { %>
37
39
  <span class="category">
38
40
  <a href="<%- url_for(post.categories.data[0].path) %>">
39
41
  <span class="icon">
@@ -48,19 +50,15 @@
48
50
  <span class="icon">
49
51
  <i class="fa-solid fa-tags fa-fw"></i>
50
52
  </span>
53
+ <% let prev; %>
51
54
  <% post.tags.data.forEach(tag => { %>
52
55
  <span class="tag">
53
56
  <%
54
- const color = [
55
- "color: #ffa2c4",
56
- "color: #00bcd4",
57
- "color: #03a9f4",
58
- "color: #00a596",
59
- "color: #ff7d73",
60
- ];
61
- let id = Math.floor(Math.random() * color.length);
57
+ const colors = theme.colors.filter(color => color !== prev);
58
+ let id = Math.floor(Math.random() * colors.length);
59
+ prev = colors[id];
62
60
  %>
63
- <a href="<%- url_for(tag.path) %>" style="<%- color[id] %>"><%= tag.name %></a>
61
+ <a href="<%- url_for(tag.path) %>" style="color: <%- colors[id] %>"><%= tag.name %></a>
64
62
  </span>
65
63
  <% }); %>
66
64
  </span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-particlex",
3
- "version": "2.6.10",
3
+ "version": "2.7.1",
4
4
  "description": "A concise Hexo theme, based on Particle.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,11 +45,11 @@
45
45
  #crypto {
46
46
  margin: 50px 0;
47
47
  }
48
- #crypto.fail {
48
+ #crypto.failure {
49
49
  border-color: #ea4a5a;
50
50
  color: #ea4a5a;
51
51
  }
52
- #crypto.fail:focus {
52
+ #crypto.failure:focus {
53
53
  box-shadow: 0 0 0 3px #ea4a5a4d;
54
54
  }
55
55
  #crypto.success {
@@ -1,6 +1,6 @@
1
1
  mixins.crypto = {
2
2
  data() {
3
- return { crypto: "", cryptoStatus: null };
3
+ return { crypto: "", cryptoStatus: "" };
4
4
  },
5
5
  watch: {
6
6
  crypto(value) {
@@ -10,20 +10,13 @@ mixins.crypto = {
10
10
  try {
11
11
  let decrypted = CryptoJS.AES.decrypt(encrypted, value).toString(CryptoJS.enc.Utf8);
12
12
  if (CryptoJS.SHA256(decrypted).toString() === shasum) {
13
- this.cryptoStatus = true;
13
+ this.cryptoStatus = "success";
14
14
  content.innerHTML = decrypted;
15
15
  this.render();
16
- } else this.cryptoStatus = false;
16
+ } else this.cryptoStatus = "failure";
17
17
  } catch {
18
- this.cryptoStatus = false;
18
+ this.cryptoStatus = "failure";
19
19
  }
20
20
  },
21
21
  },
22
- computed: {
23
- cryptoClass() {
24
- if (this.cryptoStatus === null) return "";
25
- if (this.cryptoStatus === true) return "success";
26
- if (this.cryptoStatus === false) return "fail";
27
- },
28
- },
29
22
  };