hexo-theme-solitude 1.5.0 → 1.5.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/_config.yml CHANGED
@@ -265,9 +265,9 @@ aside:
265
265
  # 鼠标悬停翻转图片
266
266
  # Mouse hover flip image
267
267
  backface:
268
- # 夜间模式下是否开启卡片背景颜色 true:使用背景颜色 / false:不使用背景颜色
269
- # Whether to enable card background color in night mode true: use background color / false: do not use background color
270
- darkcolor: false
268
+ # 背景色:var(--sco-blue) / #000 / rgba(0,0,0,0.5) / linear-gradient(to right,#f65,#ffbf37)
269
+ # Background color: var(--sco-blue) / #000 / rgba(0,0,0,0.5) / linear-gradient(to right,#f65,#ffbf37)
270
+ backcolor: "var(--sco-blue)"
271
271
 
272
272
  # 页面目录
273
273
  # Page directory
@@ -75,7 +75,6 @@ search:
75
75
 
76
76
  head:
77
77
  noscript: Please enable JavaScript to view the site
78
- console: 'Program: Hexo | Theme: Hexo-Theme-Solitude | Author: WangZhuoSco、YiFeng | Github: https://github.com/wleelw/Hexo-theme-solitude | Version: v1.5.0 😄'
79
78
 
80
79
  aside:
81
80
  postcount: 'Posts :'
@@ -75,7 +75,6 @@ search:
75
75
 
76
76
  head:
77
77
  noscript: 开启JavaScript才能访问本站哦~
78
- console: '程序:Hexo | 主题:Hexo-Theme-Solitude | 作者:王卓Sco、亦封 | Github: https://github.com/wleelw/Hexo-theme-solitude | 版本:v1.5.0 😄'
79
78
 
80
79
  aside:
81
80
  postcount: '文章总数 :'
@@ -75,7 +75,6 @@ search:
75
75
 
76
76
  head:
77
77
  noscript: 開啟JavaScript才能訪問本站哦~
78
- console: '程式:Hexo |主題:Hexo-Theme-Solitude |作者:王卓Sco、亦封 |Github位址: https://github.com/wleelw/Hexo-theme-solitude |版本:v1.5.0 😄'
79
78
 
80
79
  aside:
81
80
  postcount: '文章數:'
@@ -16,7 +16,7 @@ if theme.lightbox && theme.fancybox
16
16
  link(rel="stylesheet", href=url_for(theme.cdn.fancyapps_css))
17
17
 
18
18
  if theme.katex && theme.katex.enable
19
- link(rel="stylesheet", href=url_for(theme.cdn.katex))
19
+ link(rel="stylesheet", href=url_for(theme.cdn.katex))
20
20
 
21
21
  // Open Graph
22
22
  include ../head/opengraph.pug
@@ -78,8 +78,10 @@ script.
78
78
  )(window)
79
79
 
80
80
  console.log(
81
- "%c🔥 !{_p('head.console')}",
82
- "color: #fff; background: linear-gradient(-25deg, #a8edea, #fed6e3); padding: 8px 15px; border-radius: 8px; text-shadow: 2px 2px 4px white; color: black;"
81
+ "%c Program: Hexo %c Theme: Hexo-Theme-Solitude %c Version: v1.5.1",
82
+ "border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;margin:10px 0",
83
+ "padding: 5px 10px;color:white;background:#3e9f50;",
84
+ "border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;"
83
85
  );
84
86
  if theme.extends.head
85
87
  each item in theme.extends.head
@@ -1,4 +1,5 @@
1
- - group = (Object.entries(theme.hometop.group)).slice(0, 2)
1
+ - gg = theme.hometop.group
2
+ - group = gg ? (Object.entries(gg)).slice(0, 2) : null
2
3
 
3
4
  if group
4
5
  .categoryGroup
@@ -1,4 +1,4 @@
1
- div.recent-post-item(onclick="pjax.loadUrl('/" + post.path + "')")
1
+ div.recent-post-item(onclick="pjax.loadUrl('" + url_for(post.path) + "')")
2
2
  div.post_cover
3
3
  a(href=url_for(post.path), title=post.title)
4
4
  img.post_bg(src=url_for(post.cover), alt=post.title)
