hexo-theme-particlex 2.1.2 → 2.1.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.
package/layout/index.ejs CHANGED
@@ -19,13 +19,13 @@
19
19
  <div id="home-posts-wrap" class="<%- theme.card.enable ? "" : "home-posts-wrap-no-card" %>">
20
20
  <div id="home-posts">
21
21
  <div id="posts">
22
- <%- include("posts") %>
23
- <%- include("current") %>
22
+ <%- partial("posts") %>
23
+ <%- partial("current") %>
24
24
  </div>
25
25
  </div>
26
26
  <% if (theme.card.enable) { %>
27
27
  <div id="home-card">
28
- <%- include("card") %>
28
+ <%- partial("card") %>
29
29
  </div>
30
30
  <% } %>
31
31
  </div>
package/layout/layout.ejs CHANGED
@@ -1,15 +1,15 @@
1
1
  <%
2
- let layout = "post";
2
+ let type = "post";
3
3
  if (is_home())
4
- layout = "index";
4
+ type = "index";
5
5
  else if (is_post())
6
- layout = "post";
6
+ type = "post";
7
7
  else if (is_category() || page.type == "categories")
8
- layout = "categories";
8
+ type = "categories";
9
9
  else if (is_tag() || page.type == "tags")
10
- layout = "tags";
10
+ type = "tags";
11
11
  else if (is_archive() || is_year() || is_month())
12
- layout = "archives";
12
+ type = "archives";
13
13
  let title = "";
14
14
  if (page.title)
15
15
  title = page.title + " | ";
@@ -48,20 +48,23 @@
48
48
  <script src="https://cdn.staticfile.org/KaTeX/0.16.4/contrib/auto-render.min.js"></script>
49
49
  <link rel="stylesheet" href="https://cdn.staticfile.org/KaTeX/0.16.4/katex.min.css">
50
50
  <% } %>
51
+ <% if (theme.crypto.enable && typeof page.password !== "undefined") { %>
52
+ <script src="https://cdn.staticfile.org/crypto-js/4.1.1/crypto-js.min.js"></script>
53
+ <% } %>
51
54
  <link rel="stylesheet" href="<%- url_for("/css/fonts.min.css") %>">
52
55
  <link rel="stylesheet" href="<%- url_for("/css/particlex.css") %>">
53
56
  </head>
54
57
  <body>
55
- <%- include("loading") %>
58
+ <%- partial("loading") %>
56
59
  <div id="layout">
57
60
  <transition name="into">
58
61
  <div v-show="showpage" style="display: -not-none">
59
62
  <div id="menushow">
60
- <%- include("menu") %>
63
+ <%- partial("menu") %>
61
64
  </div>
62
65
  <div id="main">
63
- <%- include(layout) %>
64
- <%- include("footer") %>
66
+ <%- partial(type) %>
67
+ <%- partial("footer") %>
65
68
  </div>
66
69
  </div>
67
70
  </transition>
@@ -69,6 +72,6 @@
69
72
  <img id="showimg-content" alt="showimg">
70
73
  </div>
71
74
  </div>
72
- <%- include("script") %>
75
+ <%- partial("script", { type }) %>
73
76
  </body>
74
77
  </html>
package/layout/post.ejs CHANGED
@@ -38,7 +38,7 @@
38
38
  </span>
39
39
  <% } %>
40
40
  </div>
41
- <% if (typeof page.password !== "undefined" && theme.crypto.enable) { %>
41
+ <% if (theme.crypto.enable && typeof page.password !== "undefined") { %>
42
42
  <%
43
43
  const CryptoJS = crypto();
44
44
  function sha(str) {
@@ -51,7 +51,6 @@
51
51
  }).toString();
52
52
  }
53
53
  %>
54
- <script src="https://cdn.staticfile.org/crypto-js/4.1.1/crypto-js.min.js"></script>
55
54
  <input id="crypto" class="ipt" placeholder="文章被加密,请输入密码" data-encrypt="<%- encrypt(page.content, page.password.toString()) %>" data-check="<%- sha(page.content) %>">
56
55
  <div class="content" style="opacity: 0" v-pre></div>
57
56
  <% } else { %>
@@ -60,7 +59,6 @@
60
59
  </div>
61
60
  <% } %>
62
61
  <% if (theme.gitalk.enable) { %>
63
- <link rel="stylesheet" href="https://cdn.staticfile.org/gitalk/1.7.2/gitalk.min.css">
64
62
  <div id="comment">
65
63
  <div id="gitalk-container"></div>
66
64
  </div>
@@ -71,7 +69,6 @@
71
69
  </div>
72
70
  <% } %>
