hexo-theme-solitude 1.7.2 → 1.7.4

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 CHANGED
@@ -29,7 +29,7 @@ site:
29
29
  siteIcon: /img/pwa/favicon.ico
30
30
  # 页脚的Logo、加载动画默认的logo
31
31
  # Logo in the footer, default logo for loading animation
32
- icon: /img/avatar.png
32
+ icon: /img/pwa/favicon.ico
33
33
 
34
34
  # 导航栏
35
35
  # NavBar
@@ -38,7 +38,7 @@ nav:
38
38
  # logo group
39
39
  group:
40
40
  # 项目: # 分类名称
41
- # Solitude: https://github.com/valor-x/hexo-theme-solitude || /img/logo.png # 子菜单名称(submenu name): 链接地址(address) || 图标(icon)
41
+ # Solitude: https://github.com/valor-x/hexo-theme-solitude || /img/pwa/favicon.ico # 子菜单名称(submenu name): 链接地址(address) || 图标(icon)
42
42
 
43
43
  # 中心菜单
44
44
  # center menu
@@ -164,6 +164,7 @@ aside:
164
164
  page:
165
165
  noSticky: "about"
166
166
  Sticky: "newestPost,allInfo"
167
+ position: 0 # left(0): 左侧 / right(1): 右侧
167
168
  # 侧边栏个人信息卡片
168
169
  # Sidebar personal information
169
170
  card:
@@ -172,7 +173,7 @@ aside:
172
173
  author:
173
174
  # 头像
174
175
  # Avatar
175
- img: /img/logo.png
176
+ img: /img/avatar.png
176
177
  # 表情图片链接
177
178
  # Emoticon image link
178
179
  # tip: 26x26 size
@@ -452,7 +453,7 @@ footer:
452
453
  errorpage:
453
454
  # 图片
454
455
  # image
455
- img: https://7.isyangs.cn/34/65f2e65eae32a-34.png
456
+ img: /img/404.webp
456
457
  # 文字
457
458
  # text
458
459
  text: =awa= 页面走丢了
@@ -523,7 +524,7 @@ moments:
523
524
  # example: https://example.com/
524
525
  api: # https://example.com/
525
526
  # 加载失败显示图片 / Loading failed display image
526
- error_img: /img/logo.png
527
+ error_img: /img/pwa/favicon_64.ico
527
528
  # 排序规则:created:按创建时间排序 / updated:按更新时间排序
528
529
  # Sort rule: created: Sort by creation time / updated: Sort by update time
529
530
  sort_rule: created
@@ -708,6 +709,7 @@ comment:
708
709
  commentBarrage: false # 热评开关 / Hot comment switch
709
710
  lazyload: true # 懒加载
710
711
  count: true # 评论数展示
712
+ avatar: https://cravatar.cn # Gravatar link
711
713
  newest_comment:
712
714
  enable: false
713
715
  storage: 421000 # 缓存时间
@@ -779,11 +781,11 @@ pwa:
779
781
  enable: false
780
782
  manifest: /manifest.json # manifest.json 文件路径
781
783
  theme_color: "#006a73" # 主题颜色
782
- mask_icon: /img/logo.png # 遮罩图标
783
- apple_touch_icon: /img/logo.png # 苹果触摸图标
784
- bookmark_icon: /img/logo.png # 书签图标
785
- favicon_32_32: /img/logo.png # 32x32图标
786
- favicon_16_16: /img/logo.png # 16x16图标
784
+ mask_icon: /img/pwa/favicon.ico # 遮罩图标
785
+ apple_touch_icon: /img/pwa/favicon.ico # 苹果触摸图标
786
+ bookmark_icon: /img/pwa/favicon.ico # 书签图标
787
+ favicon_32_32: /img/pwa/favicon_32.ico # 32x32图标
788
+ favicon_16_16: /img/pwa/favicon_16.ico # 16x16图标
787
789
 
788
790
  # 谷歌广告 (Google Adsense)
789
791
  google_adsense:
