hexo-theme-solitude 1.8.3 → 1.8.5

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.
@@ -8,10 +8,10 @@ contact_links:
8
8
  url: https://solitude-docs.efu.me/faq
9
9
  about: Solitude Q&A
10
10
 
11
+ - name: Discord
12
+ url: https://discord.gg/Y8VEvVgW
13
+ about: 'Official Discord Group'
14
+
11
15
  - name: Telegram
12
- url: https://t.me/efuome
16
+ url: https://t.me/solitudePro
13
17
  about: 'Official Telegram Group'
14
-
15
- - name: QQ 群
16
- url: https://qm.qq.com/q/VlqOewI4Cu
17
- about: '群号 773016811'
package/_config.yml CHANGED
@@ -410,6 +410,7 @@ footer:
410
410
  # 底部上方一排图标
411
411
  # Bottom row of icons
412
412
  information:
413
+ author: false # 是否显示 site_icon / enable site_icon in footer
413
414
  left: # 左侧显示图标
414
415
  # Github: https://github.com/efuo || st-github-line # 名称:链接 || 图标 / Name: link || icon
415
416
  # Mail: mailto:o@efu.me || st-mail-line
@@ -11,7 +11,7 @@ case theme.display_mode.type
11
11
  } else {
12
12
  document.documentElement.setAttribute('data-theme', cachedMode);
13
13
  }
14
- right_menu && rm.mode(cachedMode === 'dark' && isDarkMode)
14
+ is_rm && rm.mode(cachedMode === 'dark' && isDarkMode)
15
15
  }
16
16
  initTheme()
17
17
  when "dark"
@@ -22,7 +22,7 @@ case theme.display_mode.type
22
22
  document.documentElement.setAttribute('data-theme', 'dark');
23
23
  else
24
24
  document.documentElement.setAttribute('data-theme', cachedMode);
25
- right_menu && rm.mode(cachedMode === undefined || cachedMode === 'dark')
25
+ is_rm && rm.mode(cachedMode === undefined || cachedMode === 'dark')
26
26
  }
27
27
  initTheme()
28
28
  when "light"
@@ -33,6 +33,6 @@ case theme.display_mode.type
33
33
  document.documentElement.setAttribute('data-theme', 'light');
34
34
  else
35
35
  document.documentElement.setAttribute('data-theme', cachedMode);
36
- right_menu && rm.mode(cachedMode === 'dark')
36
+ is_rm && rm.mode(cachedMode === 'dark')
37
37
  }
38
38
  initTheme()
@@ -17,8 +17,9 @@ div#footer_deal
17
17
  a.deal_link(href=url_for(trim(array[0])), title=label)
18
18
  i.solitude(class=array[1])
19
19
 
20
- div#footer_mini_logo.nolazyload.footer_mini_logo(title=_p('nav.backtop'), onclick="sco.toTop()")
21
- img(src=theme.site.icon, alt=_p('nav.backtop'))
20
+ if theme.footer.information.author
21
+ div#footer_mini_logo.nolazyload.footer_mini_logo(title=_p('nav.backtop'), onclick="sco.toTop()")
22
+ img(src=theme.site.icon, alt=_p('nav.backtop'))
22
23
 
23
24
  each value, label in rightInfo
24
25
  - var array = value.split('||')
@@ -26,7 +26,7 @@
26
26
 
27
27
  let comment = false
28
28
 
29
- if (theme.comment.use) {
29
+ if (theme.comment.use && theme.comment.commentBarrage) {
30
30
  comment = {
31
31
  avatar: theme.comment.avatar,
32
32
  commentBarrage: theme.comment.commentBarrage,
@@ -6,4 +6,5 @@ script#config-diff.
6
6
  page: '!{page.type}',
7
7
  toc: !{!!page.toc},
8
8
  comment: !{!!page.comment},
9
+ ai_text: !{is_post && page.ai_text ? "'"+ page.ai_text+"'" : false},
9
10
  }
@@ -11,6 +11,8 @@ mixin katex
11
11
  })();
12
12
 
13
13
  div
