hexo-theme-particlex 2.6.10 → 2.7.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.
package/README.md CHANGED
@@ -79,6 +79,17 @@ 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. 内容配置
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.0",
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
  };