73
71
  <% if (theme.waline.enable) { %>
74
- <link rel="stylesheet" href="https://cdn.staticfile.org/waline/2.9.1/waline.min.css" />
75
72
  <div id="comment">
76
73
  <div id="waline-container"></div>
77
74
  </div>
package/layout/script.ejs CHANGED
@@ -1,10 +1,12 @@
1
1
  <script src="<%- url_for("/js/functions.js") %>"></script>
2
2
  <script src="<%- url_for("/js/particlex.js") %>"></script>
3
- <% if (is_post()) { %>
3
+ <% if (type == "post") { %>
4
4
  <% if (theme.gitalk.enable) { %>
5
5
  <script src="https://cdn.staticfile.org/gitalk/1.7.2/gitalk.min.js"></script>
6
+ <link rel="stylesheet" href="https://cdn.staticfile.org/gitalk/1.7.2/gitalk.min.css">
6
7
  <script>
7
- let clientID = "<%- theme.gitalk.clientID %>", clientSecret = "<%- theme.gitalk.clientSecret %>";
8
+ let clientID = "<%- theme.gitalk.clientID %>",
9
+ clientSecret = "<%- theme.gitalk.clientSecret %>";
8
10
  <% Object.keys(theme.gitalk.sites).forEach(key => { %>
9
11
  if (window.location.host == "<%- key %>") {
10
12
  clientID = "<%- theme.gitalk.sites[key].clientID %>";
@@ -21,10 +23,10 @@
21
23
  id: location.pathname,
22
24
  distractionFreeMode: false,
23
25
  <% if (theme.gitalk.proxy) { %>
24
- proxy: "<%- theme.gitalk.proxy %>"
26
+ proxy: "<%- theme.gitalk.proxy %>",
25
27
  <% } %>
26
28
  })
27
- gitalk.render("gitalk-container")
29
+ gitalk.render("gitalk-container");
28
30
  </script>
29
31
  <% } %>
30
32
  <% if (theme.giscus.enable) { %>
@@ -47,6 +49,7 @@
47
49
  <% } %>
48
50
  <% if (theme.waline.enable) { %>
49
51
  <script src="https://cdn.staticfile.org/waline/2.9.1/waline.min.js"></script>
52
+ <link rel="stylesheet" href="https://cdn.staticfile.org/waline/2.9.1/waline.min.css">
50
53
  <script>
51
54
  Waline.init({
52
55
  el: "#waline-container",
@@ -60,7 +63,7 @@
60
63
  wordLimit: <%- theme.waline.wordLimit %>,
61
64
  pageSize: "<%- theme.waline.pageSize %>",
62
65
  login: "<%- theme.waline.login %>",
63
- locale: <%- JSON.stringify(theme.waline.locale) %>
66
+ locale: <%- JSON.stringify(theme.waline.locale) %>,
64
67
  });
65
68
  </script>
66
69
  <% } %>
@@ -72,7 +75,7 @@
72
75
  envId: "<%- theme.twikoo.envId %>",
73
76
  region: "<%- theme.twikoo.region %>",
74
77
  path: <%- theme.twikoo.path %>,
75
- lang: "<%- theme.twikoo.lang %>"
78
+ lang: "<%- theme.twikoo.lang %>",
76
79
  })
77
80
  </script>
78
81
  <% } %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-particlex",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "A concise Hexo theme, based on Particle.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -40,7 +40,6 @@ function showimg() {
40
40
  });
41
41
  wrap.addEventListener("click", hide);
42
42
  window.addEventListener("resize", hide);
43
- window.addEventListener("scroll", hide);
44
43
  }
45
44
  function rendermath() {
46
45
  if (typeof renderMathInElement !== "undefined")
@@ -8,10 +8,14 @@ const app = Vue.createApp({
8
8
  composition: false,
9
9
  };
10
10
  },
11
+ created() {
12
+ window.addEventListener("load", () => {
13
+ this.showpage = true;
14
+ document.getElementById("loading").style.opacity = 0;
15
+ document.getElementById("loading").style.visibility = "hidden";
16
+ });
17
+ },
11
18
  mounted() {
12
- this.showpage = true;
13
- document.getElementById("loading").style.opacity = 0;
14
- document.getElementById("loading").style.visibility = "hidden";
15
19
  if (document.getElementById("home-head"))
16
20
  document.getElementById("menu").className += " menu-color";
17
21
  if (document.getElementById("crypto")) {