hexo-theme-solitude 2.0.13 → 2.1.1

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/README.md CHANGED
@@ -42,7 +42,8 @@ English丨[简体中文](README_zh-Hans.md)丨[繁体中文](README_zh-Hant.md)
42
42
 
43
43
  ## Todo
44
44
 
45
- - [x] The list of articles is displayed in three columns on the homepage.
45
+ - [X] Mobile directory support.
46
+ - [X] Add a bottom right sidebar.
46
47
 
47
48
  > If you have any questions, please issue an [issue](https://github.com/everfu/hexo-theme-solitude/issues)
48
49
 
package/README_zh-Hans.md CHANGED
@@ -42,7 +42,8 @@
42
42
 
43
43
  ## Todo
44
44
 
45
- - [x] 首页顶部新样式
45
+ - [x] 移动端目录支持
46
+ - [x] 增加右下角侧边栏
46
47
 
47
48
  > 如有问题请提 [issue](https://github.com/everfu/hexo-theme-solitude/issues)
48
49
 
package/README_zh-Hant.md CHANGED
@@ -42,7 +42,8 @@
42
42
 
43
43
  ## Todo
44
44
 
45
- - [x] 首页文章列表三列显示
45
+ - [x] 移動端目錄支援
46
+ - [x] 增加右下角側邊欄
46
47
 
47
48
  ## 應用
48
49
 
package/_config.yml CHANGED
@@ -444,7 +444,7 @@ footer:
444
444
  # 404 页面
445
445
  errorpage:
446
446
  img: /img/404.avif
447
- text: =awa= Page NotFound # Text
447
+ text: =awa= Page Not Found # Text
448
448
  recommendList: true
449
449
  # --------------------------- end ---------------------------
450
450
 
@@ -887,10 +887,7 @@ right_menu:
887
887
  ctrlOriginalMenu: false
888
888
  # Simplified and Traditional Chinese translation.
889
889
  # 简繁体转换
890
- translate:
891
- enable: false
892
- defaultEncoding: 2 # 1: 默认繁体 2: 默认简体
893
- translateDelay: 0 # 首次加载翻译迟疑时间
890
+ translate: false
894
891
  # Custom list
895
892
  # 自定义列表
896
893
  custom_list:
@@ -954,6 +951,26 @@ background:
954
951
  light: https://i.pinimg.com/originals/93/57/38/935738ed9657b296c2ef0ebd2151eb66.jpg
955
952
  # --------------------------- end ---------------------------
956
953
 
954
+ # --------------------------- start ---------------------------
955
+ translate:
956
+ enable: true
957
+ defaultEncoding: 2 # 1: 默认繁体 2: 默认简体
958
+ translateDelay: 0 # 首次加载翻译迟疑时间
959
+ # --------------------------- end ---------------------------
960
+
961
+ # --------------------------- start ---------------------------
962
+ # Right-Sidebar
963
+ # 右下角悬停导航栏
964
+ rightside:
965
+ enable: false
966
+ percent: false
967
+ hide:
968
+ enable: false
969
+ translate: false
970
+ mode: false
971
+ aside: false
972
+ # --------------------------- start ---------------------------
973
+
957
974
  # --------------------------- start ---------------------------
958
975
  # Do not modify unless necessary
959
976
  # 非必要请勿修改
@@ -233,3 +233,14 @@ essay:
233
233
  tip0: '- All expanded -'
234
234
  tip1: '- Recent Exhibitions #{count} Short Articles -'
235
235
  link: 'Link'
236
+
237
+ rightside:
238
+ show:
239
+ gear: Settings
240
+ toc: Toc
241
+ comment: Comment
242
+ top: Top
243
+ hide:
244
+ translate: 简繁转换
245
+ mode: Mode
246
+ aside: Sidebar
package/languages/en.yml CHANGED
@@ -234,3 +234,14 @@ essay:
234
234
  tip0: '- All expanded -'
235
235
  tip1: '- Recent Exhibitions #{count} Short Articles -'
236
236
  link: 'Link'
237
+
238
+ rightside:
239
+ show:
240
+ gear: Settings
241
+ toc: Toc
242
+ comment: Comment
243
+ top: Top
244
+ hide:
245
+ translate: 简繁转换
246
+ mode: Mode
247
+ aside: Sidebar
@@ -233,3 +233,14 @@ essay:
233
233
  tip0: '- 已展开所有短文 -'
234
234
  tip1: '- 只展示最近 #{count} 条短文 -'
235
235
  link: '链接'
236
+
237
+ rightside:
238
+ show:
239
+ gear: 扩展
240
+ toc: 目录
241
+ comment: 评论
242
+ top: 返回顶部
243
+ hide:
244
+ translate: 简繁转换
245
+ mode: 显示模式切换
246
+ aside: 侧边栏
@@ -232,3 +232,14 @@ essay:
232
232
  tip0: '- 已展開所有短文 -'
233
233
  tip1: '- 只展示最近 #{count} 條短文 -'
234
234
  link: '鏈結'
235
+
236
+ rightside:
237
+ show:
238
+ gear: 擴展
239
+ toc: 目錄
240
+ comment: 評論
241
+ top: 返回頂部
242
+ hide:
243
+ translate: 簡繁轉換
244
+ mode: 顯示模式切換
245
+ aside: 側邊欄
@@ -114,16 +114,21 @@
114
114
  close: _p('right_menu.barrage.close')
115
115
  }
116
116
  }
