hexo-theme-shokax 0.4.0-beta.1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,10 +6,19 @@ include ../_mixin/widgets.pug
6
6
  if (theme.quicklink.ignores)
7
7
  - ignores.push(theme.quicklink.ignores)
8
8
 
9
+ - var covers = _cover_index(page, 6)
10
+ - var enableFixedCover = theme.homeConfig?.fixedCover
11
+
9
12
  doctype html
10
13
  html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'filter: grayscale(1);':'' )
11
14
  head
12
15
  != partial('_partials/head/head.pug', {}, {cache: true})
16
+ if enableFixedCover
17
+ link(rel="preload" href=theme.homeConfig.fixedCover as="image" fetchpriority="high")
18
+ else
19
+ each image in covers
20
+ link(rel="preload" href=image as="image" fetchpriority="high")
21
+
13
22
  != partial('_partials/head/head_com.pug')
14
23
  != shokax_inject('head')
15
24
  title
@@ -35,12 +44,11 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
35
44
 
36
45
  != partial('_partials/header.pug', {}, {cache: true})
37
46
  div(id="imgs" class="pjax")
38
- if theme.homeConfig.gradient || theme.homeConfig.fixedCover
47
+ if theme.homeConfig.gradient || enableFixedCover
39
48
  //- cover不可用时用Bing随机图片代替
40
- - var coverImage = theme.homeConfig.fixedCover || "https://7ed.net/bing/api"
49
+ - var coverImage = theme.homeConfig?.fixedCover || "https://7ed.net/bing/api"
41
50
  img(src=coverImage loading="eager" decoding="async" fetchpriority="high")
42
51
  else
43
- - var covers = _cover_index(page, 6)
44
52
  if covers.length === 6
45
53
  ul
46
54
  each image in covers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.4.0-beta.1",
3
+ "version": "0.4.1",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
@@ -19,17 +19,17 @@
19
19
  "@types/quicklink": "^2.3.4",
20
20
  "@typescript-eslint/eslint-plugin": "^6.20.0",
21
21
  "@typescript-eslint/parser": "^6.20.0",
22
- "@waline/client": "3.0.0-alpha.11",
23
22
  "eslint": "^8.56.0",
24
23
  "eslint-config-standard": "~17",
25
24
  "eslint-plugin-import": "^2.29.1",
26
25
  "eslint-plugin-n": "^16.6.2",
27
26
  "eslint-plugin-promise": "^6.1.1",
28
27
  "eslint-plugin-vue": "^9.20.1",
29
- "typescript": "^5.3.3",
30
- "vue": "^3.4.15"
28
+ "typescript": "^5.3.3"
31
29
  },
32
30
  "dependencies": {
31
+ "@waline/client": "3.0.0-alpha.11",
32
+ "vue": "^3.4.15",
33
33
  "@algolia/client-search": "^4.22.1",
34
34
  "algoliasearch": "4.22.1",
35
35
  "esbuild": "^0.20.0",
@@ -44,7 +44,11 @@
44
44
  "theme-shokax-anime": "^0.0.6",
45
45
  "theme-shokax-pjax": "^0.0.3",
46
46
  "twikoo": "^1.6.31",
47
- "unlazy": "^0.10.4"
47
+ "unlazy": "^0.10.4",
48
+ "hexo-lightning-minify": "latest",
49
+ "hexo-algoliasearch": "latest",
50
+ "hexo-feed": "latest",
51
+ "hexo-renderer-pug": "latest"
48
52
  },
49
53
  "engines": {
50
54
  "node": ">=18.0.0"
@@ -7,10 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const package_json_1 = __importDefault(require("../../package.json"));
8
8
  const hexo_util_1 = require("hexo-util");
9
9
  const utils_1 = require("../utils");
10
- // TODO 弃用函数
11
- hexo.extend.helper.register('_new_comments', function (mode) {
12
- return '';
13
- });
14
10
  hexo.extend.helper.register('_safedump', (source) => {
15
11
  return JSON.stringify(source);
16
12
  });
@@ -44,7 +40,9 @@ hexo.extend.helper.register('_vendor_font', () => {
44
40
  return fontFamilies
45
41
  ? (0, hexo_util_1.htmlTag)('link', {
46
42
  rel: 'stylesheet',
47
- href: `${fontHost}/css?family=${fontFamilies.concat(fontDisplay, fontSubset)}`
43
+ href: `${fontHost}/css?family=${fontFamilies.concat(fontDisplay, fontSubset)}`,
44
+ media: 'none',
45
+ onload: "this.media='all'"
48
46
  })
49
47
  : '';
50
48
  });
@@ -65,9 +63,6 @@ hexo.extend.helper.register('vendor_js', function () {
65
63
  for (const jsSync in vendors.js) {
66
64
  res += (0, hexo_util_1.htmlTag)('script', { src: (0, utils_1.getVendorLink)(hexo, vendors.js[jsSync]), async: true }, '');
67
65
  }
68
- // for (const jsAsync in vendors.async_js) {
69
- // res += htmlTag('script', { src: getVendorLink(hexo, vendors.async_js[jsAsync]), async: true }, '')
70
- // }
71
66
  return res;
72
67
  });
73
68
  hexo.extend.helper.register('_striptags', function (data) {
@@ -47,10 +47,10 @@ hexo.on('generateBefore', () => {
47
47
  });
48
48
  hexo.on('generateAfter', () => {
49
49
  // 检查版本更新
50
- fetch('https://api.github.com/repos/theme-shoka-x/hexo-theme-shokaX/releases/latest').then((res) => {
50
+ fetch('https://registry.npmmirror.com/hexo-theme-shokax').then((res) => {
51
51
  res.json().then((resp) => {
52
52
  try {
53
- const latest = resp.tag_name.replace('v', '').split('.');
53
+ const latest = resp['dist-tags'].latest;
54
54
  const current = package_json_1.version.split('.');
55
55
  let isOutdated = false;
56
56
  for (let i = 0; i < Math.max(latest.length, current.length); i++) {