14
+ script(src=url_for(theme.cdn.utils))
15
+ script(src=url_for(theme.cdn.main))
14
16
  script(src=url_for(theme.cdn.waterfall))
15
17
  script(src=url_for(theme.cdn.pjax))
16
18
 
@@ -22,7 +24,7 @@ div
22
24
  script.
23
25
  dark()
24
26
 
25
- if theme.right_menu.translate.enable
27
+ if theme.right_menu.enable && theme.right_menu.translate.enable
26
28
  script(src=url_for(theme.cdn.translate_js))
27
29
 
28
30
  if theme.katex && theme.katex.enable
@@ -91,8 +93,12 @@ div
91
93
  carousel_swiper()
92
94
  if page.type === 'says' && theme.says.enable
93
95
  script.
94
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
95
- sco.changeTimeFormat(document.querySelectorAll('.bber-info-time time'))
96
+ setTimeout(() => {
97
+ sco.refreshWaterFall();
98
+ GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg();
99
+ GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
100
+ sco.changeTimeFormat(document.querySelectorAll('.info time'));
101
+ }, 500)
96
102
  if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv)
97
103
  script(async src=url_for(theme.cdn.busuanzi_js))
98
104
 
@@ -104,7 +110,7 @@ if theme.footer.randomlink
104
110
  include ../widgets/third-party/news-comment/newest-comment.pug
105
111
 
106
112
  // pjax
107
- include ../widgets/third-party/pjax.pug
113
+ != partial("includes/widgets/third-party/pjax", {}, { cache: true })
108
114
 
109
115
  // theme
110
116
  include ../body/mode
@@ -28,7 +28,7 @@ if theme.pwa.enable
28
28
 
29
29
  script.