@@ -15,9 +15,9 @@ div.recent-post-item(onclick="pjax.loadUrl('/" + post.path + "')")
15
15
  if post.prev == null && is_home()
16
16
  span.original= _p('home.recent-post.new')
17
17
 
18
- a.unvisited-post(href=post.path)= _p('home.recent-post.read')
18
+ a.unvisited-post(href=url_for(post.path))= _p('home.recent-post.read')
19
19
 
20
- a.article-title(href=post.path, title=post.title)= post.title
20
+ a.article-title(href=url_for(post.path), title=post.title)= post.title
21
21
 
22
22
  div.article-meta-wrap
23
23
  span.article-meta.tags
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by the wleelw",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -22,9 +22,17 @@ hexo.extend.filter.register('stylus:renderer', function (style) {
22
22
 
23
23
  style.define('about', data && data.about ? Object.keys(data.about) : []);
24
24
 
25
- let group = Object.keys(theme.config.hometop.group).map(key => {
25
+ initGroupColor(theme.config.hometop.group,style);
26
+ });
27
+
28
+ function initGroupColor(gg,style) {
29
+ if(gg === null || gg === undefined) {
30
+ style.define('banner_group', [])
31
+ return;
32
+ }
33
+ let group = Object.keys(gg).map(key => {
26
34
  return {
27
- [key]: (theme.config.hometop.group[key]).split('||')[2]
35
+ [key]: (gg[key]).split('||')[2]
28
36
  }
29
37
  });
30
38
 
@@ -40,4 +48,4 @@ hexo.extend.filter.register('stylus:renderer', function (style) {
40
48
  return color;
41
49
  }
42
50
  style.define('getGroupColor', getGroupColor);
43
- });
51
+ }
@@ -1,10 +1,11 @@
1
1
  favicon = hexo-config('aside.flip.favicon')
2
2
  face = hexo-config('aside.flip.face')
3
3
  faceback = hexo-config('aside.flip.backface')
4
+ backcolor = convert(hexo-config('aside.flip.backcolor'))
4
5
 
5
6
  #aside-content
6
7
  .card-widget.card-platform
7
- background var(--sco-main)
8
+ background backcolor
8
9
  display flex
9
10
  justify-content center
10
11
  align-content center
@@ -63,8 +64,4 @@ faceback = hexo-config('aside.flip.backface')
63
64
  transform rotateY(180deg)
64
65
  box-sizing border-box
65
66
  background url(faceback) center center no-repeat
66
- background-size 100%
67
-
68
- if !hexo-config('aside.flip.darkcolor')
69
- [data-theme='dark'] #aside-content .card-widget.card-platform
70
- background var(--sco-card-bg)
67
+ background-size 100%
@@ -356,6 +356,7 @@
356
356
  height: 150px
357
357
  transition: .3s
358
358
  position: relative
359
+ cursor pointer
359
360
 
360
361
  &:hover
361
362
  background: var(--sco-main)
@@ -39,6 +39,8 @@
39
39
  .footer-bar-description
40
40
  color var(--sco-secondtext)
41
41
  font-weight 700
42
+ padding: 0 0.5rem
43
+ text-align: center
42
44
 
43
45
  .post & div#sco-footer-bar
44
46
  display flex
@@ -269,4 +271,4 @@
269
271
  font-size: 16px
270
272
 
271
273
  i.scoicon
272
- font-size 16px
274
+ font-size 16px
@@ -11,7 +11,7 @@
11
11
 
12
12
  +maxWidth768()
13
13
  box-shadow var(--sco-shadow-border)
14
-
14
+ padding: 1rem 1.3rem;
15
15
  .post-copyright__author_group
16
16
  .post-copyright__author_img
17
17
  width 64px
@@ -95,4 +95,4 @@
95
95
  background-color var(--sco-main)
96
96
  color var(--sco-white)
97
97
  cursor pointer
98
- border-radius 4px
98
+ border-radius 4px
@@ -5,4 +5,4 @@
5
5
  * @author 王卓Sco
6
6
  * @license GNU General Public License v3.0
7
7
  */
