hexo-theme-particlex 2.3.2 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -305,7 +305,7 @@ highlightStyle: github # Highlight style
305
305
  ```yaml
306
306
  twikoo:
307
307
  enable: false
308
- envId:
308
+ envID:
309
309
  region:
310
310
  path: location.pathname
311
311
  lang: zh-CN
package/_config.yml CHANGED
@@ -155,7 +155,7 @@ waline:
155
155
  # https://github.com/imaegoo/twikoo
156
156
  twikoo:
157
157
  enable: false
158
- envId:
158
+ envID:
159
159
  region:
160
160
  path: location.pathname
161
161
  lang: zh-CN
package/layout/menu.ejs CHANGED
@@ -1,7 +1,7 @@
1
1
  <nav id="menu">
2
2
  <div class="desktop-menu">
3
- <a href="<%- config.root %>">
4
- <span class="title"><%= config.title.toUpperCase() %></span>
3
+ <a class="title" href="<%- config.root %>">
4
+ <span><%= config.title.toUpperCase() %></span>
5
5
  </a>
6
6
  <% Object.keys(theme.menu).forEach(key => { %>
7
7
  <a href="<%- url_for(theme.menu[key].src) %>">
package/layout/post.ejs CHANGED
@@ -40,22 +40,20 @@
40
40
  <%
41
41
  const CryptoJS = crypto();
42
42
  function sha(str) {
43
- return CryptoJS.SHA256(str).toString(CryptoJS.enc.Base64);
43
+ return CryptoJS.SHA256(str).toString();
44
44
  }
45
45
  function encrypt(str, key) {
46
- return CryptoJS.AES.encrypt(str, sha(key), {
47
- mode: CryptoJS.mode.ECB,
48
- padding: CryptoJS.pad.Pkcs7,
49
- }).toString();
46
+ return CryptoJS.AES.encrypt(str, key).toString();
50
47
  }
51
48
  %>
52
- <input id="crypto" class="input" placeholder="文章被加密,请输入密码" data-encrypt="<%- encrypt(page.content, page.password.toString()) %>" data-check="<%- sha(page.content) %>">
49
+ <input id="crypto" class="input" placeholder="文章被加密,请输入密码" data-encrypt="<%- encrypt(page.content, page.password) %>" data-shasum="<%- sha(page.content) %>">
53
50
  <div class="content" v-pre style="opacity: 0"></div>
54
51
  <% } else { %>
55
52
  <div class="content" v-pre>
56
53
  <%- page.content %>
57
54
  </div>
58
55
  <% } %>
56
+ <% if (page.comments) { %>
59
57
  <% if (theme.gitalk.enable) { %>
60
58
  <div id="comment">
61
59
  <div id="gitalk-container"></div>
@@ -76,4 +74,5 @@
76
74
  <div id="twikoo-container"></div>
77
75
  </div>
78
76
  <% } %>
77
+ <% } %>
79
78
  </div>
package/layout/script.ejs CHANGED
@@ -1,6 +1,6 @@
1
1
  <script src="<%- url_for("/js/functions.js") %>"></script>
2
2
  <script src="<%- url_for("/js/particlex.js") %>"></script>
3
- <% if (type == "post") { %>
3
+ <% if (type == "post" && page.comments) { %>
4
4
  <% if (theme.gitalk.enable) { %>
5
5
  <script src="https://cdn.staticfile.org/gitalk/1.8.0/gitalk.min.js"></script>
6
6
  <link rel="stylesheet" href="https://cdn.staticfile.org/gitalk/1.8.0/gitalk.min.css">
@@ -57,9 +57,9 @@
57
57
  serverURL: "<%- theme.waline.serverURL %>",
58
58
  commentCount: <%- theme.waline.commentCount %>,
59
59
  pageview: <%- theme.waline.pageview %>,
60
- emoji: "<%- theme.waline.emoji %>".split(","),
61
- meta: "<%- theme.waline.meta %>".split(","),
62
- requiredMeta: "<%- theme.waline.requiredMeta %>".split(","),
60
+ emoji: <%- JSON.stringify(theme.waline.emoji) %>,
61
+ meta: <%- JSON.stringify(theme.waline.meta) %>,
62
+ requiredMeta: <%- JSON.stringify(theme.waline.requiredMeta) %>,
63
63
  lang: "<%- theme.waline.lang %>",
64
64
  wordLimit: <%- theme.waline.wordLimit %>,
65
65
  pageSize: "<%- theme.waline.pageSize %>",
@@ -73,7 +73,7 @@
73
73
  <script>
74
74
  twikoo.init({
75
75
  el: "#twikoo-container",
76
- envId: "<%- theme.twikoo.envId %>",
76
+ envId: "<%- theme.twikoo.envID %>",
77
77
  region: "<%- theme.twikoo.region %>",
78
78
  path: <%- theme.twikoo.path %>,
79
79
  lang: "<%- theme.twikoo.lang %>",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-particlex",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "description": "A concise Hexo theme, based on Particle.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -406,22 +406,14 @@
406
406
  #menu .desktop-menu .title {
407
407
  color: #555;
408
408
  display: inline-block;
409
- font-family: Lexend, "Noto Sans SC", sans-serif;
410
- margin-left: 30px;
409
+ margin-left: 60px;
410
+ margin-right: 5px;
411
411
  }
412
412
  #menu .desktop-menu a {
413
413
  color: #555;
414
414
  display: inline-block;
415
415
  margin-left: 30px;
416
416
  }
417
- #menu .desktop-menu a span img {
418
- height: 20px;
419
- top: 3px;
420
- width: 20px;
421
- }
422
- #menu .desktop-menu a span:nth-child(1) {
423
- margin-right: 5px;
424
- }
425
417
  #menu .phone-menu {
426
418
  min-height: 50px;
427
419
  text-align: center;
@@ -740,7 +732,7 @@ blockquote {
740
732
  }
741
733
  body {
742
734
  background: #f6f8fa;
743
- color: #000000d9;
735
+ color: #000c;
744
736
  font: 500 14px Lexend, "Noto Sans SC", sans-serif;
745
737
  overflow-x: hidden;
746
738
  width: 100%;
@@ -54,15 +54,12 @@ function rendermath() {
54
54
  });
55
55
  }
56
56
  function sha(str) {
57
- return CryptoJS.SHA256(str).toString(CryptoJS.enc.Base64);
57
+ return CryptoJS.SHA256(str).toString();
58
58
  }
59
- function decrypt(encrypt, key, check) {
59
+ function decrypt(str, key, shasum) {
60
60
  try {
61
- let res = CryptoJS.AES.decrypt(encrypt, sha(key), {
62
- mode: CryptoJS.mode.ECB,
63
- padding: CryptoJS.pad.Pkcs7,
64
- }).toString(CryptoJS.enc.Utf8);
65
- return { decrypt: res, check: sha(res) == check };
61
+ let res = CryptoJS.AES.decrypt(str, key).toString(CryptoJS.enc.Utf8);
62
+ return { decrypt: res, check: sha(res) === shasum };
66
63
  } catch {
67
64
  return { check: false };
68
65
  }
@@ -45,14 +45,17 @@ const app = Vue.createApp({
45
45
  });
46
46
  }
47
47
  window.addEventListener("scroll", this.handlescroll, true);
48
- highlight();
49
- showimg();
50
- rendermath();
48
+ this.render();
51
49
  },
52
50
  methods: {
53
51
  homeclick() {
54
52
  window.scrollTo({ top: window.innerHeight, behavior: "smooth" });
55
53
  },
54
+ render() {
55
+ highlight();
56
+ showimg();
57
+ rendermath();
58
+ },
56
59
  handlescroll() {
57
60
  let newlocal = document.documentElement.scrollTop;
58
61
  let menu = document.getElementById("menu");
@@ -71,16 +74,14 @@ const app = Vue.createApp({
71
74
  handlecrypto() {
72
75
  let input = document.getElementById("crypto"),
73
76
  content = document.getElementsByClassName("content")[0];
74
- let res = decrypt(input.dataset.encrypt, input.value, input.dataset.check);
77
+ let res = decrypt(input.dataset.encrypt, input.value, input.dataset.shasum);
75
78
  if (res.check) {
76
79
  input.disabled = true;
77
80
  input.classList.remove("fail");
78
81
  input.classList.add("success");
79
82
  content.innerHTML = res.decrypt;
80
83
  content.style.opacity = 1;
81
- highlight();
82
- showimg();
83
- rendermath();
84
+ this.render();
84
85
  } else input.classList.add("fail");
85
86
  },
86
87
  handlesearch() {