package/languages/en.yml CHANGED
@@ -16,19 +16,12 @@ copy_copyright:
16
16
  source: Source
17
17
  info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
18
18
 
19
- lately:
20
- second: ' second'
21
- minute: ' minute'
22
- hour: ' hour'
23
- day: ' day'
24
- month: ' month'
25
- year: ' year'
26
- ago: ' ago'
27
- error: ' NaN'
28
-
29
- chs:
30
- chs_tw: Traditional Chinese
31
- chs_cn: Simplified Chinese
19
+ time:
20
+ day: " days ago"
21
+ hour: " hours ago"
22
+ just: "just"
23
+ min: " minutes ago"
24
+ month: " months ago"
32
25
 
33
26
  page:
34
27
  tag: Tags
@@ -74,11 +67,11 @@ award:
74
67
  tipping: Tipping
75
68
  title: List of appreciation
76
69
 
77
-
78
70
  search:
79
71
  empty: No results found
80
72
  hit: Found ${query} results for you
81
73
  placeholder: Enter keywords to quickly search
74
+ count: Total <b>${count}</b> results.
82
75
 
83
76
  head:
84
77
  noscript: Please enable JavaScript to view the site
@@ -17,19 +17,12 @@ copy_copyright:
17
17
  source: 来源
18
18
  info: 著作权归作者所有。 商业转载请联系作者获得授权,非商业转载请注明出处。
19
19
 
20
- lately:
21
- second:
22
- minute: 分钟
23
- hour: 小时
24
- day:
25
- month: 个月
26
- year: 年
27
- ago: 前
28
- error: NaN
29
-
30
- chs:
31
- chs_tw: 繁體中文
32
- chs_cn: 简体中文
20
+ time:
21
+ day: "天前"
22
+ hour: "小时前"
23
+ just: "刚刚"
24
+ min: "分钟前"
25
+ month: "个月前"
33
26
 
34
27
  page:
35
28
  tag: 标签
@@ -80,6 +73,7 @@ search:
80
73
  empty: 找不到你查询的内容:${query}
81
74
  hit: 找到 ${hits} 条结果,用时 ${time} 毫秒
82
75
  placeholder: 输入关键词快速查找
76
+ count: 共 <b>${count}</b> 条结果。
83
77
 
84
78
  head:
85
79
  noscript: 开启JavaScript才能访问本站哦~
@@ -17,19 +17,12 @@ copy_copyright:
17
17
  source: 來源
18
18
  info: 著作權歸作者所有。 商業轉載請聯繫作者獲得授權,非商業轉載請註明出處。
19
19
 
20
- lately:
21
- second:
22
- minute: 分鐘
23
- hour: 小時
24
- day:
25
- month: 个月
26
- year: 年
27
- ago: 前
28
- error: NaN
29
-
30
- chs:
31
- chs_tw: 繁體中文
32
- chs_cn: 簡體中文
20
+ time:
21
+ day: "天前"
22
+ hour: "小時前"
23
+ just: "剛剛"
24
+ min: "分鐘前"
25
+ month: "個月前"
33
26
 
34
27
  page:
35
28
  tag: 標籤
@@ -80,6 +73,7 @@ search:
80
73
  empty: 找不到你查詢的內容:${query}
81
74
  hit: 找到 ${hits} 條結果,用時 ${time} 毫秒
82
75
  placeholder: 輸入關鍵詞快速查找
76
+ count: 共 <b>${count}<b> 條結果。
83
77
 
84
78
  head:
85
79
  noscript: 開啟JavaScript才能訪問本站哦~
@@ -86,6 +86,42 @@
86
86
  })
87
87
  }
88
88
 
