hexo-theme-volantis 5.7.2 → 5.7.5
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.
- package/CHANGELOG.md +25 -0
- package/_config.yml +8 -4
- package/layout/_partial/footer.ejs +10 -6
- package/layout/_partial/head.ejs +1 -1
- package/layout/_partial/scripts/_ctrl/cdnCtrl.ejs +2 -1
- package/layout/_partial/scripts/index.ejs +3 -1
- package/package.json +1 -1
- package/scripts/filters/content-visibility.js +20 -18
- package/scripts/helpers/revisioned.js +2 -2
- package/scripts/tags/pandown.js +2 -2
- package/source/css/first.styl +13 -11
- package/source/js/search/hexo.js +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.7.5](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.4...v5.7.5) (2022-08-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **pandown:** Uncaught TypeError: pandown is not a function ([371b1ec](https://github.com/volantis-x/hexo-theme-volantis/commit/371b1ece729a719f102854d3175ce440f90b4a14))
|
|
9
|
+
* search ([7f11915](https://github.com/volantis-x/hexo-theme-volantis/commit/7f11915c4c672f427a6044e2614ed85e7e052587))
|
|
10
|
+
|
|
11
|
+
## [5.7.4](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.3...v5.7.4) (2022-08-15)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **#793:** 修复空值 ([302c98f](https://github.com/volantis-x/hexo-theme-volantis/commit/302c98fc5b0c725fb77c6bb33d7537f8f1f2062f))
|
|
17
|
+
|
|
18
|
+
## [5.7.3](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.2...v5.7.3) (2022-08-15)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **#781:** content_visibility: false ([0c719be](https://github.com/volantis-x/hexo-theme-volantis/commit/0c719be17e8affb28dd42c9c8bfb52e3e21d9790))
|
|
24
|
+
* **#793:** cdn_version: false ([cf60678](https://github.com/volantis-x/hexo-theme-volantis/commit/cf6067860312fbd6afd4ba6c14867d9ef86832fd))
|
|
25
|
+
* **#793:** 移除默认配置 ([4d82dff](https://github.com/volantis-x/hexo-theme-volantis/commit/4d82dff4d41c513cfa0124cbed7e42b60236d9de))
|
|
26
|
+
* **#798:** footer version link 404 ([a2a2d90](https://github.com/volantis-x/hexo-theme-volantis/commit/a2a2d90dc96fd00bb14cd742e0f05d253ef4ebed))
|
|
27
|
+
|
|
3
28
|
## [5.7.2](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.1...v5.7.2) (2022-08-01)
|
|
4
29
|
|
|
5
30
|
|
package/_config.yml
CHANGED
|
@@ -50,17 +50,21 @@ cdn:
|
|
|
50
50
|
# 以下配置可以覆盖 cdn.prefix,配置项的值可以为空,但是要使用CDN必须依据路径填写配置项的键
|
|
51
51
|
set:
|
|
52
52
|
js:
|
|
53
|
-
app: /js/app.js
|
|
53
|
+
#app: /js/app.js
|
|
54
54
|
css:
|
|
55
|
-
style: /css/style.css # (异步加载样式)
|
|
55
|
+
#style: /css/style.css # (异步加载样式)
|
|
56
56
|
# 静态资源版本控制
|
|
57
57
|
# 本地文件使用文件内容的hash值作为版本号(app.8c1e7c88.js) 其他为时间戳 (?time=1648684470140)
|
|
58
58
|
# 建议静态资源设置标头 浏览器缓存一年边缘缓存一个月 cache-control: max-age=86400, s-maxage=31536000 如果有更新记得刷新缓存
|
|
59
|
-
cdn_version:
|
|
59
|
+
cdn_version: false
|
|
60
60
|
# volantis static 静态资源文件 npm 包 CDN 地址 (后面加 "/" )
|
|
61
61
|
# https://github.com/volantis-x/volantis-static
|
|
62
62
|
volantis_static_cdn: https://unpkg.com/volantis-static@0.0.1654736714924/
|
|
63
63
|
########################################################################
|
|
64
|
+
# https://web.dev/content-visibility/
|
|
65
|
+
# https://www.caniuse.com/?search=content-visibility
|
|
66
|
+
content_visibility: false
|
|
67
|
+
|
|
64
68
|
# 全局页面字符串替换 A => B (可用于临时修改错字等)
|
|
65
69
|
replace:
|
|
66
70
|
- https://cdn.jsdelivr.net/npm/ => https://unpkg.com/
|
|
@@ -733,7 +737,7 @@ plugins:
|
|
|
733
737
|
|
|
734
738
|
# https://scrollrevealjs.org/api/reveal.html
|
|
735
739
|
scrollreveal:
|
|
736
|
-
enable: true
|
|
740
|
+
enable: #true
|
|
737
741
|
js: volantis-static/libs/scrollreveal/dist/scrollreveal.min.js # https://unpkg.com/scrollreveal@4.0.9/dist/scrollreveal.min.js
|
|
738
742
|
distance: 32px
|
|
739
743
|
duration: 800 # ms
|
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
layout = config.theme_config.footer.layout;
|
|
6
6
|
}
|
|
7
7
|
let theme_version = theme.info.theme_version
|
|
8
|
-
// 未发布的 alpha 版本
|
|
9
|
-
if (theme_version.indexOf("alpha")!=-1) {
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
// // 未发布的 alpha 版本
|
|
9
|
+
// if (theme_version.indexOf("alpha")!=-1) {
|
|
10
|
+
// theme_version = "dev"
|
|
11
|
+
// }
|
|
12
|
+
// // 从 5.7.2 以后的版本以 v开头(release-please的奇怪设定)
|
|
13
|
+
// else if (theme_version.indexOf("beta")==-1||theme_version.indexOf("rc")==-1) {
|
|
14
|
+
// theme_version = "v" + theme_version
|
|
15
|
+
// }
|
|
12
16
|
%>
|
|
13
17
|
<footer class="footer clearfix" itemscope itemtype="http://schema.org/WPFooter">
|
|
14
18
|
<br><br>
|
|
@@ -39,13 +43,13 @@
|
|
|
39
43
|
<div><%- markdown(__('footer.license')) %></div>
|
|
40
44
|
<% } else if (item == 'info') { %>
|
|
41
45
|
<%- __('footer.use') %>
|
|
42
|
-
<a href="https://github.com/volantis-x/hexo-theme-volantis
|
|
46
|
+
<a href="https://github.com/volantis-x/hexo-theme-volantis/#<%- theme_version %>" target="_blank" class="codename">Volantis</a>
|
|
43
47
|
<%- __('footer.theme') %><% if (theme.analytics.busuanzi) { %><%- __('symbol.comma') %><%- __('footer.total_views') %>
|
|
44
48
|
<span id="busuanzi_value_site_pv"><i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i></span>
|
|
45
49
|
<%- __('footer.times') %>
|
|
46
50
|
<% } %>
|
|
47
51
|
<% } else if (item == 'source') { %>
|
|
48
|
-
<%- markdown(__('footer.site_source', '[Volantis](https://github.com/volantis-x/hexo-theme-volantis
|
|
52
|
+
<%- markdown(__('footer.site_source', '[Volantis](https://github.com/volantis-x/hexo-theme-volantis/#'+theme_version+')', 'GitHub', 'https://github.com/volantis-x/volantis-docs')) %>
|
|
49
53
|
<% } else if (item == 'copyright') { %>
|
|
50
54
|
<div class='copyright'>
|
|
51
55
|
<%- markdown(theme.site_footer.copyright) %>
|
package/layout/_partial/head.ejs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<head hexo-theme='https://github.com/volantis-x/hexo-theme-volantis
|
|
1
|
+
<head hexo-theme='https://github.com/volantis-x/hexo-theme-volantis/#<%- theme.info.theme_version %>'>
|
|
2
2
|
<%- meta_generator() %>
|
|
3
3
|
<meta name="Volantis" content="<%- theme.info.theme_version %>">
|
|
4
4
|
<meta charset="utf-8">
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
const element = n[key];
|
|
66
66
|
if(element && typeof element !="string"){
|
|
67
67
|
dfs(element,path.concat(key))
|
|
68
|
-
}else{
|
|
68
|
+
}else if(element){
|
|
69
69
|
let op=path.concat(key)
|
|
70
70
|
let source=""
|
|
71
71
|
for (let index = 1; index < op.length; index++) {
|
|
@@ -122,5 +122,6 @@
|
|
|
122
122
|
// ?time=' + Date.now() 替换为 theme.getStartTime 保证相同资源 hash 不变
|
|
123
123
|
// 更新:
|
|
124
124
|
// 本地文件使用文件内容的hash值作为版本号 app.8c1e7c88.js see: /scripts/helpers/revisioned.js
|
|
125
|
+
|
|
125
126
|
dfs(theme.cdn.set,[])
|
|
126
127
|
_%>
|
|
@@ -136,7 +136,9 @@
|
|
|
136
136
|
|
|
137
137
|
<%- partial('toc') %>
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
<% if (theme.content_visibility) { %>
|
|
140
|
+
<%- partial('content-visibility-scroll-fix') %>
|
|
141
|
+
<% } %>
|
|
140
142
|
|
|
141
143
|
<%- partial('../../_plugins/slow-network/script') %>
|
|
142
144
|
|
package/package.json
CHANGED
|
@@ -2,24 +2,26 @@
|
|
|
2
2
|
// https://www.caniuse.com/?search=content-visibility
|
|
3
3
|
// 在文章内容渲染时将每两个 <h2> 之间的内容分为一块 用 <div class="post-story"></div> 包裹起来。然后为 .post-story 声明 content-visibility: auto
|
|
4
4
|
hexo.extend.filter.register('after_post_render', function (data) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
flag
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
if (this.theme.config.content_visibility) {
|
|
6
|
+
let dataList = data.content.split('\n')
|
|
7
|
+
let mydata = ``
|
|
8
|
+
let flag = 1
|
|
9
|
+
dataList.forEach(e => {
|
|
10
|
+
let yy = e.replace(/<h2.*?>.*?<\/h2>/, function (str) {
|
|
11
|
+
if (flag) {
|
|
12
|
+
flag = 0
|
|
13
|
+
return `<div class="story post-story">` + str
|
|
14
|
+
} else {
|
|
15
|
+
return `</div><div class="story post-story">` + str
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
mydata += yy
|
|
19
|
+
mydata += "\n"
|
|
20
|
+
});
|
|
21
|
+
if (!flag) {
|
|
22
|
+
mydata += `</div>`
|
|
23
|
+
}
|
|
24
|
+
data.content = mydata
|
|
22
25
|
}
|
|
23
|
-
data.content = mydata
|
|
24
26
|
return data;
|
|
25
27
|
});
|
|
@@ -62,7 +62,7 @@ const getRevisionedFilePath = (filePath, revision) => {
|
|
|
62
62
|
|
|
63
63
|
const revisioned = (filePath) => {
|
|
64
64
|
if (!hexo.theme.config.cdn_version) {
|
|
65
|
-
return;
|
|
65
|
+
return filePath;
|
|
66
66
|
}
|
|
67
67
|
let arg = process.argv[2];
|
|
68
68
|
if (arg == "s" || arg == "server") {
|
|
@@ -160,7 +160,7 @@ const replaceRevisionPlaceholder = async () => {
|
|
|
160
160
|
})
|
|
161
161
|
);
|
|
162
162
|
} catch (error) {
|
|
163
|
-
|
|
163
|
+
hexo.log.error("cdn_version ERROR: " + error);
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
166
|
|
package/scripts/tags/pandown.js
CHANGED
|
@@ -24,10 +24,10 @@ hexo.extend.tag.register('pandown', function(args) {
|
|
|
24
24
|
}
|
|
25
25
|
let result = '';
|
|
26
26
|
// js
|
|
27
|
-
result += '<div class="tag pandown-tags"
|
|
27
|
+
result += '<div class="tag pandown-tags">';
|
|
28
28
|
//pandown
|
|
29
29
|
result += '<pandown type="'+type+'" url="'+url+'" pwd="'+pwd+'" fname="'+fname+'"></pandown>'
|
|
30
30
|
//调用
|
|
31
|
-
result += '<script>pandown()</script></div>'
|
|
31
|
+
result += '<script>volantis.js("https://unpkg.com/pandown").then(pandown)</script></div>'
|
|
32
32
|
return result;
|
|
33
33
|
});
|
package/source/css/first.styl
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
#safearea {
|
|
2
2
|
display: none
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
|
|
5
|
+
if hexo-config('content_visibility')
|
|
6
|
+
// https://web.dev/content-visibility/
|
|
7
|
+
// https://www.caniuse.com/?search=content-visibility
|
|
8
|
+
/*
|
|
9
|
+
* Workaround for Chrome bug, part 1
|
|
10
|
+
* Chunk rendering for all but the first article.
|
|
11
|
+
* /layout/_partial/scripts/content-visibility-scroll-fix.ejs
|
|
12
|
+
*/
|
|
13
|
+
.post-story + .post-story{
|
|
14
|
+
content-visibility: auto;
|
|
15
|
+
contain-intrinsic-size: 10px 500px;
|
|
16
|
+
}
|
|
15
17
|
|
|
16
18
|
@import '_defines/*'
|
|
17
19
|
|
package/source/js/search/hexo.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let SearchService = (() => {
|
|
2
|
-
fn = {};
|
|
2
|
+
const fn = {};
|
|
3
3
|
fn.queryText = null;
|
|
4
4
|
fn.data = null;
|
|
5
5
|
fn.template = `<div id="u-search">
|
|
@@ -58,8 +58,8 @@ let SearchService = (() => {
|
|
|
58
58
|
fn.data = await fn.fetchData();
|
|
59
59
|
}
|
|
60
60
|
let results = "";
|
|
61
|
-
results += fn.buildResultList(data.pages);
|
|
62
|
-
results += fn.buildResultList(data.posts);
|
|
61
|
+
results += fn.buildResultList(fn.data.pages);
|
|
62
|
+
results += fn.buildResultList(fn.data.posts);
|
|
63
63
|
document.querySelector("#u-search .modal-results").innerHTML = results;
|
|
64
64
|
window.pjax && pjax.refresh(document.querySelector("#u-search"));
|
|
65
65
|
document.addEventListener("keydown", function f(event) {
|
|
@@ -76,7 +76,7 @@ let SearchService = (() => {
|
|
|
76
76
|
return fetch(SearchServiceDataPath)
|
|
77
77
|
.then((response) => response.text())
|
|
78
78
|
.then((res) => {
|
|
79
|
-
data = JSON.parse(res);
|
|
79
|
+
const data = JSON.parse(res);
|
|
80
80
|
// console.log(data);
|
|
81
81
|
return data;
|
|
82
82
|
});
|
|
@@ -87,8 +87,8 @@ let SearchService = (() => {
|
|
|
87
87
|
if (post.text) {
|
|
88
88
|
post.text = post.text.replace(/12345\d*/g, "") // 简易移除代码行号
|
|
89
89
|
}
|
|
90
|
-
if (!post.title&&post.text) {
|
|
91
|
-
post.title = post.text.trim().slice(0,15)
|
|
90
|
+
if (!post.title && post.text) {
|
|
91
|
+
post.title = post.text.trim().slice(0, 15)
|
|
92
92
|
}
|
|
93
93
|
if (fn.contentSearch(post)) {
|
|
94
94
|
html += fn.buildResult(post.permalink, post.title, post.digest);
|