117
- if (theme.right_menu.translate.enable) {
118
- rightMenu.translate = {
119
- translateDelay: theme.right_menu.translate.translateDelay,
120
- defaultEncoding: theme.right_menu.translate.defaultEncoding
121
- }
117
+ if (theme.translate.enable) {
118
+ rightMenu.translate = theme.right_menu.translate
122
119
  }
123
120
  if (theme.right_menu.ctrlOriginalMenu)
124
121
  rightMenu.ctrlOriginalMenu = _p('right_menu.ctrl_original_menu')
125
122
  }
126
123
 
124
+ let translate = false
125
+ if (theme.translate.enable) {
126
+ translate = {
127
+ translateDelay: theme.translate.translateDelay,
128
+ defaultEncoding: theme.translate.defaultEncoding
129
+ }
130
+ }
131
+
127
132
  let highlight = false
128
133
  if (theme.highlight.enable) {
129
134
  highlight = {
@@ -187,6 +192,7 @@ script.
187
192
  lightbox: '!{ theme.mediumZoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null")}',
188
193
  post_ai: !{post_ai},
189
194
  right_menu: !{rightMenu ? JSON.stringify(rightMenu) : false},
195
+ translate: !{translate ? JSON.stringify(translate) : false},
190
196
  lure: !{lure ? JSON.stringify(lure) : false},
191
197
  expire: !{expire ? JSON.stringify(expire) : false},
192
198
  };
@@ -33,7 +33,7 @@ div
33
33
  script.
34
34
  dark()
35
35
 
36
- if theme.right_menu.enable && theme.right_menu.translate.enable
36
+ if theme.translate.enable
37
37
  script(src=url_for(theme.cdn.translate_js))
38
38
 
39
39
  if theme.katex && theme.katex.enable
@@ -26,6 +26,10 @@ html(lang=config.language, data-theme="light")
26
26
  // keyboard
27
27
  if theme.keyboard.enable
28
28
  include ./keyboard.pug
29
+
30
+ // righhtside
31
+ if theme.rightside.enable
32
+ include rightside
29
33
 
30
34
  #body-wrap(class = is_post() ? 'post' : 'page')
31
35
  include ./header.pug
@@ -68,10 +68,10 @@ div#rightMenu
68
68
  span.menu-darkmode-text= _p('right_menu.light')
69
69
  when 'dark'
70
70
  span.menu-darkmode-text= _p('right_menu.dark')
71
- if theme.right_menu.translate.enable
71
+ if theme.right_menu.translate
72
72
  div.rightMenu-item#menu-translate
73
73
  i.solitude.fa-solid.fa-language
74
- case theme.right_menu.translate.defaultEncoding
74
+ case theme.translate.defaultEncoding
75
75
  when 2
76
76
  span= _p('right_menu.chs_to_cht')
77
77
  when 1
@@ -0,0 +1,3 @@
1
+ #rightside
2
+ include ./widgets/rightside/hide
3
+ include ./widgets/rightside/show
@@ -13,10 +13,10 @@
13
13
  .item-name= __('aside.pv')
14
14
  if theme.busuanzi_use === 0
15
15
  span#busuanzi_value_site_pv
16
- i.solitude.fa-solid.fa-spinner
16
+ i.solitude.fa-solid.fa-spinner.fa-spin
17
17
  else
18
18
  span#busuanzi_site_pv
19
- i.solitude.fa-solid.fa-spinner
19
+ i.solitude.fa-solid.fa-spinner.fa-spin
20
20
  if theme.aside.siteinfo.uv
21
21
  .webinfo-item
22
22
  .webinfo-item-title
@@ -24,10 +24,10 @@
24
24
  .item-name= __('aside.uv')
25
25
  if theme.busuanzi_use === 0
26
26
  span#busuanzi_value_site_uv
27
- i.solitude.fa-solid.fa-spinner
27
+ i.solitude.fa-solid.fa-spinner.fa-spin
28
28
  else
29
29
  span#busuanzi_site_uv
30
- i.solitude.fa-solid.fa-spinner
30
+ i.solitude.fa-solid.fa-spinner.fa-spin
31
31
  if theme.aside.siteinfo.runtimeenable
32
32
  .webinfo-item
33
33
  .webinfo-item-title
@@ -18,11 +18,11 @@ if theme.console.enable
18
18
  i.left
19
19
  i.center
20
20
  i.right
21
-
22
- .nav-button#nav-totop(onclick="sco.toTop()")
23
- a.totopbtn
24
- i.solitude.fa-solid.fa-arrow-up
25
- span#percent= "0"
21
+ if !theme.rightside.percent
22
+ .nav-button#nav-totop(onclick="sco.toTop()")
23
+ a.totopbtn
24
+ i.solitude.fa-solid.fa-arrow-up
25
+ span#percent= "0"
26
26
  #toggle-menu
27
27
  a.site-page
28
28
  i.solitude.fa-solid.fa-bars
@@ -18,7 +18,7 @@
18
18
  .meta-secondline
19
19
  if theme.post.meta.date
20
20
  span.post-meta-date(title=_p('post.posted') + ' ' + full_date(page.date))
21
- i.post-meta-icon.solitude.fa-solid.fa-clock
21
+ i.post-meta-icon.solitude.fas.fa-calendar-days
22
22
  time(datetime=date_xml(page.date))= date_xml(page.date)
23
23
  if theme.post.meta.updated
24
24
  span.post-meta-date(title=_p('post.updated') + ' ' + full_date(page.updated))
@@ -44,25 +44,25 @@
44
44
  case theme.comment.use[0]
45
45
  when "Twikoo"
46
46
  span#twikoo_visitors
47
- i.solitude.fa-solid.fa-spinner
47
+ i.solitude.fa-solid.fa-spinner.fa-spin
48
48
  when "Waline"
49
49
  span.waline-pageview-count
50
- i.solitude.fa-solid.fa-spinner
50
+ i.solitude.fa-solid.fa-spinner.fa-spin
51
51
  when "Valine"
52
52
  span.leancloud_visitors(id=url_for(page.path))
53
53
  span.leancloud-visitors-count
54
- i.solitude.fa-solid.fa-spinner
54
+ i.solitude.fa-solid.fa-spinner.fa-spin
55
55
  when 'Artalk'
56
56
  span#ArtalkPV
57
- i.solitude.fa-solid.fa-spinner
57
+ i.solitude.fa-solid.fa-spinner.fa-spin
58
58
  else
59
59
  if theme.busuanzi
60
60
  if theme.busuanzi_use === 0
61
61
  span#busuanzi_value_page_pv
62
- i.solitude.fa-solid.fa-spinner
62
+ i.solitude.fa-solid.fa-spinner.fa-spin
63
63
  else
64
64
  span#busuanzi_page_pv
65
- i.solitude.fa-solid.fa-spinner
65
+ i.solitude.fa-solid.fa-spinner.fa-spin
66
66
  if theme.post.meta.comment && page.comment && theme.comment.count && theme.comment.use
67
67
  span.post-meta-commentcount(title=_p('post.comment'), onclick="sco.scrollTo('post-comment')")
68
68
  i.solitude.fa-solid.fa-comment
@@ -70,13 +70,13 @@
70
70
  case theme.comment.use[0]
71
71
  when "Twikoo"
72
72
  span.twikoo-count
73
- i.solitude.fa-solid.fa-spinner
73
+ i.solitude.fa-solid.fa-spinner.fa-spin
74
74
  when "Waline"
75
75
  span.waline-comment-count
76
- i.solitude.fa-solid.fa-spinner
76
+ i.solitude.fa-solid.fa-spinner.fa-spin
77
77
  when "Valine"
78
78
  span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount")
79
- i.solitude.fa-solid.fa-spinner
79
+ i.solitude.fa-solid.fa-spinner.fa-spin
80
80
  when 'Artalk'
81
81
  span.artalk-count
82
- i.solitude.fa-solid.fa-spinner
82
+ i.solitude.fa-solid.fa-spinner.fa-spin
@@ -0,0 +1,9 @@
1
+ .rs_hide
2
+ if theme.rightside.hide.translate
3
+ button.translate(type='button' title=_p('rightside.hide.translate'))= '简'
4
+ if theme.rightside.hide.mode
5
+ button.mode(type='button' title=_p('rightside.hide.mode') onclick='sco.switchDarkMode()')
6
+ i.fas.fa-circle-half-stroke
7
+ if theme.rightside.hide.aside
8
+ button.aside.pc(type='button' title=_p('rightside.hide.aside') onclick='sco.switchHideAside()')
9
+ i.fas.fa-arrows-alt-h
@@ -0,0 +1,13 @@
1
+ .rs_show
2
+ if theme.rightside.hide.enable
3
+ button.config(type='button' title=_p('rightside.show.gear') onclick='document.querySelector(".rs_hide").classList.toggle("show")')
4
+ i.fas.fa-gear.fa-spin
5
+ if page.toc
6
+ button.mobile.toc(type='button' title=_p('rightside.show.toc') onclick="document.querySelector('#card-toc').classList.toggle('open')")
7
+ i.fas.fa-list
8
+ if page.comment
9
+ button.comment(type='button' title=_p('rightside.show.comment') onclick="sco.scrollTo('post-comment')")
10
+ i.fas.fa-comment
11
+ button.top(type='button' title=_p('rightside.show.top') onclick='sco.toTop()')
12
+ i.fas.fa-arrow-up
13
+ span#percent= "0"
@@ -12,13 +12,13 @@
12
12
  case name
13
13
  when "Twikoo"
14
14
  span.twikoo-count
15
- i.solitude.fa-solid.fa-spinner
15
+ i.solitude.fa-solid.fa-spinner.fa-spin
16
16
  when "Waline"
17
17
  span.waline-comment-count
18
- i.solitude.fa-solid.fa-spinner
18
+ i.solitude.fa-solid.fa-spinner.fa-spin
19
19
  when "Valine"
20
20
  span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount")
21
- i.solitude.fa-solid.fa-spinner
21
+ i.solitude.fa-solid.fa-spinner.fa-spin
22
22
  when "Artalk"
23
23
  span.artalk-count
24
24
  | )
