hexo-theme-shokax 0.3.8 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 公告
2
+ [关于ShokaX markdown扩展特性的讨论](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/177) \
3
+ [关于删除部分评论系统的讨论](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/175)
1
4
  # hexo-theme-shokaX
2
5
  ![LICENSE]( https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
3
6
  ![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
@@ -77,10 +80,13 @@ AGPL许可证主要目的是限制修改后的分发行为,避免未经许可
77
80
  | hexo-theme-shoka | amehime | 本项目的父主题 |
78
81
 
79
82
  ## 开发者们
80
- [![](https://contributors-img.web.app/image?repo=theme-shoka-x/hexo-theme-shokaX)](https://github.com/theme-shoka-x/hexo-theme-shokaX/graphs/contributors)
83
+ Hexo 主题: \
84
+ [![](https://contributors-img.web.app/image?repo=theme-shoka-x/hexo-theme-shokaX)](https://github.com/theme-shoka-x/hexo-theme-shokaX/graphs/contributors) \
85
+ ShokaX 文档: \
86
+ [![](https://contributors-img.web.app/image?repo=theme-shoka-x/shokaX-docs)](https://github.com/theme-shoka-x/shokaX-docs/graphs/contributors) \
81
87
 
82
88
  ## 特别鸣谢
83
89
  [<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" width="25%">](https://jb.gg/OpenSourceSupport)
84
90
 
85
91
  ## 其他信息
86
- ![Star history chart](https://api.star-history.com/svg?repos=theme-shoka-x/hexo-theme-shokaX&type=Date)
92
+ ![Star history chart](https://api.star-history.com/svg?repos=theme-shoka-x/hexo-theme-shokaX&type=Date)
package/_config.yml CHANGED
@@ -183,29 +183,6 @@ waline:
183
183
  pageSize: 10 # 每页评论条数
184
184
  pageview: false # 是否开启浏览量统计,可独立开启
185
185
 
186
- # https://github.com/gitalk/gitalk/blob/master/readme-cn.md
187
- gitalk:
188
- clientID:
189
- clientSecret:
190
- repo:
191
- owner:
192
- admin:
193
- proxy: # 选填
194
-
195
- # https://giscus.app/zh-CN
196
- giscus:
197
- repo:
198
- repoId:
199
- category:
200
- categoryId:
201
- mapping:
202
- strict:
203
- reactionsEnabled:
204
- emitMetadata:
205
- inputPosition:
206
- commentTheme:
207
- lang:
208
-
209
186
  summary:
210
187
  enable: false
211
188
  introduce: "我是基于ChatGPT-turbo-3.5实现的AI助手,在此网站上负责整理和概括文章" # AI自我介绍
@@ -1,6 +1,6 @@
1
1
  mixin CommentRender()
2
2
  != shokax_inject('comment')
3
- - var tk = theme?.twikoo?.enable,wl = theme?.waline?.enable,gt=theme?.gitalk?.enable,gs=theme?.giscus?.enable
3
+ - var tk = theme?.twikoo?.enable,wl = theme?.waline?.enable
4
4
  if page.comment !== false && !theme.experiments.disableThemeComment
5
5
  if tk
6
6
  div(class="wrap" id="tcomments")
@@ -37,38 +37,5 @@ mixin CommentRender()
37
37
  dark: 'html[data-theme="dark"]'
38
38
  });
39
39
  }, 1000)
40
- else if gt
41
- div(class="wrap" id="gtcomments")
42
- script(type="text/javascript" data-pjax).
43
- const gproxy = theme.gitalk.proxy || undefined
44
- const gitalk = new Gitalk({
45
- clientID: '#{theme.gitalk.clientID}',
46
- clientSecret: '#{theme.gitalk.clientSecret}',
47
- repo: '#{theme.gitalk.repo}',
48
- owner: '#{theme.gitalk.owner}',
49
- admin: #{theme.gitalk.admin},
50
- id: location.pathname, // Ensure uniqueness and length less than 50
51
- distractionFreeMode: false, // Facebook-like distraction free mode
52
- proxy: "#{gproxy}"
53
- });
54
- gitalk.render("gtcomments")
55
- else if gs
56
- div(class="wrap giscus" id="gscomments")
57
- script( src="https://giscus.app/client.js"
58
- data-repo="#{theme.giscus.repo}"
59
- data-repo-id="#{theme.giscus.repoId}"
60
- data-category="#{theme.giscus.category}"
61
- data-category-id="#{theme.giscus.categoryId}"
62
- data-mapping="#{theme.giscus.mapping}"
63
- data-strict="#{theme.giscus.strict}"
64
- data-reactions-enabled="#{theme.giscus.reactionsEnabled}"
65
- data-emit-metadata="#{theme.giscus.emitMetadata}"
66
- data-input-position="#{theme.giscus.inputPosition}"
67
- data-theme="#{theme.giscus.commentTheme}"
68
- data-lang="#{theme.giscus.lang}"
69
- data-loading="lazy"
70
- crossorigin="anonymous"
71
- async
72
- )
73
40
 
74
41
 
@@ -11,7 +11,7 @@ mixin SMRender(item)
11
11
  div(class="cover" style=`background: linear-gradient(to bottom right, ${random_color()}, ${random_color()});`)
12
12
  else
13
13
  div(class="cover")
14
- != _url(link1, '<img data-src="'+ _cover_index(item) +'" alt="article cover">', {itemprop: 'url', title: postText})
14
+ != _url(link1, '<img data-src="'+ _cover(item) +'" alt="article cover">', {itemprop: 'url', title: postText})
15
15
  div(class="info")
16
16
  +PMRender(item)
17
17
  h3
@@ -3,7 +3,7 @@
3
3
  - var siteTitle = config.title,noBaiduT = theme?.seo?.disable_baidu_transformation
4
4
  - var feedLink = full_url_for("/feed.json")
5
5
  - var tk= theme?.twikoo?.enable
6
- - var wl = theme.waline.enable,gt=theme?.gitalk?.enable
6
+ - var wl = theme.waline.enable
7
7
  meta(charset="UTF-8")
8
8
  meta(name="viewport" content="width=device-width,initial-scale=1,maximum-scale=2")
9
9
  meta(name="theme-color" content="#222")
@@ -54,9 +54,6 @@ if tk
54
54
  script(src=theme.twikoo.link)
55
55
  else if wl
56
56
  link(rel="stylesheet" href="https://unpkg.com/@waline/client@v2/dist/waline.css")
57
- else if gt
58
- link(rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css")
59
- script(src="https://unpkg.com/gitalk/dist/gitalk.min.js")
60
57
 
61
58
  - var qw = theme?.qweather?.enable
62
59
  if qw
@@ -2,7 +2,7 @@ include ../_mixin/breadcrumb.pug
2
2
  include ../_mixin/sidebar.pug
3
3
  include ../_mixin/widgets.pug
4
4
 
5
- - var ignores = []
5
+ - ignores = []
6
6
  if (theme.quicklink.ignores)
7
7
  - ignores.push(theme.quicklink.ignores)
8
8
 
@@ -40,7 +40,7 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
40
40
  - var coverImage = theme.experiments.fixedCover || "https://7ed.net/bing/api"
41
41
  img(src=coverImage)
42
42
  else
43
- - var covers = _cover(page, 6)
43
+ - var covers = _cover_index(page, 6)
44
44
  if covers.length === 6
45
45
  ul
46
46
  each image in covers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
@@ -18,30 +18,31 @@
18
18
  "@types/js-yaml": "^4.0.9",
19
19
  "@types/lozad": "^1.16.4",
20
20
  "@types/mocha": "^10.0.6",
21
- "@types/node": "^20.10.0",
22
- "@typescript-eslint/eslint-plugin": "^6.12.0",
23
- "@typescript-eslint/parser": "^6.12.0",
21
+ "@types/node": "^20.10.6",
22
+ "@typescript-eslint/eslint-plugin": "^6.17.0",
23
+ "@typescript-eslint/parser": "^6.17.0",
24
24
  "chai": "^4.3.10",
25
- "eslint": "^8.54.0",
25
+ "eslint": "^8.56.0",
26
26
  "eslint-config-standard": "~17",
27
27
  "eslint-plugin-chai-friendly": "^0.7.2",
28
- "eslint-plugin-import": "^2.29.0",
29
- "eslint-plugin-n": "^16.3.1",
28
+ "eslint-plugin-import": "^2.29.1",
29
+ "eslint-plugin-n": "^16.6.1",
30
30
  "eslint-plugin-promise": "^6.1.1",
31
- "eslint-plugin-vue": "^9.18.1",
31
+ "eslint-plugin-vue": "^9.19.2",
32
32
  "hexo-fs": "^4.1.1",
33
33
  "hexo-util": "^3.1.0",
34
- "instantsearch.js": "^4.60.0",
34
+ "instantsearch.js": "^4.63.0",
35
+ "jsdom": "^23.1.0",
35
36
  "mocha": "^10.2.0",
36
- "typescript": "^5.3.2",
37
- "vue": "^3.3.9",
38
- "jsdom": "^23.0.0"
37
+ "typescript": "^5.3.3",
38
+ "vue": "^3.4.5"
39
39
  },
40
40
  "dependencies": {
41
- "esbuild": "^0.19.7",
41
+ "esbuild": "^0.19.11",
42
+ "hexo": "^7.0.0",
42
43
  "js-yaml": "^4.1.0",
43
44
  "lozad": "^1.16.0",
44
- "theme-shokax-anime": "^0.0.4",
45
+ "theme-shokax-anime": "^0.0.6",
45
46
  "theme-shokax-pjax": "^0.0.2"
46
47
  },
47
48
  "engines": {
@@ -30,7 +30,7 @@ hexo.extend.filter.register('before_generate', () => {
30
30
  hexo.theme.config.style[style] = path_1.default.resolve(hexo.base_dir, custom_file);
31
31
  }
32
32
  }
33
- if (data.images && data.images.length >= 6) {
33
+ if (data.images && data.images.length > 0) {
34
34
  hexo.theme.config.image_list = data.images;
35
35
  }
36
36
  else {
@@ -15,7 +15,7 @@ hexo.extend.generator.register('index', function (locals) {
15
15
  let pages;
16
16
  const config = hexo.config;
17
17
  const sticky = locals.posts.find({ sticky: true }).sort(config.index_generator.order_by);
18
- const posts = locals.posts.find({ sticky: { $exists: false } }).sort(config.index_generator.order_by);
18
+ const posts = locals.posts.find({ sticky: { $in: [false, undefined] } }).sort(config.index_generator.order_by);
19
19
  const paginationDir = config.pagination_dir || 'page';
20
20
  const path = config.index_generator.path || '';
21
21
  const categories = locals.categories;
@@ -96,7 +96,8 @@ hexo.extend.generator.register('index', function (locals) {
96
96
  data: {
97
97
  __index: true,
98
98
  catlist,
99
- sticky
99
+ sticky,
100
+ current: 1,
100
101
  }
101
102
  }];
102
103
  }
@@ -1,16 +1,17 @@
1
- 'use strict';
2
- hexo.extend.generator.register('pages', function (locals) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ hexo.extend.generator.register('pages', function () {
3
4
  const config = hexo.config;
4
5
  return [
5
6
  {
6
7
  path: config.category_dir + '/index.html',
7
8
  data: { type: 'categories' },
8
- layout: ['page']
9
+ layout: 'page'
9
10
  },
10
11
  {
11
12
  path: config.tag_dir + '/index.html',
12
13
  data: { type: 'tags' },
13
- layout: ['page']
14
+ layout: 'page'
14
15
  }
15
16
  ];
16
17
  });
@@ -27,8 +27,11 @@ const randomBG = function (count = 1, image_server = null, image_list = []) {
27
27
  }
28
28
  };
29
29
  if (count && count > 1) {
30
- const shuffled = image_list.slice(0);
31
- i = image_list.length;
30
+ let shuffled = image_list.slice(0);
31
+ while (shuffled.length <= 6) {
32
+ shuffled = shuffled.concat(image_list.slice(0));
33
+ }
34
+ i = shuffled.length;
32
35
  const min = i - count;
33
36
  let temp;
34
37
  let index;
@@ -1,6 +1,4 @@
1
1
  'use strict';
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs = require("hexo-fs");
4
2
  const prepareQuery = (categories, parent) => {
5
3
  const query = {
6
4
  parent: undefined
@@ -47,32 +45,6 @@ hexo.extend.helper.register('_list_categories', function (depth = 0) {
47
45
  };
48
46
  return hierarchicalList(0);
49
47
  });
50
- hexo.extend.helper.register('_categories', function () {
51
- const categories = this.site.categories;
52
- if (!categories || !categories.length)
53
- return '';
54
- const pangu = {
55
- spacing: data => {
56
- return data;
57
- }
58
- };
59
- const result = {};
60
- categories.forEach((cat, i) => {
61
- const child = prepareQuery(categories, cat._id);
62
- const cover = 'source/_posts' + cat.path.replace(this.config.category_dir, '') + 'cover.jpg';
63
- if (fs.existsSync(cover)) {
64
- const className = cat.slug.split('/');
65
- className.pop();
66
- cat.class = className.join(' ');
67
- cat.name = pangu.spacing(cat.name);
68
- if (child.length !== 0) {
69
- cat.child = child;
70
- }
71
- result[cat._id] = cat;
72
- }
73
- });
74
- return result;
75
- });
76
48
  hexo.extend.helper.register('_category_prev', function (name) {
77
49
  const categories = this.site.categories;
78
50
  if (!categories || !categories.length)
@@ -1,6 +1,6 @@
1
1
  let findProblem = false;
2
2
  hexo.on('generateBefore', function () {
3
- if (hexo.config.highlight.enable || hexo.config.prismjs.enable) {
3
+ if (hexo.config.syntax_highlighter) {
4
4
  findProblem = true;
5
5
  hexo.log.error('[SXEC 101] Highlight.js or Prismjs enabled. The code block will render incomplete');
6
6
  }
@@ -18,7 +18,7 @@ Some features will be disabled or render incorrectly`);
18
18
  hexo.log.warn('[SXEC 201] Essential information(title, desc, lang, etc) config incorrectly, Page will render incorrectly');
19
19
  }
20
20
  if (hexo.theme.config.gitalk.clientID || hexo.theme.config.giscus.repo) {
21
- hexo.log.info('You are using an untested feature and there may be undiscovered issues');
21
+ hexo.log.warn('You are using an deprecated feature and it was removed in the v0.3.10');
22
22
  }
23
23
  });
24
24
  hexo.on('generateAfter', function () {
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+ "use strict";
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
@@ -14,47 +14,29 @@ function linkGrid(args, content) {
14
14
  if (args[0]) {
15
15
  const filepath = node_path_1.default.join(hexo.source_dir, args[0]);
16
16
  if (node_fs_1.default.existsSync(filepath)) {
17
- content = node_fs_1.default.readFileSync(filepath);
17
+ content = node_fs_1.default.readFileSync(filepath, { encoding: 'utf-8' });
18
18
  }
19
19
  }
20
20
  if (!content) {
21
21
  return;
22
22
  }
23
- const siteHost = new URL(hexo.config.url).hostname || hexo.config.url;
24
23
  const list = js_yaml_1.default.load(content);
25
24
  let result = '';
26
25
  list.forEach((item) => {
27
26
  if (!item.url || !item.site) {
28
27
  return;
29
28
  }
30
- let urlparam = {
31
- protocol: undefined,
32
- hostname: undefined
33
- };
34
- if (item.url) {
35
- urlparam = new URL(item.url, hexo.config.url);
36
- }
37
29
  let item_image = item.image || theme.assets + '/404.png';
38
30
  if (!item_image.startsWith('//') && !item_image.startsWith('http')) {
39
31
  item_image = theme.statics + item_image;
40
32
  }
41
33
  item.color = item.color ? ` style="--block-color:${item.color};"` : '';
42
34
  result += `<div class="item" title="${item.owner || item.site}"${item.color}>`;
43
- if (urlparam.protocol && urlparam.hostname !== siteHost) {
44
- const durl = Buffer.from(item.url).toString('base64');
45
- result += `<span class="image" data-url="${durl}" data-background-image="${item_image}"></span>
46
- <div class="info">
47
- <span class="title" data-url="${durl}">${item.site}</span>
48
- <p class="desc">${item.desc || item.url}</p>
49
- </div></div>`;
50
- }
51
- else {
52
- result += `<a href="${item.url}" class="image" data-background-image="${item_image}"></a>
53
- <div class="info">
54
- <a href="${item.url}" class="title">${item.site}</a>
55
- <p class="desc">${item.desc || item.url}</p>
56
- </div></div>`;
57
- }
35
+ result += `<a href="${item.url}" class="image" data-background-image="${item_image}"></a>
36
+ <div class="info">
37
+ <a href="${item.url}" class="title">${item.site}</a>
38
+ <p class="desc">${item.desc || item.url}</p>
39
+ </div></div>`;
58
40
  });
59
41
  return `<div class="links">${result}</div>`;
60
42
  }
@@ -9,7 +9,7 @@ const canvasEl = document.createElement('canvas');
9
9
  canvasEl.style.cssText = 'position:fixed;top:0;left:0;pointer-events:none;z-index:9999999';
10
10
  document.body.appendChild(canvasEl);
11
11
  const ctx = canvasEl.getContext('2d');
12
- const numberOfParticules = 30;
12
+ const numberOfParticles = 30;
13
13
  let pointerX = 0;
14
14
  let pointerY = 0;
15
15
  const tap = 'click';
@@ -25,7 +25,7 @@ function updateCoords(e) {
25
25
  pointerX = e.clientX || (e.touches && e.touches[0].clientX);
26
26
  pointerY = e.clientY || (e.touches && e.touches[0].clientY);
27
27
  }
28
- function setParticuleDirection(p) {
28
+ function setParticleDirection(p) {
29
29
  const angle = theme_shokax_anime_1.default.random(0, 360) * Math.PI / 180;
30
30
  const value = theme_shokax_anime_1.default.random(50, 180);
31
31
  const radius = [-1, 1][theme_shokax_anime_1.default.random(0, 1)] * value;
@@ -34,7 +34,7 @@ function setParticuleDirection(p) {
34
34
  y: p.y + radius * Math.sin(angle)
35
35
  };
36
36
  }
37
- function createParticule(x, y) {
37
+ function createParticle(x, y) {
38
38
  const p = {
39
39
  x,
40
40
  y,
@@ -50,7 +50,7 @@ function createParticule(x, y) {
50
50
  };
51
51
  p.color = colors[theme_shokax_anime_1.default.random(0, colors.length - 1)];
52
52
  p.radius = theme_shokax_anime_1.default.random(16, 32);
53
- p.endPos = setParticuleDirection(p);
53
+ p.endPos = setParticleDirection(p);
54
54
  return p;
55
55
  }
56
56
  function createCircle(x, y) {
@@ -74,22 +74,22 @@ function createCircle(x, y) {
74
74
  };
75
75
  return p;
76
76
  }
77
- function renderParticule(targets) {
77
+ function renderParticle(targets) {
78
78
  for (const target of targets) {
79
79
  target.draw();
80
80
  }
81
81
  }
82
- function animateParticules(x, y) {
82
+ function animateParticles(x, y) {
83
83
  const circle = createCircle(x, y);
84
- const particules = [];
85
- for (let i = 0; i < numberOfParticules; i++) {
86
- particules.push(createParticule(x, y));
84
+ const particles = [];
85
+ for (let i = 0; i < numberOfParticles; i++) {
86
+ particles.push(createParticle(x, y));
87
87
  }
88
88
  (0, theme_shokax_anime_1.default)().timeline().add({
89
- targets: particules,
89
+ targets: particles,
90
90
  duration: theme_shokax_anime_1.default.random(1200, 1800),
91
91
  easing: 'easeOutExpo',
92
- update: renderParticule,
92
+ update: renderParticle,
93
93
  x: p => p.endPos.x,
94
94
  y: p => p.endPos.y,
95
95
  radius: 0.1
@@ -97,7 +97,7 @@ function animateParticules(x, y) {
97
97
  targets: circle,
98
98
  duration: theme_shokax_anime_1.default.random(1200, 1800),
99
99
  easing: 'easeOutExpo',
100
- update: renderParticule,
100
+ update: renderParticle,
101
101
  radius: theme_shokax_anime_1.default.random(80, 160),
102
102
  lineWidth: 0,
103
103
  alpha: {
@@ -133,7 +133,7 @@ function initFireworks() {
133
133
  }
134
134
  render.play();
135
135
  updateCoords(e);
136
- animateParticules(pointerX, pointerY);
136
+ animateParticles(pointerX, pointerY);
137
137
  }, false);
138
138
  setCanvasSize();
139
139
  window.addEventListener('resize', setCanvasSize, false);
@@ -81,7 +81,7 @@ const transition = (target, type, complete, begin) => {
81
81
  };
82
82
  exports.transition = transition;
83
83
  const pageScroll = (target, offset, complete) => {
84
- const opt = {
84
+ (0, theme_shokax_anime_1.default)({
85
85
  targets: typeof offset === 'number' && typeof target !== 'number' ? target.parentNode : document.scrollingElement,
86
86
  duration: 500,
87
87
  easing: 'easeInOutQuad',
@@ -89,7 +89,6 @@ const pageScroll = (target, offset, complete) => {
89
89
  complete() {
90
90
  complete && complete();
91
91
  }
92
- };
93
- (0, theme_shokax_anime_1.default)(opt).play();
92
+ }).play();
94
93
  };
95
94
  exports.pageScroll = pageScroll;