hexo-theme-gnix 5.0.8 → 5.0.9

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.
@@ -19,7 +19,7 @@ twikoo.init(window.twikooConfig);
19
19
  <script
20
20
  dangerouslySetInnerHTML={{ __html: lazy_load_css_script }}
21
21
  ></script>
22
- <script async src={jsUrl} onload={`${js}`}></script>
22
+ <script defer src={jsUrl} onload={`${js}`}></script>
23
23
  </Fragment>
24
24
  );
25
25
  }
@@ -7,9 +7,6 @@ module.exports = class extends Component {
7
7
 
8
8
  return (
9
9
  <Fragment>
10
- {config.comment?.js_url && (
11
- <script defer src={config.comment.js_url}></script>
12
- )}
13
10
  <Plugins
14
11
  site={site}
15
12
  config={config}
@@ -17,18 +14,17 @@ module.exports = class extends Component {
17
14
  helper={helper}
18
15
  head={false}
19
16
  />
20
- <script defer src="/js/main.js"></script>
21
17
  <script
22
- async
18
+ defer
23
19
  src="/js/host/iconify-icon/3.0.2/iconify-icon.min.js"
24
20
  ></script>
25
- <script async src="/js/theme-selector.js"></script>
21
+ <script defer src="/js/theme-selector.js"></script>
26
22
  <script
27
23
  defer
28
24
  src="/js/host/medium-zoom/dist/medium-zoom.min.js"
29
- onLoad={`const zoom = mediumZoom(".article img", { background: "hsla(from var(--mantle) / 0.9)" })`}
30
25
  ></script>
31
- <script async src="/js/shiki/shiki.js"></script>
26
+ <script defer src="/js/shiki/shiki.js"></script>
27
+ <script defer src="/js/main.js"></script>
32
28
  <script async src="/js/instant-page.min.js" type="module"></script>
33
29
  </Fragment>
34
30
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-gnix",
3
- "version": "5.0.8",
3
+ "version": "5.0.9",
4
4
  "author": "Efterklang <gaojiaxing0220@gmail.com>",
5
5
  "license": "MIT",
6
6
  "description": "Second generation of Hexo theme Icarus, now with Catppuccin flavor and night mode support.",
@@ -199,12 +199,9 @@
199
199
  --crust: #242933;
200
200
  }
201
201
 
202
- .task-list-item-checkbox {
203
- accent-color: var(--lavender);
204
- }
205
-
206
- .task-list-item-checkbox:checked {
207
- accent-color: var(--mauve);
202
+ body {
203
+ background: var(--mantle);
204
+ color: var(--text);
208
205
  }
209
206
 
210
207
  .article-licensing {
@@ -218,9 +215,12 @@
218
215
  background: var(--mantle);
219
216
  }
220
217
 
221
- body {
222
- background: var(--mantle);
223
- color: var(--text);
218
+ .task-list-item-checkbox {
219
+ accent-color: var(--lavender);
220
+ }
221
+
222
+ .task-list-item-checkbox:checked {
223
+ accent-color: var(--mauve);
224
224
  }
225
225
 
226
226
  input.task-list-item-checkbox:checked {
@@ -91,7 +91,7 @@ function loadInsight(config, translation) {
91
91
  );
92
92
  if (maxlen && range[0] >= sumRange[0] + maxlen) break;
93
93
 
94
- result += `<em>${escapeHTML(text.slice(range[0], range[1]))}</em>`;
94
+ result += `<em style="color: var(--green)">${escapeHTML(text.slice(range[0], range[1]))}</em>`;
95
95
  last = range[1];
96
96
 
97
97
  if (i === ranges.length - 1) {
@@ -131,9 +131,8 @@ function loadInsight(config, translation) {
131
131
  const itemsHTML = array
132
132
  .map((item) => {
133
133
  if (isPostOrPage) {
134
- const title = findAndHighlight(item.title, keywords);
135
134
  const text = findAndHighlight(item.text, keywords, 100);
136
- return searchItem(title, text, item.link);
135
+ return searchItem(item.title, text, item.link);
137
136
  } else {
138
137
  // Tags
139
138
  const name = findAndHighlight(item.name, keywords);
@@ -324,18 +323,23 @@ function loadInsight(config, translation) {
324
323
  if (main.contains(e.relatedTarget)) {
325
324
  return;
326
325
  }
327
- // 当焦点移出 searchbox 时,关闭搜索框
328
326
  main.classList.remove("show");
329
327
  });
330
328
 
331
- // 监听打开搜索框的点击事件
329
+ main.addEventListener("click", (e) => {
330
+ const resultItem = e.target.closest(".searchbox-result-item");
331
+ if (resultItem) {
332
+ main.classList.remove("show");
333
+ }
334
+ });
335
+
332
336
  document.addEventListener("click", (e) => {
333
337
  if (e.target.closest(".navbar-main .search")) {
334
338
  main.classList.add("show");
335
339
  const inp = main.querySelector(".searchbox-input");
336
- if (inp) inp.focus();
340
+ inp.focus();
337
341
 
338
- // 优化点:Lazy Load - 打开时再请求数据
342
+ // Lazy Load - 打开时再请求数据
339
343
  fetchData();
340
344
  }
341
345
  });
package/source/js/main.js CHANGED
@@ -180,10 +180,13 @@ function initializeTableOfContents() {
180
180
  function initLogic() {
181
181
  initializeTableOfContents();
182
182
  initializeTabs();
183
+ mediumZoom(".article img", {
184
+ background: "hsla(from var(--mantle) / 0.9)",
185
+ });
183
186
  if (document.getElementById("twikoo")) {
184
187
  setTimeout(() => {
185
188
  twikoo?.init(window.twikooConfig);
186
- }, 1000);
189
+ }, 1500);
187
190
  }
188
191
  }
189
192