hexo-theme-shokax 0.4.13 → 0.4.14
Sign up to get free protection for your applications and to get access to all the features.
package/_config.yml
CHANGED
@@ -27,6 +27,10 @@ experiments:
|
|
27
27
|
optimizeLongPosts: false # 优化长文章,这能让长文章的FPS提升70%-150%并解决假死问题,但存在一些副作用
|
28
28
|
# 具体见https://docs.kaitaku.xyz/guide/theme.html#%E9%95%BF%E6%96%87%E7%AB%A0%E4%BC%98%E5%8C%96
|
29
29
|
mobileWidth: 820px # 移动版和桌面版导航栏最短切换长度
|
30
|
+
coverConfig:
|
31
|
+
enableCover: true # 是否开启头图
|
32
|
+
enablePreload: true #是否开启预加载头图
|
33
|
+
enableNextGradientCover: true # 使用CSS渐变作为上/下一页封面
|
30
34
|
|
31
35
|
homeConfig:
|
32
36
|
gradient: false # 使用CSS渐变作为文章封面
|
@@ -8,16 +8,19 @@ if (theme.quicklink.ignores)
|
|
8
8
|
|
9
9
|
- var covers = _cover_index(page, 6)
|
10
10
|
- var enableFixedCover = theme.homeConfig?.fixedCover
|
11
|
+
- var enablePreload = theme.experiments?.coverConfig?.enablePreload
|
12
|
+
- var enableCover = theme.experiments?.coverConfig?.enableCover
|
11
13
|
|
12
14
|
doctype html
|
13
15
|
html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'filter: grayscale(1);':'' )
|
14
16
|
head
|
15
17
|
!= partial('_partials/head/head.pug', {}, {cache: true})
|
16
|
-
if
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
if enablePreload && enableCover
|
19
|
+
if enableFixedCover
|
20
|
+
link(rel="preload" href=theme.homeConfig.fixedCover as="image" fetchpriority="high")
|
21
|
+
else
|
22
|
+
each image in covers
|
23
|
+
link(rel="preload" href=image as="image" fetchpriority="high")
|
21
24
|
|
22
25
|
!= partial('_partials/head/head_com.pug')
|
23
26
|
!= shokax_inject('head')
|
@@ -44,17 +47,18 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
44
47
|
|
45
48
|
!= partial('_partials/header.pug', {}, {cache: true})
|
46
49
|
div(id="imgs" class="pjax")
|
47
|
-
if
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
if covers.length === 6
|
53
|
-
ul
|
54
|
-
each image in covers
|
55
|
-
li(class="item" style=`background-image: url("${image}");`)
|
50
|
+
if enableCover
|
51
|
+
if theme.homeConfig.gradient || enableFixedCover
|
52
|
+
//- cover不可用时用Bing随机图片代替
|
53
|
+
- var coverImage = theme.homeConfig?.fixedCover || "https://7ed.net/bing/api"
|
54
|
+
img(src=coverImage loading="eager" decoding="async" fetchpriority="high" alt=title)
|
56
55
|
else
|
57
|
-
|
56
|
+
if covers.length === 6
|
57
|
+
ul
|
58
|
+
each image in covers
|
59
|
+
li(class="item" style=`background-image: url("${image}");`)
|
60
|
+
else
|
61
|
+
img(src=covers loading="eager" decoding="async" fetchpriority="high" alt=title)
|
58
62
|
div(id="waves")
|
59
63
|
svg(class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto")
|
60
64
|
defs
|
@@ -1,8 +1,12 @@
|
|
1
1
|
mixin navpost(item, type)
|
2
|
+
- var enableNextGradientCover = theme?.experiments?.coverConfig?.enableNextGradientCover
|
2
3
|
- var postText = item.title || item.link || __('post.untitled')
|
3
4
|
- var lastcat = item.categories.last()
|
4
5
|
- var itemlink = `<span class="type">${__('post.' + type)}</span>${lastcat && lastcat.name ? `<span class="category"><i class="ic i-flag"></i>${lastcat.name}</span>` : ''}<h3>${postText}</h3>`
|
5
|
-
|
6
|
+
if enableNextGradientCover
|
7
|
+
!= _url(item.path, itemlink, {itemprop: 'url', rel: type, title: postText, style: `background-image: linear-gradient(to bottom right, ${random_color()}, ${random_color()});`})
|
8
|
+
else
|
9
|
+
!= _url(item.path, itemlink, {itemprop: 'url', rel: type, 'data-background-image': _cover(item), title: postText})
|
6
10
|
|
7
11
|
div(class="post-nav")
|
8
12
|
div(class="item left")
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.14",
|
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",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"@algolia/client-search": "^5.5.3",
|
31
31
|
"@waline/client": "^3.3.2",
|
32
32
|
"algoliasearch": "5.5.3",
|
33
|
-
"esbuild": "^0.
|
33
|
+
"esbuild": "^0.24.0",
|
34
34
|
"hexo": "^7.3.0",
|
35
35
|
"hexo-algoliasearch": "^2.0.1",
|
36
36
|
"hexo-feed": "^1.1.2",
|
@@ -134,9 +134,6 @@ hexo.extend.generator.register("script", function(locals) {
|
|
134
134
|
__shokax_twikoo__: theme.twikoo.enable ? "true" : "false",
|
135
135
|
shokax_CONFIG: JSON.stringify(siteConfig),
|
136
136
|
shokax_siteURL: "'" + config.url + "'"
|
137
|
-
},
|
138
|
-
alias: {
|
139
|
-
"algoliasearch/lite": "algoliasearch/dist/algoliasearch-lite.esm.browser.js"
|
140
137
|
}
|
141
138
|
});
|
142
139
|
const res = [];
|
@@ -1,10 +1,9 @@
|
|
1
|
-
import {
|
1
|
+
import { CONFIG, siteSearch } from '../globals/globalVars'
|
2
2
|
import { transition } from '../library/anime'
|
3
|
-
import { $dom } from '../library/dom'
|
4
3
|
import { searchBox, configure, stats, hits, pagination } from 'instantsearch.js/es/widgets'
|
5
4
|
import type { HitHighlightResult } from 'instantsearch.js/es/types/results'
|
6
5
|
import instantsearch from 'instantsearch.js'
|
7
|
-
import algoliasearch from 'algoliasearch/lite'
|
6
|
+
import { liteClient as algoliasearch } from 'algoliasearch/lite'
|
8
7
|
|
9
8
|
export function algoliaSearch (pjax) {
|
10
9
|
const search = instantsearch({
|