89
+ let lang = false
90
+ lang = {
91
+ theme: {
92
+ dark: _p('theme.dark'),
93
+ light: _p('theme.light'),
94
+ },
95
+ copy: {
96
+ success: _p('copy.success'),
97
+ error: _p('copy.error'),
98
+ },
99
+ backtop: _p('nav.backtop'),
100
+ time: {
101
+ day: _p('time.day'),
102
+ hour: _p('time.hour'),
103
+ just: _p('time.just'),
104
+ min: _p('time.min'),
105
+ month: _p('time.month')
106
+ },
107
+ f12: _p('f12'),
108
+ }
109
+
110
+ if (theme.search.enable) {
111
+ lang.search = {
112
+ empty: _p('search.empty'),
113
+ hit: _p('search.hit'),
114
+ placeholder: _p('search.placeholder'),
115
+ count: _p('search.count')
116
+ }
117
+ }
118
+
119
+ if (theme.comment.enable && theme.comment.commentBarrage) {
120
+ lang.barrage = {
121
+ title: _p('commentBarrage.title'),
122
+ }
123
+ }
124
+
89
125
  script.
90
126
  const GLOBAL_CONFIG = {
91
127
  root: '!{config.root}',
@@ -105,40 +141,7 @@ script.
105
141
  syntax: '!{config.syntax_highlighter}'
106
142
  },
107
143
  randomlink: !{theme.footer.randomlink},
108
- lang: {
109
- theme: {
110
- dark: '!{_p('theme.dark')}',
111
- light: '!{_p('theme.light')}',
112
- },
113
- copy: {
114
- success: '!{_p('copy.success')}',
115
- error: '!{_p('copy.error')}',
116
- },
117
- backtop: '!{_p('nav.backtop')}',
118
- lately: {
119
- second: '!{_p('lately.second')}',
120
- minute: '!{_p('lately.minute')}',
121
- hour: '!{_p('lately.hour')}',
122
- day: '!{_p('lately.day')}',
123
- month: '!{_p('lately.month')}',
124
- year: '!{_p('lately.year')}',
125
- ago: '!{_p('lately.ago')}',
126
- error: '!{_p('lately.error')}',
127
- },
128
- search: {
129
- empty: '!{_p('search.empty')}',
130
- hit: '!{_p('search.hit')}',
131
- placeholder: '!{_p('search.placeholder')}',
132
- },
133
- chs: {
134
- chs_to_cht: '!{_p('chs.chs_tw')}',
135
- cht_to_chs: '!{_p('chs.chs_cn')}',
136
- },
137
- barrage: {
138
- title: '!{_p('commentBarrage.title')}',
139
- },
140
- f12: '!{_p('f12')}',
141
- },
144
+ lang: !{JSON.stringify(lang)},
142
145
  aside: {
143
146
  sayhello: {
144
147
  morning: '!{theme.aside.card.sayhello.morning}',
@@ -18,9 +18,6 @@ div
18
18
  // md5
19
19
  script(src=url_for(theme.cdn.blueimp_md5))
20
20
 
21
- // lately
22
- script(src=url_for(theme.cdn.lately_js))
23
-
24
21
  if theme.mermaid
25
22
  script(src=url_for(theme.cdn.mermaid_js))
26
23
 
@@ -111,7 +111,7 @@ script.
111
111
  )(window)
112
112
 
113
113
  console.log(
114
- "%c Program: Hexo %c Theme: Solitude %c Version: v1.7.2",
114
+ "%c Program: Hexo %c Theme: Solitude %c Version: v1.7.4",
115
115
  "border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
116
116
  "padding: 5px 10px;color:white;background:#3e9f50;",
117
117
  "border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
@@ -20,7 +20,7 @@ if theme.says.enable
20
20
  if item.image
21
21
  .bber-content-img
22
22
  each img in item.image
23
- img(src=img title="即刻短文配图")
23
+ img(src=img alt="image")
24
24
 
25
25
  if item.aplayer
26
26
  .bber-music
@@ -41,7 +41,7 @@ if theme.says.enable
41
41
  i.solitude.st-calendar-todo-fill
42
42
  time.datetime(datetime=moment(item.date).format())
43
43
  if item.link
44
- a.bber-content-link(href=url_for(item.link) title="跳转到短文指引的链接" target="_blank")
44
+ a.bber-content-link(href=url_for(item.link) target="_blank")
45
45
  i.solitude.st-link-m-line
46
46
  | 链接
47
47
  if item.content
package/layout/index.pug CHANGED
@@ -1,11 +1,12 @@
1
1
  extends includes/layout
2
2
 
3
3
  block content
4
- #home_top
5
- if theme.says.home_mini
6
- include ./includes/widgets/home/bbTimeList
7
- if theme.hometop.enable && is_home_first_page()
8
- include ./includes/widgets/home/hometop
4
+ if theme.hometop.enable || theme.says.home_mini
5
+ #home_top
6
+ if theme.says.home_mini
7
+ include ./includes/widgets/home/bbTimeList
8
+ if theme.hometop.enable && is_home_first_page()
9
+ include ./includes/widgets/home/hometop
9
10
  main.layout#content-inner
10
11
  .recent-posts#recent-posts
11
12
  #category-bar
@@ -15,6 +16,5 @@ block content
15
16
 
16
17
  // pageination
17
18
  include ./includes/mixins/pagination
18
-
19
19
  // aside
20
20
  include ./includes/widgets/aside/aside
package/layout/post.pug CHANGED
@@ -17,7 +17,8 @@ block content
17
17
  span.tagsPageCount #{data.length}
18
18
  if site.posts.length > 1
19
19
  include includes/widgets/post/postNav
20
- != related_posts(page, site.posts)
20
+ if theme.related_post.enable
21
+ != related_posts(page, site.posts)
21
22
  if page.comment
22
23
  include includes/widgets/third-party/comments/comment
23
24
  include includes/widgets/aside/aside
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "1.7.2",
4
- "description": "A beautiful, powerful, and efficient Hexo theme developed by the wleelw",
3
+ "version": "1.7.4",
4
+ "description": "A beautiful, powerful, and efficient Hexo theme developed by the efu.",
5
5
  "main": "package.json",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -26,7 +26,7 @@
26
26
  "url": "https://github.com/valor-x/hexo-theme-solitude/issues",
27
27
  "email": "o@efu.me"
28
28
  },
29
- "homepage": "https://solitude-demo.efu.me/",
29
+ "homepage": "https://efu.me/",
30
30
  "author": "Hexo-Theme-Solitude<o@efu.me>",
31
31
  "license": "MIT"
32
32
  }
