hexo-theme-shokax 0.2.0-rc2 → 0.2.0-rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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-rc3",
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",
@@ -14,12 +14,17 @@
14
14
  .tabs,
15
15
  .links {
16
16
  content-visibility: auto;
17
- contain-intrinsic-size: 979px 1.2em;
17
+ contain-intrinsic-size: 979px 1.1em;
18
18
  &:last-child {
19
19
  margin-bottom: 0;
20
20
  }
21
21
  }
22
22
 
23
+ span {
24
+ content-visibility: auto;
25
+ contain-intrinsic-size: 979px 1.1em;
26
+ }
27
+
23
28
  ul, dd, ol {
24
29
  content-visibility: auto;
25
30
  contain-intrinsic-size: 979px 3.5em;
@@ -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
  },