hexo-theme-solitude 2.1.6 → 2.1.8

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.
Files changed (73) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/README_en-US.md +1 -1
  5. package/README_zh-Hant.md +1 -1
  6. package/SECURITY.md +1 -1
  7. package/_config.yml +16 -20
  8. package/languages/default.yml +173 -173
  9. package/layout/archive.pug +3 -1
  10. package/layout/category.pug +3 -1
  11. package/layout/includes/inject/body.pug +1 -1
  12. package/layout/includes/page/default.pug +1 -1
  13. package/layout/includes/page/links.pug +1 -1
  14. package/layout/includes/page/tlink.pug +1 -1
  15. package/layout/includes/rightmenu.pug +6 -5
  16. package/layout/includes/widgets/page/about/hobbies.pug +18 -17
  17. package/layout/includes/widgets/page/about/tenyear.pug +24 -25
  18. package/layout/includes/widgets/page/links/linksCard.pug +5 -2
  19. package/layout/includes/widgets/page/message/content.pug +1 -1
  20. package/layout/includes/widgets/third-party/hot/artalk.pug +56 -0
  21. package/layout/includes/widgets/third-party/hot/twikoo.pug +57 -0
  22. package/layout/includes/widgets/third-party/pjax.pug +2 -1
  23. package/layout/index.pug +1 -1
  24. package/layout/post.pug +1 -1
  25. package/layout/tag.pug +2 -0
  26. package/package.json +1 -1
  27. package/plugins.yml +10 -10
  28. package/scripts/event/init.js +0 -1
  29. package/scripts/event/merge_config.js +14 -39
  30. package/scripts/event/welcome.js +11 -7
  31. package/scripts/filter/default.js +20 -21
  32. package/scripts/filter/lazyload.js +2 -4
  33. package/scripts/filter/randomPosts.js +14 -3
  34. package/scripts/helper/getArchiveLength.js +9 -11
  35. package/scripts/helper/related_post.js +56 -56
  36. package/scripts/tags/article.js +53 -15
  37. package/scripts/tags/tabs.js +37 -46
  38. package/source/css/_comments/comment.styl +4 -3
  39. package/source/css/_comments/twikoo.styl +6 -7
  40. package/source/css/_global/animation.styl +0 -15
  41. package/source/css/_global/index.styl +19 -19
  42. package/source/css/_highlight/highlight/diff.styl +13 -1
  43. package/source/css/_highlight/index.styl +2 -2
  44. package/source/css/_highlight/prismjs/diff.styl +13 -1
  45. package/source/css/_highlight/prismjs/index.styl +1 -1
  46. package/source/css/_highlight/prismjs/line-number.styl +1 -1
  47. package/source/css/_layout/article-container.styl +1 -1
  48. package/source/css/_layout/console.styl +1 -0
  49. package/source/css/_layout/recent-post.styl +2 -2
  50. package/source/css/_page/_about/about.styl +1 -1
  51. package/source/css/_page/_about/game.styl +2 -17
  52. package/source/css/_page/error.styl +2 -3
  53. package/source/css/_page/links.styl +2 -2
  54. package/source/css/_page/other.styl +1 -0
  55. package/source/css/_page/says.styl +4 -3
  56. package/source/css/_tags/gallery.styl +1 -1
  57. package/source/css/_tags/tabs.styl +2 -2
  58. package/source/img/error_load.avif +0 -0
  59. package/source/js/covercolor/api.js +29 -14
  60. package/source/js/covercolor/ave.js +38 -24
  61. package/source/js/covercolor/local.js +60 -52
  62. package/source/js/main.js +253 -248
  63. package/source/js/music.js +21 -39
  64. package/source/js/right_menu.js +64 -127
  65. package/source/js/third_party/barrage.min.js +93 -1
  66. package/source/js/third_party/envelope.min.js +1 -1
  67. package/source/js/third_party/post_ai.min.js +184 -1
  68. package/source/js/tw_cn.js +17 -16
  69. package/source/js/utils.js +50 -57
  70. package/layout/includes/widgets/home/hot/artalk.pug +0 -45
  71. package/layout/includes/widgets/home/hot/twikoo.pug +0 -46
  72. package/source/img/loading.avif +0 -0
  73. /package/layout/includes/widgets/{home → third-party}/hot/index.pug +0 -0
