hexo-theme-particlex 2.2.0 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -150,7 +150,7 @@ highlightStyle: github # Highlight style
150
150
 
151
151
  - 页脚
152
152
 
153
- 考虑到博客部署在服务器并使用自己域名的情况,按国家规定需要在网站下边添加备案消息
153
+ 考虑到博客部署在服务器并使用自己域名的情况,按规定需要在网站下边添加备案消息
154
154
 
155
155
  如没有需要显示备案消息的可以关闭
156
156
 
@@ -1,10 +1,14 @@
1
+ <%
2
+ let posts = site.posts;
3
+ posts.data.sort((a, b) => b.date - a.date);
4
+ %>
1
5
  <div id="archives">
2
6
  <% if (theme.search.enable) { %>
3
- <div id="search-mask" style="z-index: <%= site.posts.length + 1 %>"></div>
4
- <input id="search-bar" class="ipt" placeholder="搜索" style="z-index: <%= site.posts.length + 2 %>">
7
+ <div id="search-mask" style="z-index: <%= posts.length + 1 %>"></div>
8
+ <input id="search-bar" class="ipt" placeholder="搜索" style="z-index: <%= posts.length + 2 %>">
5
9
  <% } %>
6
- <% site.posts.forEach((post, id) => { %>
7
- <div class="timeline" style="z-index: <%= site.posts.length - id %>" data-title="<%- post.title.toLowerCase().replace(/\s+/gm, "") %>">
10
+ <% posts.forEach((post, id) => { %>
11
+ <div class="timeline" style="z-index: <%= posts.length - id %>" data-title="<%- post.title.toLowerCase().replace(/\s+/gm, "") %>">
8
12
  <div class="timeline-tail"></div>
9
13
  <div class="timeline-content">
10
14
  <div class="item-time"><%- date(post.date, "YYYY/M/D") %></div>
@@ -19,11 +19,7 @@
19
19
  <% if (is_category(category.name)) { %>
20
20
  <%
21
21
  posts = category.posts;
22
- posts.data.sort((a, b) => {
23
- if (typeof a.top === "undefined") a.top = 0;
24
- if (typeof b.top === "undefined") b.top = 0;
25
- return a.top == b.top ? b.date - a.date : b.top - a.top
26
- });
22
+ posts.data.sort((a, b) => b.date - a.date);
27
23
  %>
28
24
  <% } %>
29
25
  <% }); %>
package/layout/layout.ejs CHANGED
@@ -20,11 +20,6 @@
20
20
  else if (is_archive() || is_year() || is_month())
21
21
  title = "Archives | ";
22
22
  title += config.title;
23
- site.posts.data.sort((a, b) => {
24
- if (typeof a.top === "undefined") a.top = 0;
25
- if (typeof b.top === "undefined") b.top = 0;
26
- return a.top == b.top ? b.date - a.date : b.top - a.top;
27
- });
28
23
  %>
29
24
  <!DOCTYPE html>
30
25
  <html lang="<%- config.language %>">
@@ -58,15 +53,15 @@
58
53
  <%- partial("loading") %>
59
54
  <div id="layout">
60
55
  <transition name="into">
61
- <div v-show="showpage" style="display: -not-none">
62
- <div id="menushow">
63
- <%- partial("menu") %>
64
- </div>
65
- <div id="main">
66
- <%- partial(type) %>
67
- <%- partial("footer") %>
68
- </div>
56
+ <div v-show="showpage" style="display: -not-none">
57
+ <div id="menushow">
58
+ <%- partial("menu") %>
69
59
  </div>
60
+ <div id="main">
61
+ <%- partial(type) %>
62
+ <%- partial("footer") %>
63
+ </div>
64
+ </div>
70
65
  </transition>
71
66
  <div id="showimg">
72
67
  <img id="showimg-content" alt="showimg">
@@ -5,7 +5,7 @@
5
5
  <h2>LOADING...</h2>
6
6
  <p style="word-break: keep-all">加载过慢请开启缓存(浏览器默认开启)</p>
7
7
  <div>
8
- <img alt="loading" src="<%- url_for("/loading.gif") %>" style="width: 60px">
8
+ <img alt="loading" src="<%- url_for("/images/loading.gif") %>" style="width: 60px">
9
9
  </div>
10
10
  </div>
11
11
  </div>
package/layout/posts.ejs CHANGED
@@ -1,5 +1,13 @@
1
- <% let current = (page.current - 1) * config.index_generator.per_page; %>
2
- <% site.posts.slice(0 + current, config.index_generator.per_page + current).forEach(post => { %>
1
+ <%
2
+ let posts = site.posts,
3
+ current = (page.current - 1) * config.index_generator.per_page;
4
+ posts.data.sort((a, b) => {
5
+ let topa = a.top ?? 0, topb = b.top ?? 0;
6
+ return topa == topb ? b.date - a.date : topb - topa;
7
+ });
8
+ posts = posts.slice(current, config.index_generator.per_page + current);
9
+ %>
10
+ <% posts.forEach(post => { %>
3
11
  <div class="post">
4
12
  <a href="<%- url_for(post.path) %>">
5
13
  <h2 class="post-title"><%= titlecase(post.title) %></h2>
@@ -21,6 +29,16 @@
21
29
  </span>
22
30
  <%- date(post.date, "YYYY/M/D") %>
23
31
  </span>
32
+ <% if (theme.crypto.enable && typeof post.password !== "undefined") { %>
33
+ <span class="special">
34
+ <i class="fa-solid fa-lock fa-fw"></i>
35
+ </span>
36
+ <% } %>
37
+ <% if (typeof post.top !== "undefined" && post.top > 0) { %>
38
+ <span class="special">
39
+ <i class="fa-solid fa-grip-vertical fa-fw"></i>
40
+ </span>
41
+ <% } %>
24
42
  </div>
25
43
  <div class="excerpt">
26
44
  <div class="content" v-pre>
package/layout/tags.ejs CHANGED
@@ -19,11 +19,7 @@
19
19
  <% if (is_tag(tag.name)) { %>
20
20
  <%
21
21
  posts = tag.posts;
22
- posts.data.sort((a, b) => {
23
- if (typeof a.top === "undefined") a.top = 0;
24
- if (typeof b.top === "undefined") b.top = 0;
25
- return a.top == b.top ? b.date - a.date : b.top - a.top;
26
- });
22
+ posts.data.sort((a, b) => b.date - a.date);
27
23
  %>
28
24
  <% } %>
29
25
  <% }); %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-particlex",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "A concise Hexo theme, based on Particle.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"