30
30
  console.log(
31
- "%c Program: Hexo %c Theme: Solitude %c Version: v1.8.3",
31
+ "%c Program: Hexo %c Theme: Solitude %c Version: v1.8.5",
32
32
  "border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
33
33
  "padding: 5px 10px;color:white;background:#3e9f50;",
34
34
  "border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
@@ -38,5 +38,4 @@ if theme.extends.head
38
38
  each item in theme.extends.head
39
39
  != item
40
40
 
41
- script(src=url_for(theme.cdn.utils))
42
- script(src=url_for(theme.cdn.main))
41
+ !=fragment_cache('injectHeadJs', function(){return inject_head_js()})
@@ -51,4 +51,4 @@ if theme.says.enable
51
51
  if theme.says.strip === -1
52
52
  | - 已展开所有短文 -
53
53
  else
54
- | - 只展示最近 #{theme.says.strip} 条短文 -
54
+ | - 只展示最近 #{theme.says.strip} 条短文 -
@@ -59,7 +59,7 @@ div#rightMenu
59
59
  if theme.right_menu.commentBarrage && theme.comment.use && theme.comment.commentBarrage
60
60
  div.rightMenu-item#menu-commentBarrage(onclick="sco.switchCommentBarrage()")
61
61
  i.solitude.st-chat-fill
62
- span.menu-commentBarrage-text= _p('right_menu.barrage.open')
62
+ span.menu-commentBarrage-text= _p('right_menu.barrage.close')
63
63
  div.rightMenu-item#menu-darkmode(onclick="sco.switchDarkMode()")
64
64
  i.solitude.st-moon-clear-fill
65
65
  case theme.display_mode.type
@@ -1,3 +1,4 @@
1
+ - const {copyright} = theme.post.default
1
2
  .post-copyright
2
3
  .post-copyright__author_group
3
4
  a.post-copyright__author_img(href=url_for("/about/"))
@@ -14,7 +15,7 @@
14
15
  a.reward-link-button(href=url_for(theme.post.rss))
15
16
  i.solitude.st-plant-fill
16
17
  = _p('footer.rss')
17
- if theme.post.default.copyright.enable || page.copyright
18
+ if copyright.enable || page.copyright
18
19
  .post-copyright__notice
19
20
  span.post-copyright-info
20
21
  if page.reprint
@@ -24,4 +25,4 @@
24
25
  a(href=url_for(theme.post.default.copyright.licenurl))
25
26
  | #{theme.post.default.copyright.license}
26
27
  = _p('post.copyright.original_end')
27
- a(href=url_for("/")) #{config.title}
28
+ a(href=url_for("/")) #{config.title}
@@ -2,7 +2,7 @@
2
2
  - const { lazyload, count ,use} = theme.comment
3
3
 
4
4
  script.
5
- !function () {
5
+ (() => {
6
6
  let artalkItem = null
7
7
  const initArtalk = () => {
8
8
  artalkItem = Artalk.init({
@@ -31,7 +31,7 @@ script.
31
31
  utils.addGlobalFn('pjax', destroyArtalk, 'destroyArtalk')
32
32
  }
33
33
  const loadArtalk = async () => {
34
- if (typeof Artalk === 'object') await initArtalk()
34
+ if (typeof Artalk === 'object') initArtalk()
35
35
  else {
36
36
  await utils.getCSS('!{theme.cdn.artalk_css}')
37
37
  await utils.getScript('!{theme.cdn.artalk_js}').then(initArtalk)
@@ -50,7 +50,7 @@ script.
50
50
  } else {
51
51
  window.loadTwoComment = loadArtalk
52
52
  }
53
- }()
53
+ })()
54
54
 
55
55
  if commentBarrage
56
56
  script.
@@ -1,8 +1,8 @@
1
1
  - const { envId, region, option ,accessToken } = theme.twikoo
2
2
  - const { lazyload, count, use,commentBarrage } = theme.comment
3
3
 
4
- script.
5
- !function () {
4
+ script().
5
+ (() => {
6
6
  const getCount = () => {
7
7
  const ele = document.querySelectorAll('.twikoo-count')
8
8
  if (!ele) return
@@ -17,11 +17,12 @@ script.
17
17
  console.error(err)
18
18
  })
19
19
  }
20
- const init = async () => {
20
+ const init = () => {
21
21
  twikoo.init(Object.assign({
22
22
  el: '#twikoo-wrap',
23
23
  envId: '!{envId}',
24
24
  region: '!{region}',
25
+ path: window.location.pathname,
25
26
  onCommentLoaded: () => {
26
27
  utils.lightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
27
28
  }
@@ -33,11 +34,11 @@ script.
33
34
  item: '.OwO-items li'
34
35
  })
35
36
 
36
- if (!{commentBarrage}) await barrageTwikoo()
37
+ barrageTwikoo()
37
38
  }
38
39
 
39
40
  const loadTwikoo = () => {
40
- if (typeof twikoo === 'object') init()
41
+ if (typeof twikoo === 'object') setTimeout(init,0)
41
42
  else utils.getScript('!{url_for(theme.cdn.twikoo)}').then(init)
42
43
  }
43
44
 
@@ -45,9 +46,9 @@ script.
45
46
  if (!{lazyload}) utils.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
46
47
  else loadTwikoo()
47
48
  } else {
48
- window.loadTwoComment = init
49
+ window.loadTwoComment = loadTwikoo
49
50
  }
50
- }()
51
+ })()
51
52
 
52
53
  if commentBarrage
53
54
  script.
@@ -6,7 +6,7 @@ if site.data.valine
6
6
  - emojiMaps = JSON.stringify(site.data.valine)
7
7
 
8
8
  script.
9
- !function () {
9
+ (() => {
10
10
  const initValine = () => {
11
11
  const valine = new Valine({
12
12
  el: '#vcomment',
@@ -23,7 +23,7 @@ script.
23
23
  sco.owoBig({body: '.vwrap', item: '.vemojis i'})
24
24
  }
25
25
  const loadValine = async () => {
26
- if (typeof Valine === 'function') await initValine()
26
+ if (typeof Valine === 'function') setTimeout(initValine, 0)
27
27
  else {
28
28
  await utils.getScript('!{url_for(theme.cdn.valine)}').then(initValine)
29
29
  }
@@ -35,7 +35,7 @@ script.
35
35
  } else {
36
36
  window.loadTwoComment = loadValine
37
37
  }
38
- }()
38
+ })()
39
39
 
40
40
  if commentBarrage
41
41
  script.
@@ -2,7 +2,7 @@
2
2
  - const { lazyload, count, commentBarrage,use } = theme.comment
3
3
 
4
4
  script.
5
- !function () {
5
+ (() => {
6
6
  let walineInitFunction = window.walineFn || null
7
7
 
8
8
  function initWaline(initFn) {
@@ -40,7 +40,7 @@ script.
40
40
  if (!{lazyload}) utils.loadComment(document.getElementById('waline-wrap'), loadWaline)
41
41
  else loadWaline()
42
42
  } else window.loadTwoComment = loadWaline
43
- }()
43
+ })()
44
44
 
45
45
  if commentBarrage
46
46
  script.
@@ -17,6 +17,17 @@ script.
17
17
 
18
18
  document.addEventListener('pjax:complete', () => {
19
19
  window.refreshFn()
20
+
21
+ document.querySelectorAll('script[data-pjax]').forEach(item => {
22
+ const newScript = document.createElement('script')
23
+ const content = item.text || item.textContent || item.innerHTML || ""
24
+ Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
25
+ newScript.appendChild(document.createTextNode(content))
26
+ item.parentNode.replaceChild(newScript, item)
27
+ })
28
+
29
+ GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()
30
+
20
31
  })
21
32
 
22
33
  document.addEventListener('pjax:error', (e) => {
package/layout/index.pug CHANGED
@@ -16,7 +16,7 @@ block content
16
16
  for post, index in page.posts.sort("-sticky" || "-date").data
17
17
  include ./includes/widgets/home/postList
18
18
 
19
- // pageination
19
+ // pagination
20
20
  include ./includes/mixins/pagination
21
21
  // aside
22
22
  include ./includes/widgets/aside/aside
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "1.8.3",
3
+ "version": "1.8.5",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by the efu.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -152,6 +152,7 @@ hexo.extend.filter.register('before_generate', () => {
152
152
  },
153
153
  footer: {
154
154
  information: {
155
+ author: false,
155
156
  left: null,
156
157
  right: null,
157
158
  },
@@ -1,14 +1,14 @@
1
1
  hexo.on('ready', () => {
2
- const {version} = require('../../package.json')
3
- hexo.log.info(`
4
- ===================================================================
5
- ##### #### # ##### ###### # # ###### ######
6
- # # # # # # # # # # #
7
- ##### # # # # # # # # # ######
8
- # # # # # # # # # # #
9
- ###### #### ##### ##### # ### ###### ######
10
- ${version}
11
- ===================================================================
12
- GitHub: https://github.com/valor-x/hexo-theme-solitude
13
- `)
2
+ const {version} = require('../../package.json')
3
+ hexo.log.info(`
4
+ ===================================================================
5
+ ##### #### # ##### ###### # # ###### ######
6
+ # # # # # # # # # # #
7
+ ##### # # # # # # # # # ######
8
+ # # # # # # # # # # #
9
+ ###### #### ##### ##### # ### ###### ######
10
+ ${version}
11
+ ===================================================================
12
+ GitHub: https://github.com/valor-x/hexo-theme-solitude
13
+ `)
14
14
  })
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Solitude
3
+ * inject is to head
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ hexo.extend.helper.register('inject_head_js', function () {
9
+ const createJS = () => `
10
+ const saveToLocal = {
11
+ set: function setWithExpiry(key, value, ttl) {
12
+ if (ttl === 0)
13
+ return
14
+ const now = new Date()
15
+ const expiryDay = ttl * 86400000
16
+ const item = {
17
+ value: value,
18
+ expiry: now.getTime() + expiryDay
19
+ }
20
+ localStorage.setItem(key, JSON.stringify(item))
21
+ },
22
+ get: function getWithExpiry(key) {
23
+ const itemStr = localStorage.getItem(key)
24
+
25
+ if (!itemStr) {
26
+ return undefined
27
+ }
28
+ const item = JSON.parse(itemStr)
29
+ const now = new Date()
30
+
31
+ if (now.getTime() > item.expiry) {
32
+ localStorage.removeItem(key)
33
+ return undefined
34
+ }
35
+ return item.value
36
+ }
37
+ };
38
+ window.utils = {
39
+ saveToLocal: saveToLocal,
40
+ getCSS: (url, id = false) => new Promise((resolve, reject) => {
41
+ const link = document.createElement('link')
42
+ link.rel = 'stylesheet'
43
+ link.href = url
44
+ if (id) link.id = id
45
+ link.onerror = reject
46
+ link.onload = link.onreadystatechange = function() {
47
+ const loadState = this.readyState
48
+ if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
49
+ link.onload = link.onreadystatechange = null
50
+ resolve()
51
+ }
52
+ document.head.appendChild(link)
53
+ }),
54
+ getScript: (url, attr = {}) => new Promise((resolve, reject) => {
55
+ const script = document.createElement('script')
56
+ script.src = url
57
+ script.async = true
58
+ script.onerror = reject
59
+ script.onload = script.onreadystatechange = function() {
60
+ const loadState = this.readyState
61
+ if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
62
+ script.onload = script.onreadystatechange = null
63
+ resolve()
64
+ }
65
+
66
+ Object.keys(attr).forEach(key => {
67
+ script.setAttribute(key, attr[key])
68
+ })
69
+
70
+ document.head.appendChild(script)
71
+ }),
72
+ addGlobalFn: (key, fn, name = false, parent = window) => {
73
+ const globalFn = parent.globalFn || {}
74
+ const keyObj = globalFn[key] || {}
75
+
76
+ if (name && keyObj[name]) return
77
+
78
+ name = name || Object.keys(keyObj).length
79
+ keyObj[name] = fn
80
+ globalFn[key] = keyObj
81
+ parent.globalFn = globalFn
82
+ },
83
+ }
84
+ `
85
+ return `<script>(()=>{${createJS()}})()</script>`
86
+ })
@@ -80,20 +80,21 @@
80
80
  background var(--efu-main)
81
81
  transform scale(1.1)
82
82
 
83
- .footer_mini_logo
84
- width 50px
85
- height 50px
86
- margin 0 1rem
87
- cursor pointer
88
- transition cubic-bezier(0, 0, 0, 1.29) .5s
89
- user-select none
90
- border-radius 50px
91
- overflow hidden
92
- +maxWidth768()
93
- display none
94
-
95
- &:hover
96
- transform scale(1.2)
83
+ if hexo-config('footer.information.author')
84
+ .footer_mini_logo
85
+ width 50px
86
+ height 50px
87
+ margin 0 1rem
88
+ cursor pointer
89
+ transition cubic-bezier(0, 0, 0, 1.29) .5s
90
+ user-select none
91
+ border-radius 50px
92
+ overflow hidden
93
+ +maxWidth768()
94
+ display none
95
+
96
+ &:hover
97
+ transform scale(1.2)
97
98
 
98
99
  #st-footer
99
100
  display flex
@@ -100,7 +100,6 @@
100
100
  user-select none
101
101
 
102
102
  +maxWidth768()
103
- background linear-gradient(to top, var(--efu-main-none) 0, var(--efu-main) 100%)
104
103
  transition 0s
105
104
 
106
105
  +maxWidth1400()
@@ -131,6 +131,9 @@ if hexo-config('index_post_list.direction') == "column"
131
131
  font-size 14px
132
132
  line-height 1.8
133
133
 
134
+ +maxWidth600()
135
+ -webkit-line-clamp 1
136
+
134
137
  span.tags-punctuation
135
138
  transition .3s
136
139
 
@@ -353,6 +356,8 @@ else if hexo-config('index_post_list.direction') == "row"
353
356
  line-height 1.8
354
357
  +maxWidth768()
355
358
  -webkit-line-clamp 2
359
+ +maxWidth600()
360
+ -webkit-line-clamp 1
356
361
 
357
362
  span.tags-punctuation
358
363
  transition .3s
@@ -3,7 +3,7 @@
3
3
  bottom 0
4
4
  right 20px
5
5
  padding 0 0 20px 10px
6
- display flex
6
+ display none
7
7
  flex-direction column
8
8
  justify-content flex-end
9
9
  z-index 999