@@ -30,7 +30,7 @@ if "motto" in $about
30
30
  @import "buff"
31
31
  @import "maxim"
32
32
 
33
- if "game1" in $about
33
+ if "game" in $about
34
34
  @import "game"
35
35
 
36
36
  if "personalities" in $about
@@ -1,11 +1,10 @@
1
1
  #about-page
2
- .author-content-item.game-apex
2
+ .author-content-item.game
3
3
  min-height 300px
4
4
  overflow hidden
5
5
  color var(--efu-white)
6
6
 
7
7
  &::after
8
- box-shadow 0 -69px 203px 11px #04120f inset
9
8
  position absolute
10
9
  content ''
11
10
  width 100%
@@ -22,18 +21,4 @@
22
21
  z-index 2
23
22
  display flex
24
23
  flex-direction column
25
- padding 1rem 2rem
26
-
27
- .author-content-item.game-jl
28
- min-height 300px
29
- overflow hidden
30
- color var(--efu-white)
31
-
32
- &::after
33
- box-shadow 0 -69px 203px 11px #415dc9 inset
34
- position absolute
35
- content ''
36
- width 100%
37
- height 100%
38
- top 0
39
- left 0
24
+ padding 1rem 2rem
@@ -42,10 +42,9 @@
42
42
  flex 1 1 0
43
43
  height 100%
44
44
  width 600px
45
- border-top-left-radius 8px
46
- border-bottom-left-radius 8px
45
+ border-radius 8px 0 0 8px
47
46
  background-color var(--efu-main)
48
- background-position center center
47
+ background-position center
49
48
  background-size cover
50
49
 
51
50
  +maxWidth768()
@@ -19,10 +19,10 @@
19
19
  opacity 1
20
20
  backdrop-filter saturate(180%) blur(20px)
21
21
 
22
- .flink#article-container
22
+ .flink.article-container
23
23
  margin-top 1rem
24
24
 
25
- #article-container
25
+ .article-container
26
26
 
27
27
  .flink-desc
28
28
  margin 0
@@ -214,6 +214,7 @@ div#banners
214
214
  .card-content
215
215
  position absolute
216
216
  width 100%
217
+ z-index 2
217
218
  height 100%
218
219
  top 0
219
220
  left 0
@@ -29,6 +29,7 @@ if hexo-config('says.home_mini')
29
29
  background var(--efu-background)
30
30
  border none
31
31
  padding 0 .2rem
32
+
32
33
  i.bber-logo,
33
34
  i.bber-gotobb
34
35
  transition .3s
@@ -80,9 +81,9 @@ if hexo-config('says.enable')
80
81
  opacity .6
81
82
 
82
83
  .goComment
83
- position: absolute
84
- top: 0
85
- right: 0
84
+ position absolute
85
+ top 0
86
+ right 0
86
87
 
87
88
  div
88
89
  &.bber-content
@@ -1,4 +1,4 @@
1
- #article-container
1
+ .article-container
2
2
  figure.gallery-group
3
3
  position: relative
4
4
  overflow: hidden
@@ -1,5 +1,5 @@
1
1
 
2
- #article-container .tabs
2
+ .article-container .tabs
3
3
  position relative
4
4
  border 1px solid var(--tab-border-color)
5
5
 
@@ -91,7 +91,7 @@
91
91
  .tab-item-content
92
92
  background var(--efu-card-bg)
93
93
 
94
- #article-container .tabs
94
+ .article-container .tabs
95
95
 
96
96
  > .tab-contents .tab-item-content.active