@@ -83,12 +83,7 @@ hexo.extend.filter.register('before_generate', () => {
83
83
  name: 'hexo-theme-solitude',
84
84
  file: 'js/third_party/universe.min.js',
85
85
  version
86
- },
87
- lately_js: {
88
- name: 'hexo-theme-solitude',
89
- file: 'js/third_party/lately.min.js',
90
- version
91
- },
86
+ }
92
87
  }
93
88
 
94
89
  const minFile = file => {
@@ -3,7 +3,7 @@ hexo.extend.filter.register('before_generate', () => {
3
3
  site: {
4
4
  name: {
5
5
  class: 'text', custom: 'Solitude'
6
- }, siteIcon: '/img/logo.png', icon: 'icon'
6
+ }, siteIcon: '/img/pwa/favicon.ico', icon: 'icon'
7
7
  }, nav: {
8
8
  group: null, menu: null, right: {
9
9
  random: false, console: false, custom: [],
@@ -82,9 +82,10 @@ hexo.extend.filter.register('before_generate', () => {
82
82
  comment: false,
83
83
  }, award: {
84
84
  enable: false,
85
- wechat: 'https://7.isyangs.cn/34/65f2e5814db1a-34.png',
86
- alipay: 'https://7.isyangs.cn/34/65f2e5a6d2ef5-34.png',
87
- url: '/about/',
85
+ appreciators: '/',
86
+ title: '感谢您的赞赏。',
87
+ desc: '因为有你们的支持,我才体会到写文章的价值。',
88
+ list: [],
88
89
  }, rss: null, covercolor: {
89
90
  enable: false, mode: 'local', api: 'https://api.qjqq.cn/api/Imgcolor?img=', time: 43200000,
90
91
  }
@@ -1,14 +1,12 @@
1
1
  hexo.on('ready', () => {
2
2
  const {version} = require('../../package.json')
3
3
  hexo.log.info(`
4
- ===================================================================
5
- ##### #### # ##### ###### # # ###### ######
6
- # # # # # # # # # # #
7
- ##### # # # # # # # # # ######
8
- # # # # # # # # # # #
9
- ###### #### ##### ##### # ### ###### ######
10
- ${version}
11
- ===================================================================
12
- GitHub: https://github.com/valor-x/hexo-theme-solitude
4
+ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮
5
+ │ │
6
+ Theme: Solitude │
7
+ Version: v${version} │
8
+ Changelog: https://github.com/valor-x/hexo-theme-solitude/releases/tag/v${version} │
9
+ │ │
10
+ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯
13
11
  `)
14
12
  })
@@ -10,7 +10,7 @@ hexo.extend.filter.register('after_post_render', function (data) {
10
10
  data.cc = data.cc || copyright
11
11
  data.cover = data.cover || cover[getRandomInt(0, cover?.length)]
12
12
  data.excerpt = data.description || data.excerpt
13
- data.toc = !!(config.aside.toc.post && data.toc !== false);
13
+ data.toc = !!(config.aside.toc.post && data.toc !== false)
14
14
  }
15
15
  if (data.layout === 'page') {
16
16
  let {cover} = hexo.theme.config.page.default
@@ -389,7 +389,7 @@ i.solitude
389
389
  +maxWidth1200()
390
390
  width 100%
391
391
 
392
- > div:first-child:not(.recent-posts)
392
+ > div:first-child:not(.recent-posts,.aside-content)
393
393
  box-shadow var(--efu-shadow-border)
394
394
  padding 1rem 2rem
395
395
  border-radius 12px
@@ -398,6 +398,8 @@ i.solitude
398
398
  align-self flex-start
399
399
  animation slide-in .6s .1s backwards
400
400
  position relative
401
+ if hexo-config('aside.position') == 0
402
+ order 2
401
403
 
402
404
  +maxWidth768()
403
405
  box-shadow none
@@ -194,4 +194,11 @@
194
194
 
195
195
  h4
196
196
  font-size 1.1rem
197
- line-height 1.3
197
+ line-height 1.3
198
+
199
+ if hexo-config('mediumZoom')
200
+ .medium-zoom--opened .medium-zoom-overlay
201
+ z-index 10
202
+
203
+ .medium-zoom-image--opened
204
+ z-index 11
@@ -15,8 +15,11 @@
15
15
  display none
16
16
 
17
17
  +minWidth1300()
18
- padding-left 1rem
19
18
  animation slide-in .6s .3s backwards
19
+ if hexo-config('aside.position') == 0
20
+ padding-right 1rem
21
+ else
22
+ padding-left 1rem
20
23
 
21
24
  .item-headline
22
25
  padding-bottom 0
@@ -1,4 +1,4 @@
1
- #$about-page
1
+ #about-page
2
2
  display flex
3
3
  padding-top 1rem
4
4
  flex-direction column
@@ -1,11 +1,12 @@
1
- #home_top
2
- max-width 1400px
3
- margin .5rem auto auto
4
- padding 0 1.5rem
1
+ if hexo-config('hometop.enable') || hexo-config('says.enable')
2
+ #home_top
3
+ max-width 1400px
4
+ margin .5rem auto auto
5
+ padding 0 1.5rem
5
6
 
6
- +maxWidth768()
7
- padding 0
8
- margin-top 0
7
+ +maxWidth768()
8
+ padding 0
9
+ margin-top 0
9
10
 
10
11
  if hexo-config('hometop.enable')
11
12
  @import "home-top.styl"
@@ -1,3 +1,7 @@
1
+ #recent-posts
2
+ if hexo-config('aside.position') == 0
3
+ order 2
4
+
1
5
  if hexo-config('index_post_list.direction') == "column"
2
6
  #recent-posts
3
7
  position relative
@@ -1,6 +1,6 @@
1
1
  div#banners
2
2
  display none
3
- +minWidth1200()
3
+ +minWidth1201()
4
4
  display flex
5
5
  width 100%
6
6
  height 100%
Binary file
Binary file
package/source/js/main.js CHANGED
@@ -332,14 +332,17 @@ let sco = {
332
332
  },
333
333
  addRuntime: function () {
334
334
  let el = document.getElementById('runtimeshow')
335
- el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.lately.day)
335
+ el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.time.day)
336
336
  },
337
337
  toTalk: function (txt) {
338
338
  const inputs = ["#wl-edit", ".el-textarea__inner"]
339
339
  for (let i = 0; i < inputs.length; i++) {
340
340
  let el = document.querySelector(inputs[i])
341
341
  if (el != null) {
342
- el.dispatchEvent(new Event('input', {bubble: true, cancelable: true}))
342
+ el.dispatchEvent(new Event('input', {
343
+ bubble: true,
344
+ cancelable: true
345
+ }))
343
346
  el.value = '> ' + txt.replace(/\n/g, '\n> ') + '\n\n'
344
347
  utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300)
345
348
  el.focus()
@@ -383,12 +386,31 @@ let sco = {
383
386
  const timeNow = new Date();
384
387
  const hours = timeNow.getHours();
385
388
  const lang = GLOBAL_CONFIG.aside.sayhello;
386
- const greetings = [
387
- {start: 0, end: 5, text: lang.goodnight},
388
- {start: 6, end: 10, text: lang.morning},
389
- {start: 11, end: 14, text: lang.noon},
390
- {start: 15, end: 18, text: lang.afternoon},
391
- {start: 19, end: 24, text: lang.night},
389
+ const greetings = [{
390
+ start: 0,
391
+ end: 5,
392
+ text: lang.goodnight
393
+ },
394
+ {
395
+ start: 6,
396
+ end: 10,
397
+ text: lang.morning
398
+ },
399
+ {
400
+ start: 11,
401
+ end: 14,
402
+ text: lang.noon
403
+ },
404
+ {
405
+ start: 15,
406
+ end: 18,
407
+ text: lang.afternoon
408
+ },
409
+ {
410
+ start: 19,
411
+ end: 24,
412
+ text: lang.night
413
+ },
392
414
  ];
393
415
  for (let greeting of greetings) {
394
416
  if (hours >= greeting.start && hours <= greeting.end) {
@@ -631,6 +653,13 @@ let sco = {
631
653
 
632
654
  document.addEventListener('mouseover', debounce(showOwoBig, 100));
633
655
  document.addEventListener('mouseout', hideOwoBig);
656
+ },
657
+ changeTimeFormat(selector) {
658
+ selector.forEach(item => {
659
+ const timeVal = item.getAttribute('datetime')
660
+ item.textContent = utils.diffDate(timeVal, true)
661
+ item.style.display = 'inline'
662
+ })
634
663
  }
635
664
  }
636
665
 
@@ -638,7 +667,12 @@ const addHighlight = () => {
638
667
  const highlight = GLOBAL_CONFIG.highlight;
639
668
  if (!highlight) return;
640
669
 
641
- const {copy, expand, limit, syntax} = highlight;
670
+ const {
671
+ copy,
672
+ expand,
673
+ limit,
674
+ syntax
675
+ } = highlight;
642
676
  const $isPrismjs = syntax === 'prismjs';
643
677
  const $isShowTool = highlight.enable || copy || expand || limit;
644
678
  const expandClass = !expand === true ? 'closed' : ''
@@ -722,7 +756,9 @@ const addHighlight = () => {
722
756
  $syntaxHighlight.forEach(item => {
723
757
  const langName = item.getAttribute('data-language') || 'Code'
724
758
  const highlightLangEle = `<div class="code-lang">${langName}</div>`
725
- utils.wrap(item, 'figure', {class: 'highlight'})
759
+ utils.wrap(item, 'figure', {
760
+ class: 'highlight'
761
+ })
726
762
  createEle(highlightLangEle, item)
727
763
  })
728
764
  } else {
@@ -737,7 +773,13 @@ const addHighlight = () => {
737
773
 
738
774
  const addCopyright = () => {
739
775
  if (!GLOBAL_CONFIG.copyright) return
740
- const {limit, author, link, source, info} = GLOBAL_CONFIG.copyright
776
+ const {
777
+ limit,
778
+ author,
779
+ link,
780
+ source,
781
+ info
782
+ } = GLOBAL_CONFIG.copyright
741
783
  const handleCopy = (e) => {
742
784
  e.preventDefault()
743
785
  const copyText = window.getSelection(0).toString()
@@ -792,11 +834,17 @@ class tabs {
792
834
  }
793
835
 
794
836
  window.refreshFn = () => {
837
+ if (PAGE_CONFIG.is_home) {
838
+ sco.changeTimeFormat(document.querySelectorAll('#recent-posts time'))
839
+ GLOBAL_CONFIG.runtime && sco.addRuntime()
840
+ } else {
841
+ sco.changeTimeFormat(document.querySelectorAll('#post-meta time'))
842
+ }
843
+
795
844
  sco.initAdjust()
796
845
  scrollFn()
797
846
  sidebarFn()
798
847
  initObserver()
799
- sco.addRuntime()
800
848
  sco.hideCookie()
801
849
  sco.addPhotoFigcaption()
802
850
  sco.setTimeState()
@@ -804,7 +852,6 @@ window.refreshFn = () => {
804
852
  sco.categoriesBarActive()
805
853
  sco.listenToPageInputPress()
806
854
  sco.addNavBackgroundInit()
807
- utils.changeTimeFormat()
808
855
  GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg()
809
856
  GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar)"))
810
857
  GLOBAL_CONFIG.randomlink && randomLinksList()
@@ -830,4 +877,4 @@ window.onkeydown = function (e) {
830
877
  (27 === e.keyCode) && sco.hideConsole();
831
878
  }
832
879
 
833
- document.addEventListener('copy', () => utils.snackbarShow(GLOBAL_CONFIG.lang.copy.success,false,3e3))
880
+ document.addEventListener('copy', () => utils.snackbarShow(GLOBAL_CONFIG.lang.copy.success, false, 3e3))
@@ -42,7 +42,7 @@ window.onload = () => {
42
42
  searchClickFn();
43
43
 
44
44
  function initLunr() {
45
- fetch("/search.xml")
45
+ fetch(GLOBAL_CONFIG.localsearch.path)
46
46
  .then(response => response.text())
47
47
  .then(data => {
48
48
  let parser = new DOMParser();
@@ -128,14 +128,13 @@ window.onload = () => {
128
128
  const $link = document.createElement("a");
129
129
  $link.className = "search-result-title";
130
130
  $link.href = result.link;
131
- const title = highlightSearchKeyword(result.title, query);
132
- $link.innerHTML = title;
131
+ $link.innerHTML = highlightSearchKeyword(result.title, query);
133
132
  $result.appendChild($link);
134
133
  $search_results.appendChild($result);
135
134
  });
136
135
  const count = document.createElement("span");
137
136
  count.className = "search-result-count";
138
- count.innerHTML = `共 <b>${results.length}</b> 条结果`;
137
+ count.innerHTML = GLOBAL_CONFIG.lang.search.count.replace(/\$\{count}/, results.length)
139
138
  $tips.appendChild(count);
140
139
  }
141
140
 
@@ -72,7 +72,10 @@ const utils = {
72
72
  const dur = (typeof duration !== 'undefined') ? duration : 5000
73
73
  document.styleSheets[0].addRule(':root', '--efu-snackbar-time:' + dur + 'ms!important')
74
74
  Snackbar.show({
75
- text: text, showAction: sa, duration: dur, pos: 'top-center'
75
+ text: text,
76
+ showAction: sa,
77
+ duration: dur,
78
+ pos: 'top-center'
76
79
  })
77
80
  },
78
81
 
@@ -109,7 +112,8 @@ const utils = {
109
112
  if (currentPos > pos || isNavFixed) pos = pos - 70
110
113
  if ('scrollBehavior' in document.documentElement.style) {
111
114
  window.scrollTo({
112
- top: pos, behavior: 'smooth'
115
+ top: pos,
116
+ behavior: 'smooth'
113
117
  })
114
118
  return
115
119
  }
@@ -175,7 +179,10 @@ const utils = {
175
179
  },
176
180
  lazyloadImg: function () {
177
181
  window.lazyLoadInstance = new LazyLoad({
178
- elements_selector: 'img', threshold: 0, data_src: 'lazy-src', callback_error: (img) => {
182
+ elements_selector: 'img',
183
+ threshold: 0,
184
+ data_src: 'lazy-src',
185
+ callback_error: (img) => {
179
186
  img.setAttribute("src", GLOBAL_CONFIG.lazyload.error);
180
187
  }
181
188
  })
@@ -184,7 +191,9 @@ const utils = {
184
191
  const lightbox = GLOBAL_CONFIG.lightbox
185
192
 
186
193
  if (lightbox === 'mediumZoom' && mediumZoom) {
187
- mediumZoom(selector, {background: "var(--efu-card-bg)"});
194
+ mediumZoom(selector, {
195
+ background: "var(--efu-card-bg)"
196
+ });
188
197
  }
189
198
 
190
199
  if (lightbox === 'fancybox') {
@@ -204,15 +213,19 @@ const utils = {
204
213
 
205
214
  if (!window.fancyboxRun) {
206
215
  Fancybox.bind('[data-fancybox]', {
207
- Hash: false, Thumbs: {
216
+ Hash: false,
217
+ Thumbs: {
208
218
  showOnStart: false
209
- }, Images: {
219
+ },
220
+ Images: {
210
221
  Panzoom: {
211
222
  maxScale: 4
212
223
  }
213
- }, Carousel: {
224
+ },
225
+ Carousel: {
214
226
  transition: 'slide'
215
- }, Toolbar: {
227
+ },
228
+ Toolbar: {
216
229
  display: {
217
230
  left: ['infobar'],
218
231
  middle: ['zoomIn', 'zoomOut', 'toggle1to1', 'rotateCCW', 'rotateCW', 'flipX', 'flipY'],
@@ -230,6 +243,32 @@ const utils = {
230
243
  lang: GLOBAL_CONFIG.lang.lately,
231
244
  })
232
245
  },
246
+ diffDate: (d, more = false) => {
247
+ const dateNow = new Date()
248
+ const datePost = new Date(d)
249
+ const dateDiff = dateNow.getTime() - datePost.getTime()
250
+ const minute = 1000 * 60
251
+ const hour = minute * 60
252
+ const day = hour * 24
253
+ const month = day * 30
254
+ const {
255
+ time
256
+ } = GLOBAL_CONFIG.lang
257
+
258
+ if (!more) return parseInt(dateDiff / day)
259
+
260
+ const monthCount = dateDiff / month
261
+ const dayCount = dateDiff / day
262
+ const hourCount = dateDiff / hour
263
+ const minuteCount = dateDiff / minute
264
+
265
+ if (monthCount > 12) return datePost.toISOString().slice(0, 10)
266
+ if (monthCount >= 1) return `${parseInt(monthCount)} ${time.month}`
267
+ if (dayCount >= 1) return `${parseInt(dayCount)} ${time.day}`
268
+ if (hourCount >= 1) return `${parseInt(hourCount)} ${time.hour}`
269
+ if (minuteCount >= 1) return `${parseInt(minuteCount)} ${time.min}`
270
+ return time.just
271
+ },
233
272
  loadComment: (dom, callback) => {
234
273
  if ('IntersectionObserver' in window) {
235
274
  const observerItem = new IntersectionObserver((entries) => {
@@ -237,7 +276,9 @@ const utils = {
237
276
  callback()
238
277
  observerItem.disconnect()
239
278
  }
240
- }, { threshold: [0] })
279
+ }, {
280
+ threshold: [0]
281
+ })
241
282
  observerItem.observe(dom)
242
283
  } else {
243
284
  callback()