hexo-theme-shokax 0.2.0-rc1 → 0.2.0-rc3

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.
@@ -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-rc1",
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",
@@ -19,23 +19,22 @@
19
19
  "@types/jquery": "^3.5.16",
20
20
  "@types/js-yaml": "^4.0.5",
21
21
  "@types/lozad": "^1.16.1",
22
- "@types/node": "^18.14.1",
22
+ "@types/node": "^18.13.0",
23
23
  "@types/shelljs": "^0.8.11",
24
- "@typescript-eslint/eslint-plugin": "^5.53.0",
25
- "@typescript-eslint/parser": "^5.53.0",
24
+ "@typescript-eslint/eslint-plugin": "^5.51.0",
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",
30
31
  "eslint-plugin-n": "^15.6.1",
31
32
  "eslint-plugin-promise": "^6.1.1",
32
33
  "eslint-plugin-vue": "^9.9.0",
33
- "hexo-fs": "^4.1.1",
34
- "hexo-util": "^3.0.1",
35
34
  "typescript": "^4.9.5",
36
35
  "vue": "^3.2.47",
37
36
  "vuepress": "2.0.0-beta.60",
38
- "vuepress-plugin-sitemap2": "2.0.0-beta.181"
37
+ "vuepress-plugin-sitemap2": "2.0.0-beta.180"
39
38
  },
40
39
  "dependencies": {
41
40
  "js-yaml": "^4.1.0"
@@ -34,7 +34,7 @@ hexo.extend.generator.register('script', function (locals) {
34
34
  },
35
35
  loader: theme.loader,
36
36
  search: null,
37
- valine: theme.valine,
37
+ valine: theme.valine, // TODO 废弃属性
38
38
  outime: {
39
39
  enable: theme.outime.enable,
40
40
  days: theme.outime.days
@@ -16,7 +16,6 @@
16
16
  const fs = require('fs')
17
17
  const path = require('path')
18
18
  const yaml = require('js-yaml')
19
- // const url = require('url')
20
19
 
21
20
  function linkGrid (args, content) {
22
21
  const theme = hexo.theme.config
@@ -13,13 +13,21 @@
13
13
  img,
14
14
  .tabs,
15
15
  .links {
16
-
16
+ content-visibility: auto;
17
+ contain-intrinsic-size: 979px 1.1em;
17
18
  &:last-child {
18
19
  margin-bottom: 0;
19
20
  }
20
21
  }
21
22
 
23
+ span {
24
+ content-visibility: auto;
25
+ contain-intrinsic-size: 979px 1.1em;
26
+ }
27
+
22
28
  ul, dd, ol {
29
+ content-visibility: auto;
30
+ contain-intrinsic-size: 979px 3.5em;
23
31
  ul, ol {
24
32
  margin-top: 0;
25
33
  }
@@ -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
  },