hexo-theme-shokax 0.2.0-rc2 → 0.2.0-rc4
Sign up to get free protection for your applications and to get access to all the features.
- package/_config.yml +2 -0
- package/layout/_partials/head/head.pug +1 -1
- package/package.json +2 -1
- package/source/css/_common/components/post/expand.styl +0 -4
- package/source/css/app.styl +2 -0
- package/source/css/optimize.styl +6 -0
- package/source/js/_app/components.js +1 -1
- package/source/js/_app/global.js +7 -8
- package/source/js/_app/library.js +4 -5
- package/source/js/_app/page.js +1 -1
- package/source/js/_app/player.js +6 -7
package/_config.yml
CHANGED
@@ -28,6 +28,8 @@ experiments:
|
|
28
28
|
debug: false # 使用debug模式启动
|
29
29
|
disableThemeComment: false # 禁用主题评论系统(一般用于关闭评论或让插件接管评论系统)
|
30
30
|
usingRelative: false # _image.yml 使用相对路径
|
31
|
+
optimizeLongPosts: false # 优化长文章,这能让长文章的FPS提升70%-150%并解决假死问题,但存在一些副作用
|
32
|
+
# 具体见https://docs.kaitaku.xyz/guide/theme.html#%E9%95%BF%E6%96%87%E7%AB%A0%E4%BC%98%E5%8C%96
|
31
33
|
|
32
34
|
# 优化性能区
|
33
35
|
performance:
|
@@ -58,7 +58,7 @@ else if gt
|
|
58
58
|
link(rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css")
|
59
59
|
script(src="https://unpkg.com/gitalk/dist/gitalk.min.js")
|
60
60
|
|
61
|
-
- var qw = theme
|
61
|
+
- var qw = theme?.qweather?.enable
|
62
62
|
if qw
|
63
63
|
style.
|
64
64
|
img[data-v-7d48daab] {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.2.0-
|
3
|
+
"version": "0.2.0-rc4",
|
4
4
|
"description": "a hexo theme based on shoka",
|
5
5
|
"main": "index.js",
|
6
6
|
"repository": "https://github.com/zkz098/hexo-theme-shokaX",
|
@@ -24,6 +24,7 @@
|
|
24
24
|
"@typescript-eslint/eslint-plugin": "^5.51.0",
|
25
25
|
"@typescript-eslint/parser": "^5.51.0",
|
26
26
|
"@vuepress/client": "2.0.0-beta.60",
|
27
|
+
"@vuepress/plugin-docsearch": "2.0.0-beta.60",
|
27
28
|
"eslint": "^8.34.0",
|
28
29
|
"eslint-config-standard": "^17.0.0",
|
29
30
|
"eslint-plugin-import": "^2.27.5",
|
@@ -13,16 +13,12 @@
|
|
13
13
|
img,
|
14
14
|
.tabs,
|
15
15
|
.links {
|
16
|
-
content-visibility: auto;
|
17
|
-
contain-intrinsic-size: 979px 1.2em;
|
18
16
|
&:last-child {
|
19
17
|
margin-bottom: 0;
|
20
18
|
}
|
21
19
|
}
|
22
20
|
|
23
21
|
ul, dd, ol {
|
24
|
-
content-visibility: auto;
|
25
|
-
contain-intrinsic-size: 979px 3.5em;
|
26
22
|
ul, ol {
|
27
23
|
margin-top: 0;
|
28
24
|
}
|
package/source/css/app.styl
CHANGED
@@ -248,7 +248,7 @@ const sidebarTOC = function () {
|
|
248
248
|
const link = element.child('a.toc-link');
|
249
249
|
const anchor = $dom(decodeURI(link.attr('href')));
|
250
250
|
if (!anchor)
|
251
|
-
return;
|
251
|
+
return null;
|
252
252
|
const alink = anchor.child('a.anchor');
|
253
253
|
const anchorScroll = function (event) {
|
254
254
|
event.preventDefault();
|
package/source/js/_app/global.js
CHANGED
@@ -104,7 +104,7 @@ const themeColorListener = function () {
|
|
104
104
|
}
|
105
105
|
};
|
106
106
|
const visibilityListener = function () {
|
107
|
-
|
107
|
+
const iconNode = $dom('[rel="icon"]');
|
108
108
|
document.addEventListener('visibilitychange', function () {
|
109
109
|
switch (document.visibilityState) {
|
110
110
|
case 'hidden':
|
@@ -182,8 +182,7 @@ const scrollHandle = function (event) {
|
|
182
182
|
siteNav.removeClass('down');
|
183
183
|
siteNav.toggleClass('up', SHOW);
|
184
184
|
}
|
185
|
-
else {
|
186
|
-
}
|
185
|
+
else { }
|
187
186
|
scrollAction.y = window.scrollY;
|
188
187
|
const scrollPercent = Math.round(Math.min(100 * window.scrollY / contentVisibilityHeight, 100)) + '%';
|
189
188
|
backToTop.child('span').innerText = scrollPercent;
|
@@ -287,16 +286,16 @@ const clickMenu = function () {
|
|
287
286
|
event.preventDefault();
|
288
287
|
let x = event.offsetX;
|
289
288
|
let y = event.offsetY;
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
289
|
+
const winWidth = window.innerWidth;
|
290
|
+
const winHeight = window.innerHeight;
|
291
|
+
const menuWidth = menuElement.offsetWidth;
|
292
|
+
const menuHeight = menuElement.offsetHeight;
|
294
293
|
x = winWidth - menuWidth >= x ? x : winWidth - menuWidth;
|
295
294
|
y = winHeight - menuHeight >= y ? y : winHeight - menuHeight;
|
296
295
|
menuElement.style.top = y + 'px';
|
297
296
|
menuElement.style.left = x + 'px';
|
298
297
|
menuElement.classList.add('active');
|
299
|
-
$dom.each(
|
298
|
+
$dom.each('.clickSubmenu', (submenu) => {
|
300
299
|
if (x > (winWidth - menuWidth - submenu.offsetWidth)) {
|
301
300
|
submenu.style.left = '-200px';
|
302
301
|
}
|
@@ -105,13 +105,12 @@ Object.assign(HTMLElement.prototype, {
|
|
105
105
|
},
|
106
106
|
_class: function (type, className, display) {
|
107
107
|
const classNames = className.indexOf(' ') ? className.split(' ') : [className];
|
108
|
-
|
109
|
-
classNames.forEach(function (name) {
|
108
|
+
classNames.forEach((name) => {
|
110
109
|
if (type === 'toggle') {
|
111
|
-
|
110
|
+
this.classList.toggle(name, display);
|
112
111
|
}
|
113
112
|
else {
|
114
|
-
|
113
|
+
this.classList[type](name);
|
115
114
|
}
|
116
115
|
});
|
117
116
|
},
|
@@ -150,7 +149,7 @@ const getScript = function (url, callback, condition) {
|
|
150
149
|
let script = document.createElement('script');
|
151
150
|
script.onload = function (_, isAbort) {
|
152
151
|
if (isAbort || !script.readyState) {
|
153
|
-
console.log(
|
152
|
+
console.log('abort!');
|
154
153
|
script.onload = null;
|
155
154
|
script = undefined;
|
156
155
|
if (!isAbort && callback)
|
package/source/js/_app/page.js
CHANGED
@@ -555,7 +555,7 @@ const pjaxReload = function () {
|
|
555
555
|
menuToggle.removeClass('close');
|
556
556
|
});
|
557
557
|
}
|
558
|
-
|
558
|
+
const mainNode = $dom('#main');
|
559
559
|
mainNode.innerHTML = '';
|
560
560
|
mainNode.appendChild(loadCat.lastChild.cloneNode(true));
|
561
561
|
pageScroll(0);
|
package/source/js/_app/player.js
CHANGED
@@ -444,25 +444,24 @@ const mediaPlayer = function (t, config) {
|
|
444
444
|
return this;
|
445
445
|
},
|
446
446
|
fetch: function () {
|
447
|
-
|
448
|
-
return new Promise(function (resolve, reject) {
|
447
|
+
return new Promise((resolve, reject) => {
|
449
448
|
if (playlist.data.length > 0) {
|
450
449
|
resolve(true);
|
451
450
|
}
|
452
451
|
else {
|
453
|
-
if (
|
452
|
+
if (this.options.rawList) {
|
454
453
|
const promises = [];
|
455
|
-
|
454
|
+
this.options.rawList.forEach(function (raw, index) {
|
456
455
|
promises.push(new Promise(function (resolve, reject) {
|
457
456
|
let group = index;
|
458
457
|
let source;
|
459
458
|
if (!raw.list) {
|
460
459
|
group = 0;
|
461
|
-
|
460
|
+
this.group = false;
|
462
461
|
source = [raw];
|
463
462
|
}
|
464
463
|
else {
|
465
|
-
|
464
|
+
this.group = true;
|
466
465
|
source = raw.list;
|
467
466
|
}
|
468
467
|
utils.fetch(source).then(function (list) {
|
@@ -480,7 +479,7 @@ const mediaPlayer = function (t, config) {
|
|
480
479
|
if (c) {
|
481
480
|
playlist.create();
|
482
481
|
controller.create();
|
483
|
-
|
482
|
+
this.mode();
|
484
483
|
}
|
485
484
|
});
|
486
485
|
},
|