8
- var ScoAI={root:"https://summary.tianli0.top",aiTalkMode:!1,aiPostExplanation:"",config:GLOBAL_CONFIG.ai,init(){this.scoGPTIsRunning=!1,this.generate(),this.AIEngine()},getTitleAndContent(){const e=document.title,t=document.getElementById("article-container"),n=t.getElementsByTagName("p"),o=t.querySelectorAll("h1, h2, h3, h4, h5");let i="";for(let e of o)i+=e.innerText+" ";for(let e of n)i+=e.innerText.replace(/https?:\/\/[^\s]+/g,"");return(e+" "+i).slice(0,1e3)},generate(){this.aiShowAnimation(this.fetch(this.getTitleAndContent(),this.config.key))},async fetch(e, t){const n=`${this.root}/?content=${encodeURIComponent(e)}&key=${encodeURIComponent(t)}&url=${encodeURIComponent(window.location.href)}`;try{const e=new AbortController,t=await fetch(n,{signal:e.signal});if(t.ok){const e=await t.json();return this.aiPostExplanation=e.summary,e.summary}throw Error("Request failed")}catch(e){return"AbortError"===e.name?console.error("Request timed out"):console.error("Request failed:",e),"获取文章摘要超时。当你出现这个问题时,可能是因为文章过长导致的AI运算量过大, 您可以稍等一下然后重新尝试。"}},aiShowAnimation(e, t=!1){const n=document.querySelector(".ai-explanation"),o=document.querySelector(".ai-tag");if(!n||this.scoGPTIsRunning)return;this.scoGPTIsRunning=!0,this.cleanSuggestions(),o.classList.add("loadingAI"),n.style.display="block",n.innerHTML='生成中...<span class="blinking-cursor"></span>';let i,s,r=!0,a=0,c=!0;const l=new IntersectionObserver((e=>{r=e[0].isIntersecting,r&&requestAnimationFrame(s)}),{threshold:0});e.then((e=>{i=performance.now(),s=()=>{if(a<e.length&&r){const c=performance.now(),g=c-i,d=e.slice(a,a+1),h=/[,。!、?,.!?]/.test(d),u=/[a-zA-Z0-9]/.test(d);g>=(h?100*Math.random()+100:u?10:25)&&(n.innerText=e.slice(0,a+1),i=c,a++,a<e.length?n.innerHTML=e.slice(0,a)+'<span class="blinking-cursor"></span>':(n.innerHTML=e,n.style.display="block",this.scoGPTIsRunning=!1,o.classList.remove("loadingAI"),l.disconnect(),t&&this.createSuggestions())),r&&requestAnimationFrame(s)}},r&&c&&setTimeout((()=>{requestAnimationFrame(s),c=!1}),3e3),l.observe(n)})).catch((e=>{console.error("检索信息失败:",e),n.innerHTML="检索信息失败",n.style.display="block",this.scoGPTIsRunning=!1,o.classList.remove("loadingAI"),l.disconnect()}))},AIEngine(){const e=document.querySelector(".ai-tag");e&&e.addEventListener("click",(()=>{this.scoGPTIsRunning||(this.aiTalkMode=!0,this.aiShowAnimation(Promise.resolve(this.config.talk),!0))}))},cleanSuggestions(){const e=document.querySelector(".ai-suggestions");e?e.innerHTML="":console.error("没有这个元素:'ai-suggestions'")},createSuggestions(){this.aiTalkMode&&this.cleanSuggestions(),this.createSuggestionItemWithAction("这篇文章讲了什么?",(()=>{this.aiShowAnimation(Promise.resolve(this.aiPostExplanation),!0)})),this.config.randomPost&&this.createSuggestionItemWithAction("带我去看看其他文章",(()=>toRandomPost())),this.aiTalkMode=!0},createSuggestionItemWithAction(e, t){const n=document.querySelector(".ai-suggestions");if(!n)return void console.error("无法找到具有class为ai-suggestions的元素");const o=document.createElement("div");o.classList.add("ai-suggestions-item"),o.textContent=e,o.addEventListener("click",t),n.appendChild(o)}};console.log("%c🤖 程序:ScoAI | Solitude 主题内置 | Github: https://github.com/DuoSco/Hexo-theme-solitude","color: #fff; background: linear-gradient(-25deg, #a8edea, #fed6e3); padding: 8px 15px; border-radius: 8px; text-shadow: 2px 2px 4px white; color: black;");
8
+ var ScoAI={root:"https://summary.tianli0.top",aiTalkMode:!1,aiPostExplanation:"",config:GLOBAL_CONFIG.ai,init(){this.scoGPTIsRunning=!1,this.generate(),this.AIEngine()},getTitleAndContent(){const e=document.title,t=document.getElementById("article-container"),n=t.getElementsByTagName("p"),o=t.querySelectorAll("h1, h2, h3, h4, h5");let i="";for(let e of o)i+=e.innerText+" ";for(let e of n)i+=e.innerText.replace(/https?:\/\/[^\s]+/g,"");return(e+" "+i).slice(0,1e3)},generate(){this.aiShowAnimation(this.fetch(this.getTitleAndContent(),this.config.key))},async fetch(e, t){const n=`${this.root}/?content=${encodeURIComponent(e)}&key=${encodeURIComponent(t)}&url=${encodeURIComponent(window.location.href)}`;try{const e=new AbortController,t=await fetch(n,{signal:e.signal});if(t.ok){const e=await t.json();return this.aiPostExplanation=e.summary,e.summary}throw Error("Request failed")}catch(e){return"AbortError"===e.name?console.error("Request timed out"):console.error("Request failed:",e),"获取文章摘要超时。当你出现这个问题时,可能是因为文章过长导致的AI运算量过大, 您可以稍等一下然后重新尝试。"}},aiShowAnimation(e, t=!1){const n=document.querySelector(".ai-explanation"),o=document.querySelector(".ai-tag");if(!n||this.scoGPTIsRunning)return;this.scoGPTIsRunning=!0,this.cleanSuggestions(),o.classList.add("loadingAI"),n.style.display="block",n.innerHTML='生成中...<span class="blinking-cursor"></span>';let i,s,r=!0,a=0,c=!0;const l=new IntersectionObserver((e=>{r=e[0].isIntersecting,r&&requestAnimationFrame(s)}),{threshold:0});e.then((e=>{i=performance.now(),s=()=>{if(a<e.length&&r){const c=performance.now(),g=c-i,d=e.slice(a,a+1),h=/[,。!、?,.!?]/.test(d),u=/[a-zA-Z0-9]/.test(d);g>=(h?100*Math.random()+100:u?10:25)&&(n.innerText=e.slice(0,a+1),i=c,a++,a<e.length?n.innerHTML=e.slice(0,a)+'<span class="blinking-cursor"></span>':(n.innerHTML=e,n.style.display="block",this.scoGPTIsRunning=!1,o.classList.remove("loadingAI"),l.disconnect(),t&&this.createSuggestions())),r&&requestAnimationFrame(s)}},r&&c&&setTimeout((()=>{requestAnimationFrame(s),c=!1}),3e3),l.observe(n)})).catch((e=>{console.error("检索信息失败:",e),n.innerHTML="检索信息失败",n.style.display="block",this.scoGPTIsRunning=!1,o.classList.remove("loadingAI"),l.disconnect()}))},AIEngine(){const e=document.querySelector(".ai-tag");e&&e.addEventListener("click",(()=>{this.scoGPTIsRunning||(this.aiTalkMode=!0,this.aiShowAnimation(Promise.resolve(this.config.talk),!0))}))},cleanSuggestions(){const e=document.querySelector(".ai-suggestions");e?e.innerHTML="":console.error("没有这个元素:'ai-suggestions'")},createSuggestions(){this.aiTalkMode&&this.cleanSuggestions(),this.createSuggestionItemWithAction("这篇文章讲了什么?",(()=>{this.aiShowAnimation(Promise.resolve(this.aiPostExplanation),!0)})),this.config.randomPost&&this.createSuggestionItemWithAction("带我去看看其他文章",(()=>toRandomPost())),this.aiTalkMode=!0},createSuggestionItemWithAction(e, t){const n=document.querySelector(".ai-suggestions");if(!n)return void console.error("无法找到具有class为ai-suggestions的元素");const o=document.createElement("div");o.classList.add("ai-suggestions-item"),o.textContent=e,o.addEventListener("click",t),n.appendChild(o)}};