hexo-theme-solitude 1.4.7 → 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/CONTRIBUTING.md +16 -3
- package/README.md +2 -2
- package/README_EN.md +2 -2
- package/_config.yml +115 -186
- package/languages/en-US.yml +0 -1
- package/languages/zh-CN.yml +0 -1
- package/languages/zh-TW.yml +0 -1
- package/layout/includes/footer.pug +8 -6
- package/layout/includes/inject/body.pug +0 -2
- package/layout/includes/inject/head.pug +5 -3
- package/layout/includes/nav.pug +3 -3
- package/layout/includes/sidebar.pug +1 -1
- package/layout/includes/widgets/aside/asideInfoCard.pug +4 -3
- package/layout/includes/widgets/home/banner.pug +11 -4
- package/layout/includes/widgets/home/categoryGroup.pug +12 -8
- package/layout/includes/widgets/home/hometop.pug +1 -2
- package/layout/includes/widgets/home/postList.pug +2 -2
- package/layout/includes/widgets/nav/group.pug +13 -0
- package/layout/includes/widgets/nav/menu.pug +20 -16
- package/layout/includes/widgets/page/about/award.pug +1 -1
- package/layout/includes/widgets/page/equipment/content.pug +1 -1
- package/layout/includes/widgets/page/links/linksCard.pug +0 -1
- package/layout/includes/widgets/third-party/comments/waline.pug +2 -0
- package/layout/includes/widgets/third-party/news-comment/twikoo.pug +2 -2
- package/layout/includes/widgets/third-party/news-comment/waline.pug +2 -2
- package/layout/includes/widgets/third-party/search/algolia-search.pug +1 -1
- package/layout/includes/widgets/third-party/search/local-search.pug +1 -1
- package/layout/index.pug +6 -6
- package/package.json +1 -1
- package/plugins.yml +0 -5
- package/scripts/helper/stylus.js +28 -1
- package/source/css/_global/animation.styl +6 -0
- package/source/css/_layout/basic.styl +10 -1
- package/source/css/_layout/header.styl +5 -5
- package/source/css/_layout/index.styl +0 -1
- package/source/css/_page/_about/skills.styl +1 -1
- package/source/css/_page/_home/category-bar.styl +14 -14
- package/source/css/_page/_home/home-top.styl +57 -45
- package/source/css/_page/_home/recent-post.styl +1 -1
- package/source/css/_page/equipment.styl +3 -2
- package/source/css/_page/home.styl +0 -15
- package/source/css/_page/links.styl +9 -8
- package/source/css/_page/says.styl +1 -2
- package/source/css/_page/share.styl +30 -67
- package/source/css/_widgets/_aside/flip.styl +3 -6
- package/source/css/_widgets/_aside/index.styl +1 -1
- package/source/css/_widgets/_aside/info.styl +1 -1
- package/source/css/_widgets/_comment/twikoo.styl +4 -6
- package/source/css/_widgets/_comment/waline.styl +435 -72
- package/source/css/_widgets/_extra/console.styl +2 -1
- package/source/css/_widgets/_extra/fullpage.styl +1 -1
- package/source/css/_widgets/_mixins/footer.styl +4 -2
- package/source/css/_widgets/_post/content.styl +1 -11
- package/source/css/_widgets/_post/copyright.styl +2 -2
- package/source/css/_widgets/_post/meta.styl +2 -2
- package/source/css/_widgets/_post/relatedPost.styl +1 -1
- package/source/css/_widgets/_post/tools.styl +1 -1
- package/source/css/_widgets/_search/algolia-search.styl +4 -2
- package/source/css/_widgets/_tags/note.styl +4 -0
- package/source/js/main.js +27 -35
- package/source/js/sco-ai.min.js +1 -1
- package/layout/includes/widgets/nav/left.pug +0 -10
package/source/js/main.js
CHANGED
@@ -64,45 +64,37 @@ const scrollFn = function () {
|
|
64
64
|
}
|
65
65
|
}
|
66
66
|
|
67
|
-
let ticking = false;
|
68
|
-
|
69
67
|
const percent = () => {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
}
|
87
|
-
}
|
68
|
+
let scrollTop = document.documentElement.scrollTop || window.pageYOffset
|
69
|
+
let totalHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - document.documentElement.clientHeight
|
70
|
+
let scrollPercent = Math.round(scrollTop / totalHeight * 100)
|
71
|
+
let percentElement = document.querySelector("#percent")
|
72
|
+
let viewportBottom = window.scrollY + document.documentElement.clientHeight
|
73
|
+
let remainingScroll = totalHeight - scrollTop
|
74
|
+
|
75
|
+
if ((document.getElementById("post-comment") || document.getElementById("footer")).offsetTop < viewportBottom || scrollPercent > 90) {
|
76
|
+
document.querySelector("#nav-totop").classList.add("long")
|
77
|
+
percentElement.innerHTML = "返回顶部"
|
78
|
+
} else {
|
79
|
+
document.querySelector("#nav-totop").classList.remove("long")
|
80
|
+
if (scrollPercent >= 0) {
|
81
|
+
percentElement.innerHTML = scrollPercent + ""
|
82
|
+
}
|
83
|
+
}
|
88
84
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
99
|
-
ticking = false;
|
100
|
-
});
|
101
|
-
ticking = true;
|
85
|
+
let elementsToHide = document.querySelectorAll(".needEndHide")
|
86
|
+
if (remainingScroll < 100) {
|
87
|
+
elementsToHide.forEach(function (element) {
|
88
|
+
element.classList.add("hide")
|
89
|
+
})
|
90
|
+
} else {
|
91
|
+
elementsToHide.forEach(function (element) {
|
92
|
+
element.classList.remove("hide")
|
93
|
+
})
|
102
94
|
}
|
103
|
-
};
|
104
95
|
|
105
|
-
window.onscroll = percent
|
96
|
+
window.onscroll = percent
|
97
|
+
}
|
106
98
|
|
107
99
|
|
108
100
|
const showTodayCard = () => {
|
package/source/js/sco-ai.min.js
CHANGED
@@ -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)}};
|
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)}};
|
@@ -1,10 +0,0 @@
|
|
1
|
-
.back-menu-list-groups
|
2
|
-
- var menu = theme.nav && theme.nav.left && theme.nav.left.menu ? theme.nav.left.menu : {}
|
3
|
-
each groupData, x in menu
|
4
|
-
.back-menu-list-group
|
5
|
-
.back-menu-list-title= x
|
6
|
-
.back-menu-list
|
7
|
-
each data, y in groupData
|
8
|
-
a.back-menu-item(href=url_for(data.url), title=y)
|
9
|
-
img.back-menu-item-icon(src=data.icon, alt=x)
|
10
|
-
span.back-menu-item-text= y
|