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.
- package/CONTRIBUTING.md +1 -1
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/README_en-US.md +1 -1
- package/README_zh-Hant.md +1 -1
- package/SECURITY.md +1 -1
- package/_config.yml +16 -20
- package/languages/default.yml +173 -173
- package/layout/archive.pug +3 -1
- package/layout/category.pug +3 -1
- package/layout/includes/inject/body.pug +1 -1
- package/layout/includes/page/default.pug +1 -1
- package/layout/includes/page/links.pug +1 -1
- package/layout/includes/page/tlink.pug +1 -1
- package/layout/includes/rightmenu.pug +6 -5
- package/layout/includes/widgets/page/about/hobbies.pug +18 -17
- package/layout/includes/widgets/page/about/tenyear.pug +24 -25
- package/layout/includes/widgets/page/links/linksCard.pug +5 -2
- package/layout/includes/widgets/page/message/content.pug +1 -1
- package/layout/includes/widgets/third-party/hot/artalk.pug +56 -0
- package/layout/includes/widgets/third-party/hot/twikoo.pug +57 -0
- package/layout/includes/widgets/third-party/pjax.pug +2 -1
- package/layout/index.pug +1 -1
- package/layout/post.pug +1 -1
- package/layout/tag.pug +2 -0
- package/package.json +1 -1
- package/plugins.yml +10 -10
- package/scripts/event/init.js +0 -1
- package/scripts/event/merge_config.js +14 -39
- package/scripts/event/welcome.js +11 -7
- package/scripts/filter/default.js +20 -21
- package/scripts/filter/lazyload.js +2 -4
- package/scripts/filter/randomPosts.js +14 -3
- package/scripts/helper/getArchiveLength.js +9 -11
- package/scripts/helper/related_post.js +56 -56
- package/scripts/tags/article.js +53 -15
- package/scripts/tags/tabs.js +37 -46
- package/source/css/_comments/comment.styl +4 -3
- package/source/css/_comments/twikoo.styl +6 -7
- package/source/css/_global/animation.styl +0 -15
- package/source/css/_global/index.styl +19 -19
- package/source/css/_highlight/highlight/diff.styl +13 -1
- package/source/css/_highlight/index.styl +2 -2
- package/source/css/_highlight/prismjs/diff.styl +13 -1
- package/source/css/_highlight/prismjs/index.styl +1 -1
- package/source/css/_highlight/prismjs/line-number.styl +1 -1
- package/source/css/_layout/article-container.styl +1 -1
- package/source/css/_layout/console.styl +1 -0
- package/source/css/_layout/recent-post.styl +2 -2
- package/source/css/_page/_about/about.styl +1 -1
- package/source/css/_page/_about/game.styl +2 -17
- package/source/css/_page/error.styl +2 -3
- package/source/css/_page/links.styl +2 -2
- package/source/css/_page/other.styl +1 -0
- package/source/css/_page/says.styl +4 -3
- package/source/css/_tags/gallery.styl +1 -1
- package/source/css/_tags/tabs.styl +2 -2
- package/source/img/error_load.avif +0 -0
- package/source/js/covercolor/api.js +29 -14
- package/source/js/covercolor/ave.js +38 -24
- package/source/js/covercolor/local.js +60 -52
- package/source/js/main.js +253 -248
- package/source/js/music.js +21 -39
- package/source/js/right_menu.js +64 -127
- package/source/js/third_party/barrage.min.js +93 -1
- package/source/js/third_party/envelope.min.js +1 -1
- package/source/js/third_party/post_ai.min.js +184 -1
- package/source/js/tw_cn.js +17 -16
- package/source/js/utils.js +50 -57
- package/layout/includes/widgets/home/hot/artalk.pug +0 -45
- package/layout/includes/widgets/home/hot/twikoo.pug +0 -46
- package/source/img/loading.avif +0 -0
- /package/layout/includes/widgets/{home → third-party}/hot/index.pug +0 -0
@@ -1,11 +1,10 @@
|
|
1
1
|
#about-page
|
2
|
-
.author-content-item.game
|
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-
|
46
|
-
border-bottom-left-radius 8px
|
45
|
+
border-radius 8px 0 0 8px
|
47
46
|
background-color var(--efu-main)
|
48
|
-
background-position center
|
47
|
+
background-position center
|
49
48
|
background-size cover
|
50
49
|
|
51
50
|
+maxWidth768()
|
@@ -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
|
84
|
-
top
|
85
|
-
right
|
84
|
+
position absolute
|
85
|
+
top 0
|
86
|
+
right 0
|
86
87
|
|
87
88
|
div
|
88
89
|
&.bber-content
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
|
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
|
-
|
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
|
3
|
-
if (
|
4
|
-
setThemeColors(
|
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
|
-
|
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
|
-
|
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
|
18
|
-
.then(response =>
|
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
|
31
|
-
document.documentElement.style.setProperty('--efu-main-op-deep', value
|
32
|
-
document.documentElement.style.setProperty('--efu-main-none', value
|
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
|
-
|
58
|
-
|
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
|
3
|
-
if (
|
4
|
-
setThemeColors(
|
5
|
-
|
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
|
14
|
-
|
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 =>
|
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
|
-
|
22
|
-
setThemeColors(
|
23
|
-
cacheColor(src,
|
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
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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) =>
|
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
|
-
|
55
|
-
|
56
|
-
|
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
|
3
|
-
if (
|
4
|
-
|
5
|
-
return;
|
2
|
+
const pageColor = PAGE_CONFIG.color || document.getElementById("post-cover")?.src;
|
3
|
+
if (pageColor) {
|
4
|
+
return localColor(pageColor);
|
6
5
|
}
|
7
|
-
|
8
|
-
path ? localColor(path) : setDefaultThemeColors();
|
6
|
+
setDefaultThemeColors();
|
9
7
|
}
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
+
}
|