Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小更新 #412

Merged
merged 12 commits into from
Nov 7, 2024
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ loading:
# Full screen loading
# 全屏加载
fullpage: false
# Loading icon, default is siteicon
# 加载图标,不写默认siteicon
favicon: /img/favicon.png
# Pace loading
# Pace 加载
pace: true
Expand Down
4 changes: 3 additions & 1 deletion layout/includes/head/page_config.pug
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
- var showToc = !!page.toc && (toc(page.content) !== '' || page.encrypt === true);

script#config-diff.
var PAGE_CONFIG = {
is_post: !{is_post()},
is_page: !{!is_post() && !is_home()},
is_home: !{is_home()},
page: '!{page.type}',
toc: !{!!page.toc},
toc: !{showToc},
comment: !{!!page.comment},
ai_text: !{is_post && page.ai_text ? "'"+ page.ai_text+"'" : false},
color: !{page.color ? "'"+ page.color+"'" : false},
Expand Down
2 changes: 1 addition & 1 deletion layout/includes/loading.pug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
div(id="loading-box" onclick="preloader.endLoading();" style="zoom:1")
div.loading-bg
img.loading-img.nolazyload(src=url_for(theme.site.icon), alt="loading image")
img.loading-img.nolazyload(src=url_for(theme.loading.favicon || theme.site.icon), alt="loading image")

script.
const preloader = {
Expand Down
2 changes: 1 addition & 1 deletion layout/includes/widgets/aside/aside.pug
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
each item in noSticky
include ./asideSwitch.pug
.sticky_layout
if page.toc
if showToc
include ./asideToc.pug
each item in Sticky
include ./asideSwitch.pug
27 changes: 15 additions & 12 deletions layout/includes/widgets/page/links/banner.pug
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@
.tags-group-wrapper
- const data = site.data.links.links
- for (let i = 0; i < 2; i++)
- var links = []
each x in data
- var pairs = []
each y, index in x.link_list
if (index % 2 === 0)
- pairs.push([y])
else
- pairs[pairs.length - 1].push(y)
each pair in pairs
.tags-group-icon-pair
each y in pair
a.tags-group-icon(href=url_for(y.link), title=y.name)
img(src=y.avatar + (site.data.links.banner_suffix || ''), title=y.name)
span.tags-group-title=y.name
each y in x.link_list
- links.push(y)
- var pairs = []
each link, index in links
if (index % 2 === 0)
- pairs.push([link])
else
- pairs[pairs.length - 1].push(link)
each pair in pairs
.tags-group-icon-pair
each y in pair
a.tags-group-icon(href=url_for(y.link), title=y.name)
img(src=y.avatar + (site.data.links.banner_suffix || ''), title=y.name)
span.tags-group-title=y.name
2 changes: 1 addition & 1 deletion layout/includes/widgets/rightside/show.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
if theme.rightside.hide.enable
button.config(type='button' title=_p('rightside.show.gear') onclick='document.querySelector(".rs_hide").classList.toggle("show")')
i.fas.fa-gear.fa-spin
if page.toc
if showToc
button.mobile.toc(type='button' title=_p('rightside.show.toc') onclick="document.querySelector('#card-toc').classList.toggle('open')")
i.fas.fa-list
if page.comment
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-solitude",
"version": "2.1.5",
"version": "2.1.6",
"description": "A beautiful, powerful, and efficient Hexo theme developed by everfu.",
"main": "package.json",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/event/cdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ hexo.extend.filter.register('before_generate', () => {
themeConfig.cdn = Object.assign(
createCDNLink(internalSrc, CDN.internal, 'internal'),
createCDNLink(thirdPartySrc, CDN.third_party),
deleteNullValue(CDN.option)
deleteNullValue(CDN.options)
)
})
2 changes: 1 addition & 1 deletion scripts/tags/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ const article = ([path]) => {
return `<div class="recent-post-item" onclick="pjax.loadUrl('${'/' + post.path}')">${postCover + recentPostInfo}</div>`;
}

hexo.extend.tag.register('article', article)
hexo.extend.tag.register('article', article)
9 changes: 9 additions & 0 deletions source/css/_highlight/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ figure
font-size 1.15em
user-select none

.caption
position absolute
right 2.7rem
font-size 0.85em
color var(--efu-secondtext)

+maxWidth768()
display none

.code-expand-btn
background var(--efu-hltools-bg)
transition .3s
Expand Down
2 changes: 1 addition & 1 deletion source/css/_layout/article-container.styl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#article-container
.post-content
overflow-wrap break-word
+maxWidth768()
overflow hidden
Expand Down
8 changes: 7 additions & 1 deletion source/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,15 @@
const createEle = (lang, item, service) => {
const fragment = document.createDocumentFragment()
if ($isShowTool) {
const captionItem = item.querySelector('figcaption')
let caption = ''
if (captionItem) {
caption = `<div class="caption">${captionItem.innerHTML}</div>`
item.removeChild(captionItem)
}
const hlTools = document.createElement('div')
hlTools.className = `highlight-tools ${expandClass}`
hlTools.innerHTML = expandEle + lang + copyEle
hlTools.innerHTML = expandEle + lang + caption + copyEle
Dismissed Show dismissed Hide dismissed
utils.addEventListenerPjax(hlTools, 'click', ToolsFn)
fragment.appendChild(hlTools)
}
Expand Down