hexo-theme-solitude 1.4.1 → 1.4.2
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/_config.yml +55 -0
- package/languages/en-US.yml +2 -1
- package/languages/zh-CN.yml +2 -1
- package/layout/includes/console.pug +4 -0
- package/layout/includes/head/config.pug +1 -1
- package/layout/includes/inject/body.pug +6 -5
- package/layout/includes/keyboard.pug +65 -0
- package/layout/includes/layout.pug +4 -0
- package/layout/includes/page/album.pug +56 -0
- package/layout/includes/page/gallery.pug +11 -0
- package/layout/includes/page/links.pug +2 -0
- package/layout/includes/page/moment.pug +28 -0
- package/layout/includes/widgets/page/moments/angle.pug +19 -0
- package/layout/includes/widgets/page/says/local.pug +1 -1
- package/layout/includes/widgets/third-party/search/algolia-search.pug +20 -15
- package/layout/includes/widgets/third-party/search/local-search.pug +3 -0
- package/layout/page.pug +6 -0
- package/package.json +1 -1
- package/plugins.yml +6 -2
- package/source/css/_global/index.styl +1 -5
- package/source/css/_layout/basic.styl +0 -1
- package/source/css/_mode/index.styl +6 -1
- package/source/css/_page/gallery/index.styl +96 -0
- package/source/css/_page/index.styl +5 -1
- package/source/css/_page/moment.styl +4 -2
- package/source/css/_widgets/_comment/twikoo.styl +20 -17
- package/source/css/_widgets/_mixins/keyboard.styl +59 -0
- package/source/css/_widgets/_search/algolia-search.styl +37 -16
- package/source/css/_widgets/_search/local-search.styl +18 -2
- package/source/css/_widgets/_tags/link.styl +1 -1
- package/source/css/_widgets/index.styl +4 -0
- package/source/css/index.styl +0 -1
- package/source/js/covercolor/api.js +10 -6
- package/source/js/covercolor/local.js +88 -13
- package/source/js/main.js +15 -1
- package/source/js/search/algolia.js +4 -2
- package/source/js/search/local.js +3 -1
- package/source/js/utils.js +1 -1
- package/source/img/avatar.png +0 -0
package/_config.yml
CHANGED
@@ -468,6 +468,27 @@ capsule:
|
|
468
468
|
server: netease # 播放列表的服务商。netease:网易云 / tencent:腾讯 / kugou:酷狗 / xiami:小米 / baidu:百度 : Music service provider. netease: Netease Cloud / tencent: Tencent / kugou: Kugou / xiaomi: Xiaomi / baidu: Baidu
|
469
469
|
type: playlist # 播放列表的类型。song:单曲 / playlist:歌单 / album:专辑 / artist:歌手 : Type of playlist. song: Single / playlist: Playlist / album: Album / artist: Singer
|
470
470
|
|
471
|
+
# 友链鱼塘
|
472
|
+
# Links fish pond
|
473
|
+
moments:
|
474
|
+
enable: false # 是否开启鱼塘 / Whether to enable fish pond
|
475
|
+
api: # https://blog.wzsco.top/circle/ # api地址 / api address
|
476
|
+
error_img: https://bu.dusays.com/2023/11/08/654af68b25bb8.jpg # 加载失败显示图片 / Loading failed display image
|
477
|
+
sort_rule: created # 排序规则:created:按创建时间排序 / updated:按更新时间排序 : Sort rule: created: Sort by creation time / updated: Sort by update time
|
478
|
+
expire_days: 1 # 缓存过期时间(天),默认为1天 / Cache expiration time (days), default is 1 day
|
479
|
+
page_init_number: 10 # 页面初始化加载数量,默认为10条 / Page initialization loading quantity, default is 10
|
480
|
+
page_turning_number: 5 # 页面翻页加载数量,默认为5条 / Page turning loading quantity, default is 5
|
481
|
+
angle: true # 鱼塘随机文章 / Fish pond random article
|
482
|
+
appjs: https://cdn.cbd.int/solitude-source@1.0.3/js/fcircle.min.js # 鱼塘js / Fish pond js
|
483
|
+
bundlejs: https://cdn.cbd.int/solitude-source/js/moment/bundle.min.js # 鱼塘js / Fish pond js
|
484
|
+
randompostjs: https://cdn.cbd.int/solitude-source/js/moment/random_post.min.js # 鱼塘js / Fish pond js
|
485
|
+
|
486
|
+
# 相册
|
487
|
+
# album
|
488
|
+
album:
|
489
|
+
enable: false # 是否开启相册 / Whether to enable album
|
490
|
+
limit: 6 # 单行显示图片数量 / Number of pictures displayed in a single line
|
491
|
+
|
471
492
|
# -------------------------
|
472
493
|
# 文章页、页面配置
|
473
494
|
# post、page settings
|
@@ -542,6 +563,35 @@ post:
|
|
542
563
|
api: https://img2color.wzsco.top/api?img= # api地址 / api address
|
543
564
|
time: 43200000 # api取色间隔(毫秒),默认为12小时 / api color interval (milliseconds), default is 12 hours
|
544
565
|
|
566
|
+
keyboard:
|
567
|
+
enable: false # 是否开启键盘控制 / Whether to enable keyboard control
|
568
|
+
# 键盘控制配置
|
569
|
+
# Keyboard control configuration
|
570
|
+
list:
|
571
|
+
# name: 按键名称
|
572
|
+
# name: Key name
|
573
|
+
# key: 按键
|
574
|
+
# key: Key
|
575
|
+
# func: 方法
|
576
|
+
# func: Function
|
577
|
+
# sco: sco内置方法
|
578
|
+
# sco: sco built-in method
|
579
|
+
# url: 跳转链接
|
580
|
+
# url: Jump link
|
581
|
+
# - name: 关闭快捷键功能
|
582
|
+
# key: K
|
583
|
+
# func: keyboard
|
584
|
+
# - name: 打开中控台
|
585
|
+
# key: A
|
586
|
+
# sco: showConsole
|
587
|
+
# - name: 播放/暂停音乐
|
588
|
+
# key: M
|
589
|
+
# sco: musicToggle
|
590
|
+
# - name: 打开友情链接
|
591
|
+
# key: L
|
592
|
+
# url: '/links/'
|
593
|
+
|
594
|
+
|
545
595
|
# -------------------------
|
546
596
|
# 自定义主题
|
547
597
|
|
@@ -722,6 +772,11 @@ search:
|
|
722
772
|
enable: false
|
723
773
|
# algolia, local
|
724
774
|
type: algolia
|
775
|
+
# 推荐标签
|
776
|
+
# Recommended tags
|
777
|
+
tags:
|
778
|
+
# - Solitude
|
779
|
+
# - Hexo
|
725
780
|
algolia:
|
726
781
|
# hits:
|
727
782
|
# per_page: 6
|
package/languages/en-US.yml
CHANGED
@@ -71,7 +71,7 @@ search:
|
|
71
71
|
|
72
72
|
head:
|
73
73
|
noscript: Please enable JavaScript to view the site
|
74
|
-
console: 'Program: Hexo | Theme: Hexo-Theme-Solitude | Author: WangZhuoSco、YiFeng | Github: https://github.com/DuoSco/Hexo-theme-solitude | Version: v1.4.
|
74
|
+
console: 'Program: Hexo | Theme: Hexo-Theme-Solitude | Author: WangZhuoSco、YiFeng | Github: https://github.com/DuoSco/Hexo-theme-solitude | Version: v1.4.2 😄'
|
75
75
|
|
76
76
|
aside:
|
77
77
|
postcount: 'Posts :'
|
@@ -93,6 +93,7 @@ console:
|
|
93
93
|
tag_title: Find interesting areas
|
94
94
|
switch_darkmode: Day and night switching
|
95
95
|
switch_hideAside: Sidebar display control
|
96
|
+
switch_keyboard: Keyboard operation
|
96
97
|
switch_music: Music switch
|
97
98
|
archive_unit: Posts
|
98
99
|
|
package/languages/zh-CN.yml
CHANGED
@@ -70,7 +70,7 @@ search:
|
|
70
70
|
|
71
71
|
head:
|
72
72
|
noscript: 开启JavaScript才能访问本站哦~
|
73
|
-
console: '程序:Hexo | 主题:Hexo-Theme-Solitude | 作者:王卓Sco、亦封 | Github: https://github.com/DuoSco/Hexo-theme-solitude | 版本:v1.4.
|
73
|
+
console: '程序:Hexo | 主题:Hexo-Theme-Solitude | 作者:王卓Sco、亦封 | Github: https://github.com/DuoSco/Hexo-theme-solitude | 版本:v1.4.2 😄'
|
74
74
|
|
75
75
|
aside:
|
76
76
|
postcount: '文章总数 :'
|
@@ -92,6 +92,7 @@ console:
|
|
92
92
|
tag_title: 寻找感兴趣的领域
|
93
93
|
switch_darkmode: 昼夜切换
|
94
94
|
switch_hideAside: 边栏显示控制
|
95
|
+
switch_keyboard: 键盘快捷键
|
95
96
|
switch_music: 音乐开关
|
96
97
|
archive_unit: 篇
|
97
98
|
|
@@ -30,6 +30,10 @@ div#console
|
|
30
30
|
div.console-btn-item#consoleHideAside
|
31
31
|
a.asideSwitch(onclick="sco.switchHideAside()", title=_p('console.switch_hideAside'), href="javascript:void(0);")
|
32
32
|
i.scoicon.sco-side-bar-fill
|
33
|
+
if theme.keyboard.enable
|
34
|
+
div.console-btn-item#consoleKeyboard(onclick="sco.switchKeyboard()")
|
35
|
+
a.keyboardSwitch(title=_p('console.switch_keyboard'), href="javascript:void(0);")
|
36
|
+
i.scoicon.sco-keyboard-box-fill
|
33
37
|
if theme.capsule.enable
|
34
38
|
div.console-btn-item#consoleMusic(onclick="sco.musicToggle()")
|
35
39
|
a.music-switch(title=_p('console.switch_music'), href="javascript:void(0);")
|
@@ -3,6 +3,9 @@
|
|
3
3
|
div
|
4
4
|
script(src=url_for(theme.cdn.main))
|
5
5
|
|
6
|
+
if theme.album.enable
|
7
|
+
script(src=url_for(theme.cdn.macy_js))
|
8
|
+
|
6
9
|
mixin katex
|
7
10
|
link(rel="stylesheet", href=url_for(theme.cdn.katex))
|
8
11
|
if theme.katex.copytex
|
@@ -84,11 +87,6 @@ div
|
|
84
87
|
if theme.music.enable
|
85
88
|
script(src=url_for(theme.cdn.music_js))
|
86
89
|
|
87
|
-
// gallery
|
88
|
-
if theme.gallery
|
89
|
-
script(src=url_for(theme.cdn.fj_gallery))
|
90
|
-
link(rel="stylesheet", href=url_for(theme.cdn.fj_gallery_css))
|
91
|
-
|
92
90
|
// pace 胶囊加载条(Capsule loading bar)
|
93
91
|
if theme.loading.pace
|
94
92
|
script(src=url_for(theme.cdn.pace_js))
|
@@ -108,6 +106,9 @@ div
|
|
108
106
|
!= item
|
109
107
|
|
110
108
|
div#js-pjax
|
109
|
+
if page.type === 'album' && theme.album.enable
|
110
|
+
script.
|
111
|
+
initGallery()
|
111
112
|
if page.type === 'says' && theme.says.enable
|
112
113
|
script.
|
113
114
|
window.addEventListener('resize', utils.throttle(function () {
|
@@ -0,0 +1,65 @@
|
|
1
|
+
- const list = theme.keyboard.list || []
|
2
|
+
#keyboard-tips
|
3
|
+
.keyboardTitle= '博客快捷键'
|
4
|
+
.keyboardList
|
5
|
+
each item in list
|
6
|
+
.keyboardItem
|
7
|
+
.keyGroup
|
8
|
+
.key= 'Shift'
|
9
|
+
.key= item.key
|
10
|
+
.keyContent
|
11
|
+
.content= item.name
|
12
|
+
script.
|
13
|
+
const keyboard_addKeyup = (e) => {
|
14
|
+
if (e.key === 'Shift') {
|
15
|
+
document.getElementById('keyboard-tips').classList.remove('show');
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
const keyboard_addKeydown = (e) => {
|
20
|
+
const keyboards = !{JSON.stringify(list)};
|
21
|
+
if (e.keyCode === 16) {
|
22
|
+
document.getElementById('keyboard-tips').classList.add('show');
|
23
|
+
}
|
24
|
+
|
25
|
+
for (let i = 0; i < keyboards.length; i++) {
|
26
|
+
if (keyboards[i].url) {
|
27
|
+
if (keyboards[i].url.startsWith('http')) {
|
28
|
+
if (e.key === keyboards[i].key) {
|
29
|
+
window.open(keyboards[i].url);
|
30
|
+
}
|
31
|
+
} else {
|
32
|
+
if (e.key === keyboards[i].key) {
|
33
|
+
pjax.loadUrl(keyboards[i].url);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
} else if (keyboards[i].sco) {
|
37
|
+
if (e.key === keyboards[i].key) {
|
38
|
+
sco[keyboards[i].sco]();
|
39
|
+
}
|
40
|
+
} else if (keyboards[i].func) {
|
41
|
+
if (e.key === keyboards[i].key) {
|
42
|
+
window[keyboards[i].func]();
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
function openKeyboard() {
|
49
|
+
|
50
|
+
window.addEventListener('keyup', keyboard_addKeyup);
|
51
|
+
|
52
|
+
window.addEventListener('keydown', keyboard_addKeydown);
|
53
|
+
}
|
54
|
+
function closeKeyboard() {
|
55
|
+
|
56
|
+
window.removeEventListener('keyup', keyboard_addKeyup);
|
57
|
+
|
58
|
+
window.removeEventListener('keydown', keyboard_addKeydown);
|
59
|
+
}
|
60
|
+
|
61
|
+
var sco_keyboards = localStorage.getItem('keyboard') === 'true'
|
62
|
+
if (sco_keyboards) {
|
63
|
+
openKeyboard();
|
64
|
+
document.getElementById('consoleKeyboard').classList.add('on');
|
65
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
include ../widgets/page/banner
|
2
|
+
|
3
|
+
- var gallery = site.data.gallery.gallery
|
4
|
+
- var album = gallery.find(item => item.album = page.album)
|
5
|
+
- var {limit} = theme.album
|
6
|
+
|
7
|
+
if album
|
8
|
+
#album
|
9
|
+
#sco-container
|
10
|
+
if album.json
|
11
|
+
script.
|
12
|
+
function initGallery() {
|
13
|
+
let macy = Macy({ container: '#sco-container', trueOrder: false, waitForImages: true, margin: 5, columns: !{limit}, breakAt: { 1200: 5, 940: 3, 520: 2, 400: 1 }})
|
14
|
+
macy.runOnImageLoad(function () {
|
15
|
+
setTimeout(function () {
|
16
|
+
GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".sco-gallery-item img"));
|
17
|
+
macy.recalculate(true)
|
18
|
+
}, 500);
|
19
|
+
}, true)
|
20
|
+
}
|
21
|
+
(async function () {
|
22
|
+
await fetch('!{url_for(album.json)}')
|
23
|
+
.then(res => res.json())
|
24
|
+
.then(data => {
|
25
|
+
let html = ''
|
26
|
+
data = data.sort((a, b) => b.date - a.date)
|
27
|
+
data.forEach(item => {
|
28
|
+
html += `
|
29
|
+
<div class="sco-gallery-item">
|
30
|
+
<span class="locate">${item.locate}</span>
|
31
|
+
<img class="sco-gallery-image" src="${item.image}" alt="${item.content}">
|
32
|
+
</div>
|
33
|
+
`
|
34
|
+
})
|
35
|
+
document.querySelector('#sco-container').innerHTML = html
|
36
|
+
GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg();
|
37
|
+
initGallery()
|
38
|
+
})
|
39
|
+
})()
|
40
|
+
|
41
|
+
else
|
42
|
+
each item in album.items.sort((a, b) => b.date - a.date)
|
43
|
+
.sco-gallery-item
|
44
|
+
span.locate= item.locate
|
45
|
+
img.sco-gallery-image(src=item.image, alt=item.content)
|
46
|
+
script.
|
47
|
+
function initGallery(){
|
48
|
+
let macy = Macy({ container: '#sco-container', trueOrder: false, waitForImages: true, margin: 5, columns: !{limit}, breakAt: { 1200: 5, 940: 3, 520: 2, 400: 1 }})
|
49
|
+
macy.runOnImageLoad(function () {
|
50
|
+
setTimeout(function () {
|
51
|
+
GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".sco-gallery-item img"));
|
52
|
+
macy.recalculate(true)
|
53
|
+
}, 500);
|
54
|
+
}, true)
|
55
|
+
}
|
56
|
+
document.addEventListener('DOMContentLoaded', initGallery);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
include ../widgets/page/banner
|
2
|
+
|
3
|
+
- var gallery = site.data.gallery.gallery
|
4
|
+
|
5
|
+
if theme.album.enable && gallery
|
6
|
+
#gallery
|
7
|
+
each item in gallery
|
8
|
+
.gallery-item(onclick="pjax.loadUrl('/" + item.album + "/')")
|
9
|
+
img.cover(src=item.cover)
|
10
|
+
span.title= item.class_name
|
11
|
+
span.desc= item.descr
|
@@ -0,0 +1,28 @@
|
|
1
|
+
include ../widgets/page/banner
|
2
|
+
if theme.moments.angle
|
3
|
+
include ../widgets/page/moments/angle
|
4
|
+
|
5
|
+
.title-h2-a
|
6
|
+
.title-h2-a-left
|
7
|
+
h2(style="padding-top: 0;margin:0.6rem 0 0.6rem;") 🐟 鱼塘
|
8
|
+
.title-h2-a-right
|
9
|
+
span 以下内容自动生成,未经过审核
|
10
|
+
|
11
|
+
div#hexo-circle-of-friends-root
|
12
|
+
script.
|
13
|
+
let UserConfig = {
|
14
|
+
// 填写你的api地址
|
15
|
+
private_api_url: '!{theme.moments.api}',
|
16
|
+
// 默认加载文章数
|
17
|
+
page_init_number: !{theme.moments.page_init_number},
|
18
|
+
// 点击加载更多时,一次最多加载几篇文章,默认10
|
19
|
+
page_turning_number: !{theme.moments.page_turning_number},
|
20
|
+
// 头像加载失败时,默认头像地址
|
21
|
+
error_img: '!{theme.moments.error_img}',
|
22
|
+
// 进入页面时第一次的排序规则
|
23
|
+
sort_rule: '!{theme.moments.sort_rule}',
|
24
|
+
// 本地文章缓存数据过期时间(天)
|
25
|
+
expire_days: !{theme.moments.expire_days},
|
26
|
+
}
|
27
|
+
script(src=url_for(theme.moments.appjs))
|
28
|
+
script(src=url_for(theme.moments.bundlejs))
|
@@ -0,0 +1,19 @@
|
|
1
|
+
.title-h2-a
|
2
|
+
.title-h2-a-left
|
3
|
+
h2(style="padding-top: 0;margin:0.6rem 0 0.6rem;") 🎣 钓鱼
|
4
|
+
a#random-post-start(href="javascript:fetchRandomPost();", style="transition-duration: 0.3s; transform: rotate(63000deg); opacity: 1;", data-pjax-state="")
|
5
|
+
i.scoicon.sco-restart-line
|
6
|
+
.title-h2-a-right
|
7
|
+
if page.type !== 'links'
|
8
|
+
a.random-post-all(href="/links/", data-pjax-state="") 全部友链
|
9
|
+
|
10
|
+
#random-post
|
11
|
+
|
12
|
+
script.
|
13
|
+
var fdata = {
|
14
|
+
apiurl: "#{theme.moments.api}",
|
15
|
+
defaultFish: 100,
|
16
|
+
hungryFish: 100,
|
17
|
+
}
|
18
|
+
|
19
|
+
script(src=url_for(theme.moments.randompostjs))
|
@@ -26,7 +26,7 @@ each item in site.data.essay.essay_list.slice(0, theme.says.strip)
|
|
26
26
|
if item.video.player
|
27
27
|
video(src=item.video.player controls="controls" style="object-fit: cover;")
|
28
28
|
if item.video.bilibili
|
29
|
-
iframe(src='//player.bilibili.com/player.html?
|
29
|
+
iframe(src='//player.bilibili.com/player.html?auto-play=0&bvid=' + item.video.bilibili scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true")
|
30
30
|
|
31
31
|
if theme.says.style === 1
|
32
32
|
hr
|
@@ -1,15 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
#algolia-search
|
2
|
+
.search-dialog
|
3
|
+
.algolia-navbar
|
4
|
+
.search-dialog__title#algolia-search-title=__('nav.search')
|
5
|
+
.algolia-tips
|
6
|
+
i.scoicon.sco-algolia-fill
|
7
|
+
span.algolia-tips-text='Algolia'
|
8
|
+
span.search-close-button
|
9
|
+
i.scoicon.sco-close-fill
|
10
|
+
#algolia-input-panel
|
11
|
+
#algolia-search-input
|
12
|
+
#search-results
|
13
|
+
#algolia-hits
|
14
|
+
each tag in theme.search.tags || []
|
15
|
+
a.tag-list(href='/tags/' + tag + '/')=tag
|
16
|
+
|
17
|
+
#algolia-tips
|
18
|
+
#algolia-pagination
|
19
|
+
#algolia-stats
|
20
|
+
#search-mask
|
@@ -8,6 +8,9 @@
|
|
8
8
|
div.search-box
|
9
9
|
input.search-box-input#search-input(type="text", autocomplete="off", spellcheck="false", autocorrect="off", autocapitalize="off", placeholder=__('search.placeholder'))
|
10
10
|
div#search-results
|
11
|
+
#search-hits
|
12
|
+
each tag in theme.search.tags || []
|
13
|
+
a.tag-list(href='/tags/' + tag + '/')=tag
|
11
14
|
div#search-pagination
|
12
15
|
div#search-tips
|
13
16
|
div#search-mask
|
package/layout/page.pug
CHANGED
@@ -20,11 +20,17 @@ block content
|
|
20
20
|
include includes/page/equipment
|
21
21
|
when 'rss'
|
22
22
|
include includes/page/rss
|
23
|
+
when 'moment'
|
24
|
+
include includes/page/moment
|
23
25
|
when 'douban'
|
24
26
|
include includes/widgets/page/banner
|
25
27
|
include includes/page/default
|
26
28
|
when 'music'
|
27
29
|
include includes/page/music
|
30
|
+
when 'gallery'
|
31
|
+
include includes/page/gallery
|
32
|
+
when 'album'
|
33
|
+
include includes/page/album
|
28
34
|
default
|
29
35
|
include includes/page/default
|
30
36
|
if page.comment
|
package/package.json
CHANGED
package/plugins.yml
CHANGED
@@ -13,7 +13,7 @@ pjax:
|
|
13
13
|
twikoo:
|
14
14
|
name: twikoo
|
15
15
|
file: dist/twikoo.all.min.js
|
16
|
-
version: 1.6.
|
16
|
+
version: 1.6.31
|
17
17
|
waline_js:
|
18
18
|
name: '@waline/client'
|
19
19
|
file: dist/waline.js
|
@@ -106,4 +106,8 @@ fancyapps_ui:
|
|
106
106
|
fancyapps_css:
|
107
107
|
name: fancyapps-ui
|
108
108
|
file: dist/fancybox/fancybox.min.css
|
109
|
-
version: 5.0.33
|
109
|
+
version: 5.0.33
|
110
|
+
macy_js:
|
111
|
+
name: macy
|
112
|
+
file: dist/macy.min.js
|
113
|
+
version: 2.5.1
|
@@ -54,8 +54,4 @@
|
|
54
54
|
--card-box-shadow 0 3px 8px 6px rgba(7, 17, 27, 0.06)
|
55
55
|
--card-hover-box-shadow 0 3px 8px 6px rgba(7, 17, 27, 0.15)
|
56
56
|
--offset 0px
|
57
|
-
--hlscrollbar-bg #121212
|
58
|
-
|
59
|
-
+maxWidth768()
|
60
|
-
--style-border 0px solid var(--sco-none)
|
61
|
-
--style-border-hover 0px solid var(--sco-main)
|
57
|
+
--hlscrollbar-bg #121212
|
@@ -86,4 +86,9 @@
|
|
86
86
|
--style-border-forever 2px solid var(--sco-main)
|
87
87
|
--sco-navbg var(--sco-theme-op)
|
88
88
|
--sco-hl-bg $hl_bg_light
|
89
|
-
--sco-hltools-bg $hltools_bg_light
|
89
|
+
--sco-hltools-bg $hltools_bg_light
|
90
|
+
|
91
|
+
:root
|
92
|
+
+maxWidth768()
|
93
|
+
--style-border 0px solid var(--sco-none)
|
94
|
+
--style-border-hover 0px solid var(--sco-main)
|
@@ -0,0 +1,96 @@
|
|
1
|
+
#gallery
|
2
|
+
width 100%
|
3
|
+
display flex
|
4
|
+
flex-wrap wrap
|
5
|
+
justify-content start
|
6
|
+
padding 10px 0
|
7
|
+
|
8
|
+
.gallery-item
|
9
|
+
overflow hidden
|
10
|
+
border var(--style-border-always)
|
11
|
+
border-radius 12px
|
12
|
+
position relative
|
13
|
+
display flex
|
14
|
+
height 250px
|
15
|
+
width calc(100% / 3 - 10px)
|
16
|
+
cursor pointer
|
17
|
+
|
18
|
+
&:hover
|
19
|
+
.cover
|
20
|
+
filter brightness(0.5) blur(2px)
|
21
|
+
transition all .3s
|
22
|
+
|
23
|
+
.title::after
|
24
|
+
width 100%
|
25
|
+
transition all .3s
|
26
|
+
|
27
|
+
.desc
|
28
|
+
left 10%
|
29
|
+
transition left .35s
|
30
|
+
text-wrap unset
|
31
|
+
|
32
|
+
.cover
|
33
|
+
width 100%
|
34
|
+
object-fit cover
|
35
|
+
transition all 0.3s
|
36
|
+
|
37
|
+
.title
|
38
|
+
position absolute
|
39
|
+
top 10%
|
40
|
+
left 10%
|
41
|
+
font-weight 700
|
42
|
+
font-size 32px
|
43
|
+
color var(--sco-white)
|
44
|
+
|
45
|
+
&::after
|
46
|
+
top 55px
|
47
|
+
width 0
|
48
|
+
left 0
|
49
|
+
height 3px
|
50
|
+
background var(--sco-white)
|
51
|
+
content ""
|
52
|
+
border-radius 1px
|
53
|
+
position absolute
|
54
|
+
transition all .3s
|
55
|
+
|
56
|
+
.desc
|
57
|
+
position absolute
|
58
|
+
top 35%
|
59
|
+
left 100%
|
60
|
+
width 80%
|
61
|
+
color var(--sco-white)
|
62
|
+
font-size 1.1em
|
63
|
+
transition left .35s
|
64
|
+
letter-spacing 1px
|
65
|
+
text-wrap break-word
|
66
|
+
|
67
|
+
#album
|
68
|
+
margin 22px auto 0
|
69
|
+
|
70
|
+
.locate
|
71
|
+
display flex
|
72
|
+
position absolute
|
73
|
+
left 8px
|
74
|
+
top 8px
|
75
|
+
padding 4px 6px
|
76
|
+
border-radius 8px
|
77
|
+
background var(--sco-black-op)
|
78
|
+
font-size 12px
|
79
|
+
color var(--sco-white)
|
80
|
+
transition .3s
|
81
|
+
z-index 1
|
82
|
+
user-select none
|
83
|
+
|
84
|
+
#sco-container
|
85
|
+
margin-top 22px
|
86
|
+
|
87
|
+
.sco-gallery-item
|
88
|
+
margin-bottom 24px
|
89
|
+
overflow hidden
|
90
|
+
border-radius 8px
|
91
|
+
transition all .3s
|
92
|
+
|
93
|
+
.sco-gallery-image
|
94
|
+
width 100%
|
95
|
+
display block
|
96
|
+
height auto
|
@@ -10,7 +10,8 @@
|
|
10
10
|
|
11
11
|
@import "rss.styl"
|
12
12
|
|
13
|
-
|
13
|
+
if hexo-config('moments.enable')
|
14
|
+
@import "moment.styl"
|
14
15
|
|
15
16
|
if hexo-config('says.enable')
|
16
17
|
@import "says.styl"
|
@@ -21,6 +22,9 @@ if hexo-config('says.enable')
|
|
21
22
|
|
22
23
|
@import "links.styl"
|
23
24
|
|
25
|
+
if hexo-config('album.enable')
|
26
|
+
@import "gallery/index.styl"
|
27
|
+
|
24
28
|
@import "about/index.styl"
|
25
29
|
|
26
30
|
if hexo-config('music.enable')
|
@@ -150,7 +150,9 @@
|
|
150
150
|
width: fit-content
|
151
151
|
|
152
152
|
.cf-article .cf-img-avatar
|
153
|
-
border-radius 50%
|
153
|
+
border-radius 50% !important
|
154
|
+
right -30px!important
|
155
|
+
bottom -30px!important
|
154
156
|
|
155
157
|
#page
|
156
158
|
.title-h2-a
|
@@ -165,7 +167,7 @@
|
|
165
167
|
font-weight: 700
|
166
168
|
|
167
169
|
&:hover
|
168
|
-
color: var(--sco-
|
170
|
+
color: var(--sco-main)
|
169
171
|
|
170
172
|
.title-h2-a-left
|
171
173
|
display: flex
|
@@ -122,15 +122,15 @@
|
|
122
122
|
.el-button--primary
|
123
123
|
border-color var(--sco-fontcolor) !important
|
124
124
|
color var(--sco-card-bg) !important
|
125
|
-
border-radius
|
125
|
+
border-radius 12px !important
|
126
126
|
box-shadow var(--sco-shadow-black)
|
127
127
|
transition .3s
|
128
128
|
width 5rem
|
129
129
|
position absolute
|
130
|
-
top -
|
130
|
+
top -44px
|
131
131
|
right 0
|
132
132
|
margin-left .5rem !important
|
133
|
-
height
|
133
|
+
height 34px
|
134
134
|
|
135
135
|
.el-button--primary.is-disabled,
|
136
136
|
.el-button--primary.is-disabled:active,
|
@@ -140,15 +140,15 @@
|
|
140
140
|
|
141
141
|
.tk-row-actions-start
|
142
142
|
position absolute
|
143
|
-
top -
|
143
|
+
top -84px
|
144
144
|
left 17px
|
145
145
|
|
146
146
|
@media screen and (max-width: 768px)
|
147
147
|
.tk-submit
|
148
148
|
.el-button--primary
|
149
149
|
width 5rem
|
150
|
-
height
|
151
|
-
top -
|
150
|
+
height 122px
|
151
|
+
top -132px
|
152
152
|
|
153
153
|
.tk-row-actions-start
|
154
154
|
top -210px
|
@@ -169,14 +169,14 @@
|
|
169
169
|
margin-left 0 !important
|
170
170
|
|
171
171
|
.tk-row.actions
|
172
|
-
margin-bottom
|
172
|
+
margin-bottom 0 !important
|
173
173
|
margin-left 0 !important
|
174
|
-
margin-top
|
174
|
+
margin-top 0 !important
|
175
175
|
justify-content space-around !important
|
176
176
|
|
177
177
|
.tk-meta-input
|
178
178
|
position relative !important
|
179
|
-
margin-top
|
179
|
+
margin-top 8px
|
180
180
|
width calc(100% - 5.5rem)
|
181
181
|
|
182
182
|
.tk-content
|
@@ -224,12 +224,13 @@
|
|
224
224
|
|
225
225
|
.tk-comments-container
|
226
226
|
> .tk-comment
|
227
|
-
margin-top 0
|
228
|
-
margin-bottom .5rem
|
227
|
+
margin-top 0!important
|
228
|
+
margin-bottom 0.5rem!important
|
229
229
|
background var(--sco-card-bg)
|
230
230
|
transition .3s
|
231
231
|
border-radius 12px
|
232
|
-
padding
|
232
|
+
padding 0
|
233
|
+
padding-top 0.5rem
|
233
234
|
border none
|
234
235
|
border-top var(--style-border-dashed)
|
235
236
|
|
@@ -283,6 +284,7 @@
|
|
283
284
|
.tk-meta-input
|
284
285
|
.el-input
|
285
286
|
.el-input-group__prepend
|
287
|
+
box-shadow none
|
286
288
|
border-radius 12px 0 0 12px
|
287
289
|
-webkit-user-select none
|
288
290
|
|
@@ -302,7 +304,6 @@
|
|
302
304
|
.el-input
|
303
305
|
margin-left 0 !important
|
304
306
|
width 100% !important
|
305
|
-
margin-bottom 8px
|
306
307
|
|
307
308
|
.tk-icon
|
308
309
|
position absolute
|
@@ -322,6 +323,7 @@ img.tk-avatar-img
|
|
322
323
|
.el-input.el-input--small.el-input-group.el-input-group--prepend
|
323
324
|
border-radius 12px
|
324
325
|
background var(--sco-secondbg)
|
326
|
+
border var(--style-border-always)
|
325
327
|
|
326
328
|
.el-input.el-input--small.el-input-group.el-input-group--prepend:nth-child(1):before
|
327
329
|
content '输入QQ号会自动获取昵称和头像'
|
@@ -365,15 +367,16 @@ img.tk-avatar-img
|
|
365
367
|
.el-input-group__append, .el-input-group__prepend
|
366
368
|
background-color var(--sco-card-bg) !important
|
367
369
|
color var(--sco-fontcolor) !important
|
368
|
-
border
|
369
|
-
border var(--style-border-always) !important
|
370
|
+
border 0 !important
|
370
371
|
font-weight 700
|
371
372
|
|
372
373
|
.el-input__inner
|
373
374
|
background var(--sco-secondbg) !important
|
374
|
-
border
|
375
|
+
border 0 !important
|
375
376
|
color var(--sco-fontcolor) !important
|
376
377
|
padding-left 8px
|
378
|
+
height 32px
|
379
|
+
line-height 32px
|
377
380
|
border-radius 12px
|
378
381
|
|
379
382
|
.page
|
@@ -412,7 +415,7 @@ img.tk-avatar-img
|
|
412
415
|
border-radius 8px !important
|
413
416
|
|
414
417
|
.el-button:hover
|
415
|
-
background var(--sco-
|
418
|
+
background var(--sco-black) !important
|
416
419
|
color var(--sco-white) !important
|
417
420
|
|
418
421
|
.el-button.tk-preview
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#keyboard-tips
|
2
|
+
position fixed
|
3
|
+
top 80px
|
4
|
+
left 20px
|
5
|
+
z-index 999
|
6
|
+
background var(--sco-maskbgdeep)
|
7
|
+
border-radius 12px
|
8
|
+
border var(--style-border)
|
9
|
+
padding 20px
|
10
|
+
display flex
|
11
|
+
flex-direction column
|
12
|
+
backdrop-filter saturate(180%) blur(20px)
|
13
|
+
transform translateZ(0)
|
14
|
+
pointer-events none
|
15
|
+
box-shadow var(--sco-shadow-border)
|
16
|
+
opacity 0
|
17
|
+
transition .3s
|
18
|
+
|
19
|
+
&.show
|
20
|
+
opacity 1
|
21
|
+
transition .1s
|
22
|
+
|
23
|
+
.keyboardTitle
|
24
|
+
font-size 12px
|
25
|
+
color var(--sco-secondtext)
|
26
|
+
line-height 1
|
27
|
+
|
28
|
+
.keyboardList
|
29
|
+
display flex
|
30
|
+
flex-direction column
|
31
|
+
margin-top 8px
|
32
|
+
|
33
|
+
.keyboardItem
|
34
|
+
display flex
|
35
|
+
margin-top 4px
|
36
|
+
|
37
|
+
.keyGroup
|
38
|
+
display flex
|
39
|
+
align-items center
|
40
|
+
width 90px
|
41
|
+
|
42
|
+
.key
|
43
|
+
padding 0.2em 0.4em
|
44
|
+
font-family inherit
|
45
|
+
background-color var(--sco-card-bg)
|
46
|
+
color var(--sco-fontcolor)
|
47
|
+
border var(--style-border)
|
48
|
+
border-color var(--sco-secondtext)
|
49
|
+
border-bottom 2px solid var(--sco-secondtext)
|
50
|
+
box-shadow var(--sco-shadow-border)
|
51
|
+
border-radius 0.25rem
|
52
|
+
overflow-wrap break-word
|
53
|
+
overflow-x auto
|
54
|
+
font-weight 500
|
55
|
+
font-size .875em
|
56
|
+
margin-right 4px
|
57
|
+
vertical-align baseline
|
58
|
+
line-height 1
|
59
|
+
height 24px
|
@@ -12,10 +12,13 @@
|
|
12
12
|
border var(--style-border)
|
13
13
|
transition 0.3s
|
14
14
|
border-radius 8px
|
15
|
+
animation slide-in .6s ease 0s 1 normal none running
|
15
16
|
|
16
17
|
&:hover
|
17
18
|
border var(--style-border-hover)
|
18
19
|
box-shadow var(--sco-shadow-theme)
|
20
|
+
+maxWidth768()
|
21
|
+
border none
|
19
22
|
|
20
23
|
+maxWidth768()
|
21
24
|
top 0
|
@@ -23,20 +26,35 @@
|
|
23
26
|
margin 0
|
24
27
|
width 100%
|
25
28
|
height 100%
|
29
|
+
border 0
|
30
|
+
|
31
|
+
.algolia-navbar
|
32
|
+
display flex
|
33
|
+
align-items center
|
34
|
+
margin-bottom 8px
|
35
|
+
|
36
|
+
.algolia-tips
|
37
|
+
color var(--sco-secondtext)
|
38
|
+
right 0
|
39
|
+
margin-left auto
|
40
|
+
opacity .8
|
26
41
|
|
27
42
|
.search-close-button
|
28
|
-
|
29
|
-
top 0.8rem
|
30
|
-
right 1rem
|
31
|
-
color var(--sco-gray)
|
43
|
+
color var(--sco-secondtext)
|
32
44
|
font-size 1.4em
|
33
45
|
line-height 1
|
34
46
|
cursor pointer
|
35
|
-
|
47
|
+
padding 4px
|
48
|
+
border-radius 50px
|
49
|
+
margin-left 4px
|
50
|
+
transition .3s
|
36
51
|
|
37
52
|
&:hover
|
38
53
|
color var(--sco-main)
|
39
54
|
|
55
|
+
.algolia-tips-text
|
56
|
+
margin-left .4rem
|
57
|
+
|
40
58
|
#algolia-input-panel
|
41
59
|
margin-bottom 8px
|
42
60
|
|
@@ -65,7 +83,7 @@
|
|
65
83
|
visibility hidden
|
66
84
|
|
67
85
|
#search-results
|
68
|
-
padding 8px
|
86
|
+
padding-top 8px
|
69
87
|
max-height calc(80vh - 130px)
|
70
88
|
overflow-y auto
|
71
89
|
|
@@ -134,18 +152,9 @@
|
|
134
152
|
right 0
|
135
153
|
margin auto
|
136
154
|
|
137
|
-
#algolia-stats
|
138
|
-
margin-bottom 10px
|
139
|
-
color var(--sco-gray)
|
140
|
-
font-size .8rem
|
141
|
-
font-weight bold
|
142
|
-
|
143
155
|
.algolia-tips-text
|
144
156
|
margin-left .4rem
|
145
157
|
|
146
|
-
#algolia-search-results
|
147
|
-
padding-top 8px
|
148
|
-
|
149
158
|
#search-mask
|
150
159
|
position fixed
|
151
160
|
inset 0
|
@@ -155,4 +164,16 @@
|
|
155
164
|
backdrop-filter blur(12px)
|
156
165
|
-webkit-backdrop-filter blur(12px)
|
157
166
|
transform translateZ(0)
|
158
|
-
background var(--sco-maskbgdeep)
|
167
|
+
background var(--sco-maskbgdeep)
|
168
|
+
|
169
|
+
#algolia-hits
|
170
|
+
.tag-list
|
171
|
+
padding 4px 8px
|
172
|
+
border-radius 8px
|
173
|
+
margin-right 0.5rem
|
174
|
+
margin-top 0.5rem
|
175
|
+
border var(--style-border-always)
|
176
|
+
|
177
|
+
&:hover
|
178
|
+
background var(--sco-main)
|
179
|
+
color var(--sco-white)
|
@@ -12,10 +12,13 @@
|
|
12
12
|
border var(--style-border)
|
13
13
|
transition 0.3s
|
14
14
|
border-radius 8px
|
15
|
+
animation slide-in .6s ease 0s 1 normal none running
|
15
16
|
|
16
17
|
&:hover
|
17
18
|
border var(--style-border-hover)
|
18
19
|
box-shadow var(--sco-shadow-theme)
|
20
|
+
+maxWidth768()
|
21
|
+
border none
|
19
22
|
|
20
23
|
+maxWidth768()
|
21
24
|
top 0
|
@@ -23,6 +26,7 @@
|
|
23
26
|
margin 0
|
24
27
|
width 100%
|
25
28
|
height 100%
|
29
|
+
border 0
|
26
30
|
|
27
31
|
.search-dialog-title
|
28
32
|
font-weight 700
|
@@ -116,7 +120,7 @@
|
|
116
120
|
max-width 100%
|
117
121
|
width 100%
|
118
122
|
padding-top 8px
|
119
|
-
|
123
|
+
padding-bottom 8px
|
120
124
|
|
121
125
|
input
|
122
126
|
height 100%
|
@@ -138,4 +142,16 @@
|
|
138
142
|
backdrop-filter blur(12px)
|
139
143
|
-webkit-backdrop-filter blur(12px)
|
140
144
|
transform translateZ(0)
|
141
|
-
background var(--sco-maskbgdeep)
|
145
|
+
background var(--sco-maskbgdeep)
|
146
|
+
|
147
|
+
#search-hits
|
148
|
+
.tag-list
|
149
|
+
padding 4px 8px
|
150
|
+
border-radius 8px
|
151
|
+
margin-right 0.5rem
|
152
|
+
margin-top 0.5rem
|
153
|
+
border var(--style-border-always)
|
154
|
+
|
155
|
+
&:hover
|
156
|
+
background var(--sco-main)
|
157
|
+
color var(--sco-white)
|
package/source/css/index.styl
CHANGED
@@ -2,12 +2,17 @@ const coverColor = () => {
|
|
2
2
|
const path = document.getElementById("post-cover")?.src;
|
3
3
|
if (path) {
|
4
4
|
handleApiColor(path);
|
5
|
+
} else {
|
6
|
+
document.documentElement.style.setProperty('--sco-main', 'var(--sco-theme)');
|
7
|
+
document.documentElement.style.setProperty('--sco-main-op', 'var(--sco-theme-op)');
|
8
|
+
document.documentElement.style.setProperty('--sco-main-op-deep', 'var(--sco-theme-op-deep)');
|
9
|
+
document.documentElement.style.setProperty('--sco-main-none', 'var(--sco-theme-none)');
|
10
|
+
initThemeColor()
|
5
11
|
}
|
6
12
|
}
|
7
13
|
|
8
14
|
function handleApiColor(path) {
|
9
15
|
const cacheGroup = JSON.parse(localStorage.getItem('Solitude')) || {};
|
10
|
-
console.log(cacheGroup)
|
11
16
|
if (cacheGroup.postcolor && cacheGroup.postcolor[path]) {
|
12
17
|
const color = cacheGroup.postcolor[path].value;
|
13
18
|
const [r, g, b] = color.match(/\w\w/g).map(x => parseInt(x, 16));
|
@@ -26,14 +31,13 @@ function img2color(src) {
|
|
26
31
|
const [r, g, b] = color.match(/\w\w/g).map(x => parseInt(x, 16));
|
27
32
|
setThemeColors(color, r, g, b);
|
28
33
|
const expirationTime = Date.now() + coverColorConfig.time;
|
29
|
-
const cacheGroup =
|
34
|
+
const cacheGroup = JSON.parse(localStorage.getItem('Solitude')) || {};
|
30
35
|
cacheGroup.postcolor = cacheGroup.postcolor || {};
|
31
36
|
cacheGroup.postcolor[src] = {value: color, expiration: expirationTime};
|
32
37
|
localStorage.setItem('Solitude', JSON.stringify(cacheGroup));
|
33
38
|
})
|
34
39
|
.catch(error => {
|
35
40
|
console.error('请检查API是否正常!\n' + error);
|
36
|
-
setThemeColors();
|
37
41
|
});
|
38
42
|
}
|
39
43
|
|
@@ -45,14 +49,14 @@ function setThemeColors(value, r = null, g = null, b = null) {
|
|
45
49
|
document.documentElement.style.setProperty('--sco-main-none', value + '00');
|
46
50
|
|
47
51
|
if (r && g && b) {
|
48
|
-
|
52
|
+
let brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
|
49
53
|
if (brightness < 125) {
|
50
|
-
|
54
|
+
let cardContents = document.getElementsByClassName('card-content');
|
51
55
|
for (let i = 0; i < cardContents.length; i++) {
|
52
56
|
cardContents[i].style.setProperty('--sco-card-bg', 'var(--sco-white)');
|
53
57
|
}
|
54
58
|
|
55
|
-
|
59
|
+
let authorInfo = document.getElementsByClassName('author-info__sayhi');
|
56
60
|
for (let i = 0; i < authorInfo.length; i++) {
|
57
61
|
authorInfo[i].style.setProperty('background', 'var(--sco-white-op)');
|
58
62
|
authorInfo[i].style.setProperty('color', 'var(--sco-white)');
|
@@ -1,21 +1,26 @@
|
|
1
|
-
|
1
|
+
const coverColor = () => {
|
2
2
|
const path = document.getElementById("post-cover")?.src;
|
3
|
-
|
4
3
|
if (path) {
|
5
4
|
localColor(path);
|
5
|
+
} else {
|
6
|
+
document.documentElement.style.setProperty('--sco-main', 'let(--sco-theme)');
|
7
|
+
document.documentElement.style.setProperty('--sco-main-op', 'let(--sco-theme-op)');
|
8
|
+
document.documentElement.style.setProperty('--sco-main-op-deep', 'let(--sco-theme-op-deep)');
|
9
|
+
document.documentElement.style.setProperty('--sco-main-none', 'let(--sco-theme-none)');
|
10
|
+
initThemeColor()
|
6
11
|
}
|
7
12
|
}
|
8
13
|
|
9
|
-
|
14
|
+
const localColor = (path) => {
|
10
15
|
const img = new Image();
|
11
16
|
img.crossOrigin = "Anonymous";
|
12
17
|
img.onload = function () {
|
13
18
|
const canvas = document.createElement("canvas");
|
14
|
-
canvas.width =
|
15
|
-
canvas.height =
|
19
|
+
canvas.width = img.width;
|
20
|
+
canvas.height = img.height;
|
16
21
|
const ctx = canvas.getContext("2d");
|
17
|
-
ctx.drawImage(
|
18
|
-
const data = ctx.getImageData(0, 0,
|
22
|
+
ctx.drawImage(img, 0, 0);
|
23
|
+
const data = ctx.getImageData(0, 0, img.width, img.height).data;
|
19
24
|
const {r, g, b} = calculateRGB(data);
|
20
25
|
let value = rgbToHex(r, g, b);
|
21
26
|
if (getContrastYIQ(value) === "light") {
|
@@ -23,9 +28,26 @@ function localColor(path) {
|
|
23
28
|
}
|
24
29
|
setThemeColors(value, r, g, b);
|
25
30
|
};
|
31
|
+
img.onerror = function () {
|
32
|
+
console.error('图片加载失败');
|
33
|
+
};
|
26
34
|
img.src = path;
|
27
35
|
}
|
28
36
|
|
37
|
+
function calculateRGB(data) {
|
38
|
+
let r = 0, g = 0, b = 0;
|
39
|
+
const step = 5;
|
40
|
+
for (let i = 0; i < data.length; i += 4 * step) {
|
41
|
+
r += data[i];
|
42
|
+
g += data[i + 1];
|
43
|
+
b += data[i + 2];
|
44
|
+
}
|
45
|
+
r = Math.floor(r / (data.length / 4 / step));
|
46
|
+
g = Math.floor(g / (data.length / 4 / step));
|
47
|
+
b = Math.floor(b / (data.length / 4 / step));
|
48
|
+
return {r, g, b};
|
49
|
+
}
|
50
|
+
|
29
51
|
function rgbToHex(r, g, b) {
|
30
52
|
return "#" + [r, g, b].map(x => x.toString(16).padStart(2, '0')).join('');
|
31
53
|
}
|
@@ -47,12 +69,12 @@ function LightenDarkenColor(col, amt) {
|
|
47
69
|
}
|
48
70
|
|
49
71
|
function getContrastYIQ(hexcolor) {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
72
|
+
let colorrgb = colorRgb(hexcolor);
|
73
|
+
let colors = colorrgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
74
|
+
let red = colors[1];
|
75
|
+
let green = colors[2];
|
76
|
+
let blue = colors[3];
|
77
|
+
let brightness = (red * 299) + (green * 587) + (blue * 114);
|
56
78
|
brightness = brightness / 255000;
|
57
79
|
return brightness >= 0.5 ? "light" : "dark";
|
58
80
|
}
|
@@ -82,4 +104,57 @@ function colorRgb(str) {
|
|
82
104
|
} else {
|
83
105
|
return sColor;
|
84
106
|
}
|
107
|
+
}
|
108
|
+
|
109
|
+
function setThemeColors(value, r = null, g = null, b = null) {
|
110
|
+
const cardContents = document.getElementsByClassName('card-content');
|
111
|
+
const authorInfo = document.getElementsByClassName('author-info__sayhi');
|
112
|
+
|
113
|
+
if (value) {
|
114
|
+
document.documentElement.style.setProperty('--sco-main', value);
|
115
|
+
document.documentElement.style.setProperty('--sco-main-op', value + '23');
|
116
|
+
document.documentElement.style.setProperty('--sco-main-op-deep', value + 'dd');
|
117
|
+
document.documentElement.style.setProperty('--sco-main-none', value + '00');
|
118
|
+
|
119
|
+
if (r && g && b) {
|
120
|
+
let brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
|
121
|
+
for (let i = 0; i < cardContents.length; i++) {
|
122
|
+
cardContents[i].style.setProperty('--sco-card-bg', 'let(--sco-white)');
|
123
|
+
}
|
124
|
+
|
125
|
+
for (let i = 0; i < authorInfo.length; i++) {
|
126
|
+
authorInfo[i].style.setProperty('background', 'let(--sco-white-op)');
|
127
|
+
authorInfo[i].style.setProperty('color', 'let(--sco-white)');
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
document.getElementById("coverdiv").classList.add("loaded");
|
132
|
+
initThemeColor();
|
133
|
+
} else {
|
134
|
+
document.documentElement.style.setProperty('--sco-main', 'let(--sco-theme)');
|
135
|
+
document.documentElement.style.setProperty('--sco-main-op', 'let(--sco-theme-op)');
|
136
|
+
document.documentElement.style.setProperty('--sco-main-op-deep', 'let(--sco-theme-op-deep)');
|
137
|
+
document.documentElement.style.setProperty('--sco-main-none', 'let(--sco-theme-none)');
|
138
|
+
initThemeColor();
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
function initThemeColor() {
|
143
|
+
const currentTop = window.scrollY || document.documentElement.scrollTop;
|
144
|
+
let themeColor;
|
145
|
+
if (currentTop > 0) {
|
146
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--sco-card-bg');
|
147
|
+
} else if (PAGE_CONFIG.is_post) {
|
148
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--sco-main');
|
149
|
+
} else {
|
150
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--sco-background');
|
151
|
+
}
|
152
|
+
changeThemeColor(themeColor);
|
153
|
+
}
|
154
|
+
|
155
|
+
function changeThemeColor(color) {
|
156
|
+
const meta = document.querySelector('meta[name="theme-color"]');
|
157
|
+
if (meta) {
|
158
|
+
meta.setAttribute('content', color);
|
159
|
+
}
|
85
160
|
}
|
package/source/js/main.js
CHANGED
@@ -281,6 +281,20 @@ let sco = {
|
|
281
281
|
htmlClassList.toggle("hide-aside");
|
282
282
|
htmlClassList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on");
|
283
283
|
},
|
284
|
+
switchKeyboard: function() {
|
285
|
+
sco_keyboards = !sco_keyboards;
|
286
|
+
const consoleKeyboard = document.querySelector("#consoleKeyboard");
|
287
|
+
if (sco_keyboards) {
|
288
|
+
consoleKeyboard.classList.add("on");
|
289
|
+
openKeyboard()
|
290
|
+
localStorage.setItem("keyboard", true);
|
291
|
+
} else {
|
292
|
+
closeKeyboard()
|
293
|
+
consoleKeyboard.classList.remove("on");
|
294
|
+
localStorage.setItem("keyboard", false);
|
295
|
+
document.getElementById('keyboard-tips')?.classList.remove('show')
|
296
|
+
}
|
297
|
+
},
|
284
298
|
initConsoleState: function () {
|
285
299
|
document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
|
286
300
|
},
|
@@ -672,7 +686,7 @@ let sco = {
|
|
672
686
|
element.value = "donotreply@examp.com";
|
673
687
|
element.dispatchEvent(new Event("input"));
|
674
688
|
});
|
675
|
-
}
|
689
|
+
},
|
676
690
|
}
|
677
691
|
|
678
692
|
class hightlight {
|
@@ -1,8 +1,10 @@
|
|
1
|
+
let openSearch
|
2
|
+
|
1
3
|
window.addEventListener("load", () => {
|
2
4
|
const $searchMask = document.getElementById("search-mask");
|
3
5
|
const $searchDialog = document.querySelector("#algolia-search .search-dialog");
|
4
6
|
|
5
|
-
|
7
|
+
openSearch = () => {
|
6
8
|
utils.animateIn($searchMask, "to_show 0.5s");
|
7
9
|
$searchDialog.style.display = "block";
|
8
10
|
setTimeout(() => {
|
@@ -68,7 +70,7 @@ window.addEventListener("load", () => {
|
|
68
70
|
});
|
69
71
|
|
70
72
|
const configure = instantsearch.widgets.configure({
|
71
|
-
hitsPerPage: algolia.hits.per_page
|
73
|
+
hitsPerPage: algolia.hits.per_page || 5,
|
72
74
|
});
|
73
75
|
|
74
76
|
const searchBox = instantsearch.widgets.searchBox({
|
@@ -1,8 +1,10 @@
|
|
1
|
+
let openSearch
|
2
|
+
|
1
3
|
window.onload = () => {
|
2
4
|
let idx, store = [];
|
3
5
|
const $searchMask = document.getElementById("search-mask");
|
4
6
|
const $searchDialog = document.querySelector("#local-search .search-dialog");
|
5
|
-
|
7
|
+
openSearch = () => {
|
6
8
|
utils.animateIn($searchMask, "to_show 0.5s");
|
7
9
|
$searchDialog.style.display = "block";
|
8
10
|
setTimeout(() => {
|
package/source/js/utils.js
CHANGED
package/source/img/avatar.png
DELETED
Binary file
|