97
97
  animation tabshow 0s
Binary file
@@ -1,35 +1,47 @@
1
1
  const coverColor = () => {
2
- const page_color = PAGE_CONFIG.color
3
- if (page_color){
4
- setThemeColors(page_color);
2
+ const pageColor = PAGE_CONFIG.color;
3
+ if (pageColor) {
4
+ setThemeColors(pageColor);
5
5
  return;
6
6
  }
7
+
7
8
  const path = document.getElementById("post-cover")?.src;
8
- path ? handleApiColor(path) : setDefaultThemeColors();
9
+ if (path) {
10
+ handleApiColor(path);
11
+ } else {
12
+ setDefaultThemeColors();
13
+ }
9
14
  }
10
15
 
11
16
  function handleApiColor(path) {
12
17
  const cacheGroup = JSON.parse(localStorage.getItem('Solitude')) || {};
13
- cacheGroup.postcolor && cacheGroup.postcolor[path] ? setThemeColors(cacheGroup.postcolor[path].value) : img2color(path);
18
+ if (cacheGroup.postcolor?.[path]) {
19
+ setThemeColors(cacheGroup.postcolor[path].value);
20
+ } else {
21
+ img2color(path);
22
+ }
14
23
  }
15
24
 
16
25
  function img2color(src) {
17
- fetch(coverColorConfig.api + encodeURIComponent(src))
18
- .then(response => response.json())
26
+ fetch(`${coverColorConfig.api}${encodeURIComponent(src)}`)
27
+ .then(response => {
28
+ if (!response.ok) throw new Error('Network response was not ok');
29
+ return response.json();
30
+ })
19
31
  .then(data => {
20
32
  setThemeColors(data.RGB);
21
33
  cacheColor(src, data.RGB);
22
34
  })
23
- .catch(console.error);
35
+ .catch(error => console.error('Error fetching color:', error));
24
36
  }
25
37
 
26
38
  function setThemeColors(value) {
27
39
  if (value) {
28
40
  const [r, g, b] = value.match(/\w\w/g).map(x => parseInt(x, 16));
29
41
  document.documentElement.style.setProperty('--efu-main', value);
30
- document.documentElement.style.setProperty('--efu-main-op', value + '23');
31
- document.documentElement.style.setProperty('--efu-main-op-deep', value + 'dd');
32
- document.documentElement.style.setProperty('--efu-main-none', value + '00');
42
+ document.documentElement.style.setProperty('--efu-main-op', `${value}23`);
43
+ document.documentElement.style.setProperty('--efu-main-op-deep', `${value}dd`);
44
+ document.documentElement.style.setProperty('--efu-main-none', `${value}00`);
33
45
  adjustBrightness(r, g, b);
34
46
  document.getElementById("coverdiv").classList.add("loaded");
35
47
  initThemeColor();
@@ -49,13 +61,16 @@ function setDefaultThemeColors() {
49
61
  function cacheColor(src, color) {
50
62
  const cacheGroup = JSON.parse(localStorage.getItem('Solitude')) || {};
51
63
  cacheGroup.postcolor = cacheGroup.postcolor || {};
52
- cacheGroup.postcolor[src] = {value: color, expiration: Date.now() + coverColorConfig.time};
64
+ cacheGroup.postcolor[src] = { value: color, expiration: Date.now() + coverColorConfig.time };
53
65
  localStorage.setItem('Solitude', JSON.stringify(cacheGroup));
54
66
  }
55
67
 
56
68
  function adjustBrightness(r, g, b) {
57
- if (Math.round(((r * 299) + (g * 587) + (b * 114)) / 1000) < 125) {
58
- [...document.getElementsByClassName('card-content')].forEach(item => item.style.setProperty('--efu-card-bg', 'var(--efu-white)'));
69
+ const brightness = Math.round(((r * 299) + (g * 587) + (b * 114)) / 1000);
70
+ if (brightness < 125) {
71
+ [...document.getElementsByClassName('card-content')].forEach(item => {
72
+ item.style.setProperty('--efu-card-bg', 'var(--efu-white)');
73
+ });
59
74
  [...document.getElementsByClassName('author-info__sayhi')].forEach(item => {
60
75
  item.style.setProperty('background', 'var(--efu-white-op)');
61
76
  item.style.setProperty('color', 'var(--efu-white)');
@@ -1,38 +1,49 @@
1
1
  const coverColor = () => {
2
- const page_color = PAGE_CONFIG.color
3
- if (page_color){
4
- setThemeColors(page_color);
5
- return;
2
+ const pageColor = PAGE_CONFIG.color;
3
+ if (pageColor) {
4
+ setThemeColors(pageColor);
5
+ } else {
6
+ const path = document.getElementById("post-cover")?.src;
7
+ path ? handleApiColor(path) : setDefaultThemeColors();
6
8
  }
7
- const path = document.getElementById("post-cover")?.src;
8
- path ? handleApiColor(path) : setDefaultThemeColors();
9
9
  }
10
10
 
11
11
  const handleApiColor = (path) => {
12
- const cacheGroup = JSON.parse(localStorage.getItem('Solitude')) || {};
13
- const color = cacheGroup.postcolor?.[path]?.value;
14
- color ? setThemeColors(color) : img2color(path);
12
+ const cacheGroup = JSON.parse(localStorage.getItem('Solitude')) || { postcolor: {} };
13
+ const color = cacheGroup.postcolor[path]?.value;
14
+ if (color) {
15
+ setThemeColors(color);
16
+ } else {
17
+ img2color(path);
18
+ }
15
19
  }
16
20
 
17
21
  const img2color = (src) => {
18
22
  fetch(`${src}?imageAve`)
19
- .then(response => response.json())
23
+ .then(response => {
24
+ if (!response.ok) throw new Error('Network response was not ok');
25
+ return response.json();
26
+ })
20
27
  .then(({ RGB }) => {
21
- RGB = `#${RGB.slice(2)}`;
22
- setThemeColors(RGB);
23
- cacheColor(src, RGB);
28
+ const formattedRGB = `#${RGB.slice(2)}`;
29
+ setThemeColors(formattedRGB);
30
+ cacheColor(src, formattedRGB);
24
31
  })
25
- .catch(console.error);
32
+ .catch(error => console.error('Error fetching color:', error));
26
33
  }
27
34
 
28
35
  const setThemeColors = (value) => {
29
36
  if (!value) return setDefaultThemeColors();
30
37
  const [r, g, b] = value.match(/\w\w/g).map(x => parseInt(x, 16));
31
- const [main, op, opDeep, none] = [`${value}`, `${value}23`, `${value}dd`, `${value}00`];
32
- document.documentElement.style.setProperty('--efu-main', main);
33
- document.documentElement.style.setProperty('--efu-main-op', op);
34
- document.documentElement.style.setProperty('--efu-main-op-deep', opDeep);
35
- document.documentElement.style.setProperty('--efu-main-none', none);
38
+ const themeColors = {
39
+ main: value,
40
+ op: `${value}23`,
41
+ opDeep: `${value}dd`,
42
+ none: `${value}00`
43
+ };
44
+ Object.entries(themeColors).forEach(([key, color]) => {
45
+ document.documentElement.style.setProperty(`--efu-${key}`, color);
46
+ });
36
47
  adjustBrightness(r, g, b);
37
48
  document.getElementById("coverdiv").classList.add("loaded");
38
49
  initThemeColor();
@@ -40,7 +51,9 @@ const setThemeColors = (value) => {
40
51
 
41
52
  const setDefaultThemeColors = () => {
42
53
  const vars = ['--efu-theme', '--efu-theme-op', '--efu-theme-op-deep', '--efu-theme-none'];
43
- vars.forEach((varName, i) => document.documentElement.style.setProperty(['--efu-main', '--efu-main-op', '--efu-main-op-deep', '--efu-main-none'][i], `var(${varName})`));
54
+ vars.forEach((varName, i) => {
55
+ document.documentElement.style.setProperty(['--efu-main', '--efu-main-op', '--efu-main-op-deep', '--efu-main-none'][i], `var(${varName})`);
56
+ });
44
57
  initThemeColor();
45
58
  }
46
59
 
@@ -51,10 +64,11 @@ const cacheColor = (src, color) => {
51
64
  }
52
65
 
53
66
  const adjustBrightness = (r, g, b) => {
54
- if (Math.round(((r * 299) + (g * 587) + (b * 114)) / 1000) < 125) {
55
- document.querySelectorAll('.card-content').forEach(item =>
56
- item.style.setProperty('--efu-card-bg', 'var(--efu-white)')
57
- );
67
+ const brightness = Math.round(((r * 299) + (g * 587) + (b * 114)) / 1000);
68
+ if (brightness < 125) {
69
+ document.querySelectorAll('.card-content').forEach(item => {
70
+ item.style.setProperty('--efu-card-bg', 'var(--efu-white)');
71
+ });
58
72
  document.querySelectorAll('.author-info__sayhi').forEach(item => {
59
73
  item.style.setProperty('background', 'var(--efu-white-op)');
60
74
  item.style.setProperty('color', 'var(--efu-white)');
@@ -1,75 +1,83 @@
1
1
  const coverColor = () => {
2
- const page_color = PAGE_CONFIG.color
3
- if (page_color){
4
- setThemeColors(page_color);
5
- return;
2
+ const pageColor = PAGE_CONFIG.color || document.getElementById("post-cover")?.src;
3
+ if (pageColor) {
4
+ return localColor(pageColor);
6
5
  }
7
- const path = document.getElementById("post-cover")?.src;
8
- path ? localColor(path) : setDefaultThemeColors();
6
+ setDefaultThemeColors();
9
7
  }
10
8
 
11
- function setDefaultThemeColors() {
12
- document.documentElement.style.setProperty('--efu-main', 'var(--efu-theme)');
13
- document.documentElement.style.setProperty('--efu-main-op', 'var(--efu-theme-op)');
14
- document.documentElement.style.setProperty('--efu-main-op-deep', 'var(--efu-theme-op-deep)');
15
- document.documentElement.style.setProperty('--efu-main-none', 'var(--efu-theme-none)');
9
+ const setDefaultThemeColors = () => {
10
+ const themeVars = {
11
+ '--efu-main': 'var(--efu-theme)',
12
+ '--efu-main-op': 'var(--efu-theme-op)',
13
+ '--efu-main-op-deep': 'var(--efu-theme-op-deep)',
14
+ '--efu-main-none': 'var(--efu-theme-none)'
15
+ };
16
+ Object.entries(themeVars).forEach(([key, value]) => {
17
+ document.documentElement.style.setProperty(key, value);
18
+ });
16
19
  initThemeColor();
17
20
  }
18
21
 
19
22
  const localColor = path => {
20
- var colorThief = new ColorThief();
23
+ const colorThief = new ColorThief();
21
24
  const img = new Image();
22
25
  img.crossOrigin = "Anonymous";
23
- img.onload = () => setThemeColors(rgbToHex(colorThief.getColor(img)));
26
+ img.onload = () => setThemeColors(rgbToHex(colorThief.getColor(img)), ...colorThief.getColor(img));
24
27
  img.onerror = () => console.error('Image Error');
25
28
  img.src = path;
26
29
  }
27
30
 
28
31
  const rgbToHex = ([r, g, b]) => {
29
- const hex = '#' + [r, g, b].map(x => {
30
- const component = Math.floor(x * 0.8);
31
- const hexValue = component.toString(16);
32
- return hexValue.length === 1 ? '0' + hexValue : hexValue;
33
- }).join('');
34
- return hex;
32
+ return '#' + [r, g, b].map(x => {
33
+ const component = Math.floor(x * 0.8);
34
+ return component.toString(16).padStart(2, '0');
35
+ }).join('');
35
36
  }
36
37
 
37
- function setThemeColors(value, r = null, g = null, b = null) {
38
- if (value) {
39
- document.documentElement.style.setProperty('--efu-main', value);
40
- document.documentElement.style.setProperty('--efu-main-op', value + '23');
41
- document.documentElement.style.setProperty('--efu-main-op-deep', value + 'dd');
42
- document.documentElement.style.setProperty('--efu-main-none', value + '00');
38
+ const setThemeColors = (value, r = null, g = null, b = null) => {
39
+ if (!value) return setDefaultThemeColors();
43
40
 
44
- if (r && g && b) {
45
- let brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
46
- if (brightness < 125) {
47
- let cardContents = document.getElementsByClassName('card-content');
48
- for (let i = 0; i < cardContents.length; i++) {
49
- cardContents[i].style.setProperty('--efu-card-bg', 'var(--efu-white)');
50
- }
41
+ const themeColors = {
42
+ '--efu-main': value,
43
+ '--efu-main-op': value + '23',
44
+ '--efu-main-op-deep': value + 'dd',
45
+ '--efu-main-none': value + '00'
46
+ };
47
+ Object.entries(themeColors).forEach(([key, color]) => {
48
+ document.documentElement.style.setProperty(key, color);
49
+ });
51
50
 
52
- let authorInfo = document.getElementsByClassName('author-info__sayhi');
53
- for (let i = 0; i < authorInfo.length; i++) {
54
- authorInfo[i].style.setProperty('background', 'var(--efu-white-op)');
55
- authorInfo[i].style.setProperty('color', 'var(--efu-white)');
56
- }
57
-
58
- value = LightenDarkenColor(value, 50);
59
- document.documentElement.style.setProperty('--efu-main', value);
60
- document.documentElement.style.setProperty('--efu-main-op', value + '23');
61
- document.documentElement.style.setProperty('--efu-main-op-deep', value + 'dd');
62
- document.documentElement.style.setProperty('--efu-main-none', value + '00');
63
- }
51
+ if (r && g && b) {
52
+ const brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
53
+ if (brightness < 125) {
54
+ adjustCardStyles();
55
+ value = LightenDarkenColor(value, 50);
56
+ setThemeColors(value);
64
57
  }
58
+ }
59
+
60
+ document.getElementById("coverdiv").classList.add("loaded");
61
+ initThemeColor();
62
+ }
65
63
 
66
- document.getElementById("coverdiv").classList.add("loaded");
67
- initThemeColor();
68
- } else {
69
- document.documentElement.style.setProperty('--efu-main', 'var(--efu-theme)');
70
- document.documentElement.style.setProperty('--efu-main-op', 'var(--efu-theme-op)');
71
- document.documentElement.style.setProperty('--efu-main-op-deep', 'var(--efu-theme-op-deep)');
72
- document.documentElement.style.setProperty('--efu-main-none', 'var(--efu-theme-none)');
73
- initThemeColor();
64
+ function LightenDarkenColor(col, amt) {
65
+ var usePound = false;
66
+ if (col[0] === "#") {
67
+ col = col.slice(1);
68
+ usePound = true;
74
69
  }
75
70
  }
71
+
72
+ const adjustCardStyles = () => {
73
+ const cardContents = document.getElementsByClassName('card-content');
74
+ Array.from(cardContents).forEach(item => {
75
+ item.style.setProperty('--efu-card-bg', 'var(--efu-white)');
76
+ });
77
+
78
+ const authorInfo = document.getElementsByClassName('author-info__sayhi');
79
+ Array.from(authorInfo).forEach(item => {
80
+ item.style.setProperty('background', 'var(--efu-white-op)');
81
+ item.style.setProperty('color', 'var(--efu-white)');
82
+ });
83
+ }