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 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.qweather.enable
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-rc2",
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
  }
@@ -33,4 +33,6 @@ if $custom = hexo-config('style.custom')
33
33
  for $inject_style in hexo-config('injects.style')
34
34
  @import $inject_style;
35
35
 
36
+ if $optimize = hexo-config('experiments.optimizeLongPosts')
37
+ @import "optimize.styl"
36
38
 
@@ -0,0 +1,6 @@
1
+ .md {
2
+ span:not(.katex), p, pre, li, a {
3
+ content-visibility: auto;
4
+ contain-intrinsic-size: auto 1em;
5
+ }
6
+ }
@@ -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();
@@ -104,7 +104,7 @@ const themeColorListener = function () {
104
104
  }
105
105
  };
106
106
  const visibilityListener = function () {
107
- let iconNode = $dom('[rel="icon"]');
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
- let winWidth = window.innerWidth;
291
- let winHeight = window.innerHeight;
292
- let menuWidth = menuElement.offsetWidth;
293
- let menuHeight = menuElement.offsetHeight;
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(".clickSubmenu", (submenu) => {
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
- const that = this;
109
- classNames.forEach(function (name) {
108
+ classNames.forEach((name) => {
110
109
  if (type === 'toggle') {
111
- that.classList.toggle(name, display);
110
+ this.classList.toggle(name, display);
112
111
  }
113
112
  else {
114
- that.classList[type](name);
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("abort!");
152
+ console.log('abort!');
154
153
  script.onload = null;
155
154
  script = undefined;
156
155
  if (!isAbort && callback)
@@ -555,7 +555,7 @@ const pjaxReload = function () {
555
555
  menuToggle.removeClass('close');
556
556
  });
557
557
  }
558
- let mainNode = $dom('#main');
558
+ const mainNode = $dom('#main');
559
559
  mainNode.innerHTML = '';
560
560
  mainNode.appendChild(loadCat.lastChild.cloneNode(true));
561
561
  pageScroll(0);
@@ -444,25 +444,24 @@ const mediaPlayer = function (t, config) {
444
444
  return this;
445
445
  },
446
446
  fetch: function () {
447
- const that = this;
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 (that.options.rawList) {
452
+ if (this.options.rawList) {
454
453
  const promises = [];
455
- that.options.rawList.forEach(function (raw, index) {
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
- that.group = false;
460
+ this.group = false;
462
461
  source = [raw];
463
462
  }
464
463
  else {
465
- that.group = true;
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
- that.mode();
482
+ this.mode();
484
483
  }
485
484
  });
486
485
  },