hexo-theme-shokax 0.4.0 → 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",
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",
@@ -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++) {