hexo-theme-volantis 5.3.2 → 5.4.0
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 +12 -0
- package/_config.yml +6 -6
- package/package.json +1 -1
- package/source/js/app.js +45 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.4.0](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.3.2...v5.4.0) (2022-06-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **VolantisRequest:** Fetch, POST, Get ([ea98dbc](https://github.com/volantis-x/hexo-theme-volantis/commit/ea98dbcc4c3a9bfc0bf6de452e0da826276ff29c))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **fcircle:** CDN ([#765](https://github.com/volantis-x/hexo-theme-volantis/issues/765)) ([35a2e97](https://github.com/volantis-x/hexo-theme-volantis/commit/35a2e971da07eb30e4cb9a0fdeaafe74580cbcd0))
|
|
14
|
+
|
|
3
15
|
### [5.3.2](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.3.1...v5.3.2) (2022-05-24)
|
|
4
16
|
|
|
5
17
|
|
package/_config.yml
CHANGED
|
@@ -59,7 +59,7 @@ cdn:
|
|
|
59
59
|
cdn_version: true
|
|
60
60
|
# volantis static 静态资源文件 npm 包 CDN 地址 (后面加 "/" )
|
|
61
61
|
# https://github.com/volantis-x/volantis-static
|
|
62
|
-
volantis_static_cdn: https://unpkg.com/volantis-static@0.0.
|
|
62
|
+
volantis_static_cdn: https://unpkg.com/volantis-static@0.0.1654736714924/
|
|
63
63
|
########################################################################
|
|
64
64
|
# 全局页面字符串替换 A => B (可用于临时修改错字等)
|
|
65
65
|
replace:
|
|
@@ -841,7 +841,7 @@ plugins:
|
|
|
841
841
|
bbtalk:
|
|
842
842
|
# Set `plugins: ["bbtalk"]` to enable in front-matter
|
|
843
843
|
# 不支持 Pjax
|
|
844
|
-
js: https://unpkg.com/bbtalk@0/dist/bbtalk.js # BBtalk.js
|
|
844
|
+
js: https://unpkg.com/bbtalk@0.1.5/dist/bbtalk.js # BBtalk.js
|
|
845
845
|
appId: 0KzOX4vC7Jsk6vzUGNeEiUaI-gzGzoHsz # your appID
|
|
846
846
|
appKey: HwCiWuxfpvKiLm4teCUgTIba # your appKEY
|
|
847
847
|
serverURLs: https://bbapi.heson10.com # Request Api 域名
|
|
@@ -852,10 +852,10 @@ plugins:
|
|
|
852
852
|
fcircle:
|
|
853
853
|
# Set `plugins: ["fcircle"]` to enable in front-matter
|
|
854
854
|
# 支持 Pjax
|
|
855
|
-
api:
|
|
856
|
-
message:
|
|
857
|
-
css:
|
|
858
|
-
js:
|
|
855
|
+
api: https://fcircle-api.example.com/ # api 地址
|
|
856
|
+
message: 与主机通讯中…… # 占位文字
|
|
857
|
+
css: volantis-static/libs/fcircle/fcircle.css
|
|
858
|
+
js: volantis-static/libs/fcircle/fcircle.js
|
|
859
859
|
|
|
860
860
|
# 消息提示
|
|
861
861
|
# izitoast@1.4.0
|
package/package.json
CHANGED
package/source/js/app.js
CHANGED
|
@@ -67,7 +67,7 @@ const VolantisApp = (() => {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
fn.event = () => {
|
|
70
|
-
volantis.dom.$(document.getElementById("scroll-down"))
|
|
70
|
+
volantis.dom.$(document.getElementById("scroll-down"))?.on('click', function () {
|
|
71
71
|
fn.scrolltoElement(volantis.dom.bodyAnchor);
|
|
72
72
|
});
|
|
73
73
|
|
|
@@ -1126,3 +1126,47 @@ const DOMController = {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
}
|
|
1128
1128
|
Object.freeze(DOMController);
|
|
1129
|
+
|
|
1130
|
+
const VolantisRequest = {
|
|
1131
|
+
timeoutFetch: (url, ms, requestInit) => {
|
|
1132
|
+
const controller = new AbortController()
|
|
1133
|
+
requestInit.signal?.addEventListener('abort', () => controller.abort())
|
|
1134
|
+
let promise = fetch(url, { ...requestInit, signal: controller.signal })
|
|
1135
|
+
if (ms > 0) {
|
|
1136
|
+
const timer = setTimeout(() => controller.abort(), ms)
|
|
1137
|
+
promise.finally(() => { clearTimeout(timer) })
|
|
1138
|
+
}
|
|
1139
|
+
promise = promise.catch((err) => {
|
|
1140
|
+
throw ((err || {}).name === 'AbortError') ? new Error(`Fetch timeout: ${url}`) : err
|
|
1141
|
+
})
|
|
1142
|
+
return promise
|
|
1143
|
+
},
|
|
1144
|
+
|
|
1145
|
+
Fetch: async (url, requestInit, timeout = 15000) => {
|
|
1146
|
+
const resp = await VolantisRequest.timeoutFetch(url, timeout, requestInit);
|
|
1147
|
+
if (!resp.ok) throw new Error(`Fetch error: ${url} | ${resp.status}`);
|
|
1148
|
+
let json = await resp.json()
|
|
1149
|
+
if (!json.success) throw json
|
|
1150
|
+
return json
|
|
1151
|
+
},
|
|
1152
|
+
|
|
1153
|
+
POST: async (url, data) => {
|
|
1154
|
+
const requestInit = {
|
|
1155
|
+
method: 'POST',
|
|
1156
|
+
}
|
|
1157
|
+
if (data) {
|
|
1158
|
+
const formData = new FormData();
|
|
1159
|
+
Object.keys(data).forEach(key => formData.append(key, String(data[key])))
|
|
1160
|
+
requestInit.body = formData;
|
|
1161
|
+
}
|
|
1162
|
+
const json = await VolantisRequest.Fetch(url, requestInit)
|
|
1163
|
+
return json.data;
|
|
1164
|
+
},
|
|
1165
|
+
|
|
1166
|
+
Get: async (url, data) => {
|
|
1167
|
+
const json = await VolantisRequest.Fetch(url + (data ? (`?${new URLSearchParams(data)}`) : ''), {
|
|
1168
|
+
method: 'GET'
|
|
1169
|
+
})
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
Object.freeze(VolantisRequest);
|