@@ -3,7 +3,7 @@
3
3
  script.
4
4
  const pjax = new Pjax({
5
5
  elements: 'a:not([target="_blank"])',
6
- selectors: ['title','#body-wrap','#site-config','meta[name="description"]','.js-pjax','meta[property^="og:"]','#config-diff'],
6
+ selectors: ['title','#body-wrap','#site-config','meta[name="description"]','.js-pjax','meta[property^="og:"]','#config-diff', '.rs_show', '.rs_hide'],
7
7
  cacheBust: false,
8
8
  analytics: !{google_adsense},
9
9
  scrollRestoration: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "2.0.13",
3
+ "version": "2.1.1",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by everfu.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -12,7 +12,7 @@
12
12
  "solitude",
13
13
  "Card UI Design",
14
14
  "everfu",
15
- "一小只托尼",
15
+ "伍十七",
16
16
  "hexo-theme-solitude"
17
17
  ],
18
18
  "repository": {
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "bugs": {
27
27
  "url": "https://github.com/everfu/hexo-theme-solitude/issues",
28
- "email": "o@everfu.org"
28
+ "email": "o@everfu.cn"
29
29
  },
30
30
  "homepage": "https://solitude.js.org",
31
- "author": "Hexo-Theme-Solitude<o@everfu.org>",
31
+ "author": "Hexo-Theme-Solitude<o@everfu.cn>",
32
32
  "license": "MIT"
33
33
  }
@@ -384,11 +384,7 @@ hexo.extend.filter.register('before_generate', () => {
384
384
  enable: false,
385
385
  commentBarrage: false,
386
386
  ctrlOriginalMenu: false,
387
- translate: {
388
- enable: false,
389
- defaultEncoding: 2,
390
- translateDelay: 0,
391
- },
387
+ translate: false,
392
388
  custom_list: []
393
389
  },
394
390
  lure: {
@@ -409,6 +405,20 @@ hexo.extend.filter.register('before_generate', () => {
409
405
  light: 'https://bu.dusays.com/2023/09/29/651685cc18d39.jpg',
410
406
  opacity: .2,
411
407
  },
408
+ translate: {
409
+ enable: false,
410
+ defaultEncoding: 2,
411
+ translateDelay: 0,
412
+ },
413
+ rightside: {
414
+ enable: false,
415
+ percent: false,
416
+ hide: {
417
+ enable: false,
418
+ translate: false,
419
+ mode: false
420
+ }
421
+ },
412
422
  CDN: {
413
423
  internal: 'local',
414
424
  third_party: 'cdnjs',
@@ -43,8 +43,8 @@
43
43
  --sidebar-bg #f6f8fa
44
44
  --btn-hover-color #ff7242
45
45
  --btn-color #fff
46
- --btn-bg #307af6
47
- --text-bg-hover #307af6
46
+ --btn-bg var(--efu-main)
47
+ --text-bg-hover #f6f8fa
48
48
  --light-grey #eee
49
49
  --text-highlight-color #1f2d3d
50
50
  --blockquote-color #6a737d
@@ -1,5 +1,6 @@
1
1
  #aside-content
2
- width 300px
2
+ +minWidth1200()
3
+ width 300px
3
4
  if hexo-config('aside.position') == 0
4
5
  order 1
5
6
  else
@@ -12,7 +13,8 @@
12
13
  padding-left 15px
13
14
 
14
15
  +maxWidth1200()
15
- display none
16
+ .card-widget:not(#card-toc)
17
+ display: none
16
18
 
17
19
  +minWidth1300()
18
20
  animation slide-in .6s .3s backwards
@@ -62,6 +64,7 @@
62
64
  .sticky_layout
63
65
  top calc(60px + .5rem)
64
66
  position sticky
67
+ z-index 10
65
68
  transition: top .3s ease 0s
66
69
 
67
70
  #author-info__sayhi
@@ -187,6 +190,21 @@
187
190
  right 0
188
191
  padding .5rem
189
192
 
193
+ +maxWidth1200()
194
+ position: fixed
195
+ right: 3rem
196
+ bottom: 2rem
197
+ z-index: 100
198
+ max-width: 380px
199
+ max-height: calc(100% - 60px)
200
+ width: calc(100% - 80px)
201
+ transition: transform .3s
202
+ transform: scale(0)
203
+ transform-origin: right bottom
204
+
205
+ &.open
206
+ transform: scale(1)
207
+
190
208
  .toc-content
191
209
  overflow-y: auto
192
210
  max-height: calc(100vh - 300px)
@@ -2,7 +2,7 @@ if hexo-config('capsule.enable')
2
2
  #nav-music
3
3
  display flex
4
4
  align-items center
5
- z-index 8
5
+ z-index 11
6
6
  position fixed
7
7
  bottom 20px
8
8
  left 20px
@@ -57,6 +57,11 @@ if hexo-config('capsule.enable')
57
57
 
58
58
  .aplayer-played
59
59
  animation-play-state running
60
+ height: 100%;
61
+ opacity: .1;
62
+ background-color: var(--efu-white) !important;
63
+ animation: lightBar 5s ease infinite;
64
+ animation-play-state: paused;
60
65
 
61
66
  #nav-music-hoverTips
62
67
  opacity 0
@@ -97,6 +97,7 @@
97
97
  top 7rem
98
98
 
99
99
  #nav
100
+ z-index 100
100
101
  box-shadow none
101
102
  transition 0.3s
102
103
  display flex
@@ -0,0 +1,53 @@
1
+ if hexo-config('rightside.enable')
2
+ #rightside
3
+ position: fixed
4
+ right: -2.5rem
5
+ bottom: 2.5rem
6
+ z-index: 1000
7
+ opacity: 0
8
+ transition: all .5s
9
+
10
+ button
11
+ display: block
12
+ margin-bottom: 5px
13
+ width: 1.8rem
14
+ height: 1.8rem
15
+ border-radius: 50%
16
+ background-color: var(--btn-bg)
17
+ color: var(--btn-color)
18
+ text-align: center
19
+ font-size: 16px
20
+
21
+ &.pc
22
+ display: blok
23
+ +maxWidth900()
24
+ display: none
25
+
26
+ &.mobile
27
+ display: none
28
+
29
+ +maxWidth900()
30
+ display: block
31
+
32
+ &.top
33
+ &:hover
34
+ #percent
35
+ display: none
36
+ i
37
+ display: block
38
+ transition: all .3s
39
+ transform: scale(1.3)
40
+ i
41
+ transition: all .3s
42
+ display: none
43
+ &.show
44
+ display: block
45
+
46
+ .rs_hide
47
+ transform: translate(45px, 0)
48
+ transition: all .4s
49
+ opacity 0
50
+
51
+ &.show
52
+ opacity .8
53
+ transform: translate(0, 0)
@@ -259,6 +259,11 @@
259
259
  flex-wrap wrap
260
260
  height 120px
261
261
 
262
+ +maxWidth1200()
263
+ flex-direction row
264
+ left 2rem
265
+ height 60px
266
+
262
267
  .banners-link-btn
263
268
  display flex
264
269
  flex-direction row
@@ -206,7 +206,7 @@
206
206
  transition all .3s ease-out 0s
207
207
 
208
208
  i
209
- font-size 13px
209
+ font-size 14px
210
210
  margin-right 4px
211
211
 
212
212
  > div
@@ -241,7 +241,6 @@
241
241
  margin 0 1rem 0 0
242
242
 
243
243
  .post-meta-pv
244
- margin-right 8px
245
244
  padding 0 8px
246
245
  display flex
247
246
  align-items center
@@ -264,7 +263,6 @@
264
263
  cursor pointer
265
264
  transition .3s
266
265
  border-radius 12px
267
- padding 8px
268
266
 
269
267
  &:hover
270
268
  opacity 1
@@ -59,7 +59,8 @@
59
59
  border-radius: 8px
60
60
  line-height: 39px
61
61
  box-shadow: var(--efu-shadow-red)
62
- display: inline-block
62
+ display: flex
63
+ align-items: center
63
64
  cursor: pointer
64
65
  transition: all .4s ease 0s
65
66
 
@@ -181,6 +182,8 @@
181
182
  height: 40px
182
183
  line-height: 39px
183
184
  box-shadow: var(--efu-shadow-green)
185
+ display: flex
186
+ align-items: center
184
187
  border-radius: 8px
185
188
  cursor: pointer
186
189
  text-align: center
package/source/js/main.js CHANGED
@@ -26,9 +26,11 @@ const sidebarFn = () => {
26
26
  sco.refreshWaterFall();
27
27
  });
28
28
  }
29
+
29
30
  const scrollFn = () => {
30
31
  let initTop = 0;
31
32
  const $header = document.getElementById('page-header');
33
+ const $rightside = document.getElementById('rightside') || null;
32
34
  const throttledScroll = utils.throttle(() => {
33
35
  initThemeColor();
34
36
  const currentTop = window.scrollY || document.documentElement.scrollTop;
@@ -40,14 +42,17 @@ const scrollFn = () => {
40
42
  if (!$header.classList.contains('nav-visible')) $header.classList.add('nav-visible');
41
43
  }
42
44
  $header.classList.add('nav-fixed');
45
+ $rightside && ($rightside.style.cssText = 'opacity: 0.8; transform: translateX(-58px);');
43
46
  } else {
44
47
  $header.classList.remove('nav-fixed', 'nav-visible');
48
+ $rightside && ($rightside.style.cssText = "opacity: ''; transform: ''");
45
49
  }
46
50
  }, 200);
47
51
  window.addEventListener('scroll', (e) => {
48
52
  throttledScroll(e);
49
53
  if (window.scrollY === 0) {
50
54
  $header.classList.remove('nav-fixed', 'nav-visible');
55
+ $rightside && ($rightside.style.cssText = "opacity: ''; transform: ''");
51
56
  }
52
57
  });
53
58
 
@@ -63,11 +68,13 @@ const percent = () => {
63
68
  const scrollPos = window.pageYOffset || docEl.scrollTop;
64
69
  const totalScrollableHeight = Math.max(body.scrollHeight, docEl.scrollHeight, body.offsetHeight, docEl.offsetHeight, body.clientHeight, docEl.clientHeight) - docEl.clientHeight;
65
70
  const scrolledPercent = Math.round((scrollPos / totalScrollableHeight) * 100);
66
- const navToTop = document.querySelector("#nav-totop");
71
+ const navToTop = document.querySelector("#nav-totop") || null;
72
+ const rsToTop = document.querySelector(".rs_show .top i") || null;
67
73
  const percentDisplay = document.querySelector("#percent");
68
74
  const isNearEnd = (window.scrollY + docEl.clientHeight) >= (document.getElementById("post-comment") || document.getElementById("footer")).offsetTop;
69
- navToTop.classList.toggle("long", isNearEnd || scrolledPercent > 90);
70
- percentDisplay.textContent = isNearEnd || scrolledPercent > 90 ? GLOBAL_CONFIG.lang.backtop : scrolledPercent;
75
+ navToTop && navToTop.classList.toggle("long", isNearEnd || scrolledPercent > 90);
76
+ rsToTop && rsToTop.classList.toggle("show", isNearEnd || scrolledPercent > 90);
77
+ percentDisplay.textContent = isNearEnd || scrolledPercent > 90 ? navToTop ? GLOBAL_CONFIG.lang.backtop : '' : scrolledPercent;
71
78
  document.querySelectorAll(".needEndHide").forEach(item => item.classList.toggle("hide", totalScrollableHeight - scrollPos < 100));
72
79
  }
73
80
  const showTodayCard = () => {
@@ -656,6 +663,35 @@ class tabs {
656
663
  }
657
664
  }
658
665
 
666
+ const scrollFnToDo = () => {
667
+ const { toc } = PAGE_CONFIG;
668
+
669
+ if (toc) {
670
+ const $cardTocLayout = document.getElementById('card-toc')
671
+ $cardToc = $cardTocLayout.querySelector('.toc-content')
672
+ $tocLink = $cardToc.querySelectorAll('.toc-link')
673
+ $tocPercentage = $cardTocLayout.querySelector('.toc-percentage')
674
+ isExpand = $cardToc.classList.contains('is-expand')
675
+
676
+ // toc percentage
677
+ const tocItemClickFn = e => {
678
+ const target = e.target.closest('.toc-link')
679
+ if (!target) return
680
+
681
+ e.preventDefault()
682
+ utils.scrollToDest(utils.getEleTop(document.getElementById(decodeURI(target.getAttribute('href')).replace('#', ''))), 300)
683
+ if (window.innerWidth < 900) {
684
+ $cardTocLayout.classList.remove('open')
685
+ }
686
+ }
687
+ utils.addEventListenerPjax($cardToc, 'click', tocItemClickFn)
688
+ }
689
+ }
690
+
691
+ const forPostFn = () => {
692
+ scrollFnToDo()
693
+ }
694
+
659
695
  window.refreshFn = () => {
660
696
  const {is_home, is_page, page, is_post} = PAGE_CONFIG;
661
697
  const {runtime, lazyload, lightbox, randomlink, covercolor, post_ai, lure, expire} = GLOBAL_CONFIG;
@@ -684,6 +720,8 @@ window.refreshFn = () => {
684
720
  if (covercolor.enable) coverColor();
685
721
  if (PAGE_CONFIG.toc) toc.init();
686
722
  if (lure) tabs.lureAddListener();
723
+
724
+ forPostFn();
687
725
  }
688
726
  document.addEventListener('DOMContentLoaded', () => {
689
727
  [addCopyright, window.refreshFn, asideStatus, () => window.onscroll = percent, sco.initConsoleState].forEach(fn => fn());
@@ -1,12 +1,9 @@
1
1
  document.addEventListener('DOMContentLoaded', function () {
2
- const { defaultEncoding, translateDelay } = GLOBAL_CONFIG.right_menu.translate;
2
+ const { defaultEncoding, translateDelay } = GLOBAL_CONFIG.translate;
3
3
  const targetEncodingCookie = 'translate-chn-cht';
4
- const msgToTraditionalChinese = '轉為繁體';
5
- const msgToSimplifiedChinese = '转为简体';
6
4
 
7
5
  let currentEncoding = defaultEncoding;
8
6
  let targetEncoding = Number(utils.saveToLocal.get(targetEncodingCookie)) || defaultEncoding;
9
- let translateButtonObject;
10
7
 
11
8
  function setLang() {
12
9
  document.documentElement.lang = targetEncoding === 1 ? 'zh-TW' : 'zh-CN';
@@ -23,7 +20,7 @@ document.addEventListener('DOMContentLoaded', function () {
23
20
  const objs = fobj && typeof fobj === 'object' ? fobj.childNodes : document.body.childNodes;
24
21
 
25
22
  objs.forEach(obj => {
26
- if (['BR', 'HR'].includes(obj.tagName) || obj === translateButtonObject) return;
23
+ if (['BR', 'HR'].includes(obj.tagName)) return;
27
24
 
28
25
  if (obj.title) obj.title = translateText(obj.title);
29
26
  if (obj.alt) obj.alt = translateText(obj.alt);
@@ -36,12 +33,12 @@ document.addEventListener('DOMContentLoaded', function () {
36
33
  });
37
34
  }
38
35
 
39
- function translatePage() {
36
+ function translatePage(simeple, traditional ,button) {
40
37
  currentEncoding = targetEncoding;
41
38
  targetEncoding = targetEncoding === 1 ? 2 : 1;
42
- translateButtonObject.lastChild.textContent = targetEncoding === 1 ? msgToSimplifiedChinese : msgToTraditionalChinese;
39
+ button.lastChild.textContent = targetEncoding === 1 ? simeple : traditional;
43
40
 
44
- utils.snackbarShow(targetEncoding === 1 ? '你已切换为简体' : '你已切換為繁體');
41
+ utils.snackbarShow(targetEncoding === 1 ? '你已切換為繁體' : '你已切换为简体');
45
42
  utils.saveToLocal.set(targetEncodingCookie, targetEncoding, 2);
46
43
  setLang();
47
44
  translateBody();
@@ -75,14 +72,24 @@ document.addEventListener('DOMContentLoaded', function () {
75
72
  }
76
73
 
77
74
  function translateInitialization() {
78
- translateButtonObject = document.getElementById('menu-translate');
79
- if (translateButtonObject) {
75
+ let btn_1 = document.getElementById('menu-translate');
76
+ if (btn_1) {
77
+ btn_1.lastChild.textContent = targetEncoding === 1 ? '转为简体' : '转为繁体';
80
78
  if (currentEncoding !== targetEncoding) {
81
- translateButtonObject.lastChild.textContent = targetEncoding === 1 ? msgToSimplifiedChinese : msgToTraditionalChinese;
82
79
  setLang();
83
80
  setTimeout(translateBody, translateDelay);
84
81
  }
85
- translateButtonObject.addEventListener('click', translatePage, false);
82
+ btn_1.addEventListener('click', () => {translatePage( '转为简体','转为繁体',btn_1)}, false);
83
+ }
84
+
85
+ let btn_2 = document.querySelector('.rs_hide .translate');
86
+ if (btn_2) {
87
+ btn_2.lastChild.textContent = targetEncoding === 1 ? '简' : '繁';
88
+ if (currentEncoding !== targetEncoding) {
89
+ setLang();
90
+ setTimeout(translateBody, translateDelay);
91
+ }
92
+ btn_2.addEventListener('click', () => {translatePage('简','繁',btn_2)}, false);
86
93
  }
87
94
  }
88
95