diff --git a/_config.yml b/_config.yml index 15bee4e6..72fee518 100644 --- a/_config.yml +++ b/_config.yml @@ -963,10 +963,12 @@ translate: # 右下角悬停导航栏 rightside: enable: false + percent: false hide: enable: false translate: false mode: false + aside: false # --------------------------- start --------------------------- # --------------------------- start --------------------------- diff --git a/languages/default.yml b/languages/default.yml index cae7e9ca..fabf8213 100644 --- a/languages/default.yml +++ b/languages/default.yml @@ -242,4 +242,5 @@ rightside: top: Top hide: translate: 简繁转换 - mode: Mode \ No newline at end of file + mode: Mode + aside: Sidebar \ No newline at end of file diff --git a/languages/en.yml b/languages/en.yml index d92442c6..772bddc5 100755 --- a/languages/en.yml +++ b/languages/en.yml @@ -243,4 +243,5 @@ rightside: top: Top hide: translate: 简繁转换 - mode: Mode \ No newline at end of file + mode: Mode + aside: Sidebar \ No newline at end of file diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index b27d572f..1d768451 100755 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -242,4 +242,5 @@ rightside: top: 返回顶部 hide: translate: 简繁转换 - mode: 显示模式切换 \ No newline at end of file + mode: 显示模式切换 + aside: 侧边栏 \ No newline at end of file diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index 63bf7a1e..36af9b93 100755 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -241,4 +241,5 @@ rightside: top: 返回頂部 hide: translate: 簡繁轉換 - mode: 顯示模式切換 \ No newline at end of file + mode: 顯示模式切換 + aside: 側邊欄 \ No newline at end of file diff --git a/layout/includes/head/config.pug b/layout/includes/head/config.pug index 2340abcb..681e6d70 100644 --- a/layout/includes/head/config.pug +++ b/layout/includes/head/config.pug @@ -115,15 +115,20 @@ } } if (theme.translate.enable) { - rightMenu.translate = { - translateDelay: theme.translate.translateDelay, - defaultEncoding: theme.translate.defaultEncoding - } + rightMenu.translate = theme.right_menu.translate } if (theme.right_menu.ctrlOriginalMenu) rightMenu.ctrlOriginalMenu = _p('right_menu.ctrl_original_menu') } + let translate = false + if (theme.translate.enable) { + translate = { + translateDelay: theme.translate.translateDelay, + defaultEncoding: theme.translate.defaultEncoding + } + } + let highlight = false if (theme.highlight.enable) { highlight = { @@ -187,6 +192,7 @@ script. lightbox: '!{ theme.mediumZoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null")}', post_ai: !{post_ai}, right_menu: !{rightMenu ? JSON.stringify(rightMenu) : false}, + translate: !{translate ? JSON.stringify(translate) : false}, lure: !{lure ? JSON.stringify(lure) : false}, expire: !{expire ? JSON.stringify(expire) : false}, }; \ No newline at end of file diff --git a/layout/includes/widgets/nav/right.pug b/layout/includes/widgets/nav/right.pug index bd036ff5..45ea4044 100644 --- a/layout/includes/widgets/nav/right.pug +++ b/layout/includes/widgets/nav/right.pug @@ -18,11 +18,11 @@ if theme.console.enable i.left i.center i.right - -.nav-button#nav-totop(onclick="sco.toTop()") - a.totopbtn - i.solitude.fa-solid.fa-arrow-up - span#percent= "0" +if !theme.rightside.percent + .nav-button#nav-totop(onclick="sco.toTop()") + a.totopbtn + i.solitude.fa-solid.fa-arrow-up + span#percent= "0" #toggle-menu a.site-page i.solitude.fa-solid.fa-bars \ No newline at end of file diff --git a/layout/includes/widgets/post/postInfo.pug b/layout/includes/widgets/post/postInfo.pug index 55ac55d8..630c9203 100644 --- a/layout/includes/widgets/post/postInfo.pug +++ b/layout/includes/widgets/post/postInfo.pug @@ -18,7 +18,7 @@ .meta-secondline if theme.post.meta.date span.post-meta-date(title=_p('post.posted') + ' ' + full_date(page.date)) - i.post-meta-icon.solitude.fa-solid.fa-clock + i.post-meta-icon.solitude.fas.fa-calendar-days time(datetime=date_xml(page.date))= date_xml(page.date) if theme.post.meta.updated span.post-meta-date(title=_p('post.updated') + ' ' + full_date(page.updated)) diff --git a/layout/includes/widgets/rightside/hide.pug b/layout/includes/widgets/rightside/hide.pug index b18505d2..462d5101 100644 --- a/layout/includes/widgets/rightside/hide.pug +++ b/layout/includes/widgets/rightside/hide.pug @@ -3,4 +3,7 @@ button.translate(type='button' title=_p('rightside.hide.translate'))= '简' if theme.rightside.hide.mode button.mode(type='button' title=_p('rightside.hide.mode') onclick='sco.switchDarkMode()') - i.fas.fa-circle-half-stroke \ No newline at end of file + i.fas.fa-circle-half-stroke + if theme.rightside.hide.aside + button.aside.pc(type='button' title=_p('rightside.hide.aside') onclick='sco.switchHideAside()') + i.fas.fa-arrows-alt-h \ No newline at end of file diff --git a/layout/includes/widgets/rightside/show.pug b/layout/includes/widgets/rightside/show.pug index 74d83f5d..0900a2fb 100644 --- a/layout/includes/widgets/rightside/show.pug +++ b/layout/includes/widgets/rightside/show.pug @@ -9,4 +9,5 @@ button.comment(type='button' title=_p('rightside.show.comment') onclick="sco.scrollTo('post-comment')") i.fas.fa-comment button.top(type='button' title=_p('rightside.show.top') onclick='sco.toTop()') - i.fas.fa-arrow-up \ No newline at end of file + i.fas.fa-arrow-up + span#percent= "0" \ No newline at end of file diff --git a/package.json b/package.json index 82a29964..efea5044 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-solitude", - "version": "2.1.0", + "version": "2.1.1", "description": "A beautiful, powerful, and efficient Hexo theme developed by everfu.", "main": "package.json", "scripts": { diff --git a/scripts/event/merge_config.js b/scripts/event/merge_config.js index ab2cb429..da52ed01 100644 --- a/scripts/event/merge_config.js +++ b/scripts/event/merge_config.js @@ -412,6 +412,7 @@ hexo.extend.filter.register('before_generate', () => { }, rightside: { enable: false, + percent: false, hide: { enable: false, translate: false, diff --git a/source/css/_layout/capsule.styl b/source/css/_layout/capsule.styl index 1a05ce78..097378aa 100644 --- a/source/css/_layout/capsule.styl +++ b/source/css/_layout/capsule.styl @@ -57,6 +57,11 @@ if hexo-config('capsule.enable') .aplayer-played animation-play-state running + height: 100%; + opacity: .1; + background-color: var(--efu-white) !important; + animation: lightBar 5s ease infinite; + animation-play-state: paused; #nav-music-hoverTips opacity 0 diff --git a/source/css/_layout/rightside.styl b/source/css/_layout/rightside.styl index 13e57ef0..616065cd 100644 --- a/source/css/_layout/rightside.styl +++ b/source/css/_layout/rightside.styl @@ -18,11 +18,30 @@ if hexo-config('rightside.enable') text-align: center font-size: 16px + &.pc + display: blok + +maxWidth900() + display: none + &.mobile display: none +maxWidth900() display: block + + &.top + &:hover + #percent + display: none + i + display: block + transition: all .3s + transform: scale(1.3) + i + transition: all .3s + display: none + &.show + display: block .rs_hide transform: translate(45px, 0) diff --git a/source/css/_post/meta.styl b/source/css/_post/meta.styl index fc882200..cb890bcf 100644 --- a/source/css/_post/meta.styl +++ b/source/css/_post/meta.styl @@ -206,7 +206,7 @@ transition all .3s ease-out 0s i - font-size 13px + font-size 14px margin-right 4px > div @@ -241,7 +241,6 @@ margin 0 1rem 0 0 .post-meta-pv - margin-right 8px padding 0 8px display flex align-items center @@ -264,7 +263,6 @@ cursor pointer transition .3s border-radius 12px - padding 8px &:hover opacity 1 diff --git a/source/css/_post/tools.styl b/source/css/_post/tools.styl index d9ea069a..49891cf1 100644 --- a/source/css/_post/tools.styl +++ b/source/css/_post/tools.styl @@ -59,7 +59,8 @@ border-radius: 8px line-height: 39px box-shadow: var(--efu-shadow-red) - display: inline-block + display: flex + align-items: center cursor: pointer transition: all .4s ease 0s @@ -181,6 +182,8 @@ height: 40px line-height: 39px box-shadow: var(--efu-shadow-green) + display: flex + align-items: center border-radius: 8px cursor: pointer text-align: center diff --git a/source/js/main.js b/source/js/main.js index a2da3492..85e26887 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -68,11 +68,13 @@ const percent = () => { const scrollPos = window.pageYOffset || docEl.scrollTop; const totalScrollableHeight = Math.max(body.scrollHeight, docEl.scrollHeight, body.offsetHeight, docEl.offsetHeight, body.clientHeight, docEl.clientHeight) - docEl.clientHeight; const scrolledPercent = Math.round((scrollPos / totalScrollableHeight) * 100); - const navToTop = document.querySelector("#nav-totop"); + const navToTop = document.querySelector("#nav-totop") || null; + const rsToTop = document.querySelector(".rs_show .top i") || null; const percentDisplay = document.querySelector("#percent"); const isNearEnd = (window.scrollY + docEl.clientHeight) >= (document.getElementById("post-comment") || document.getElementById("footer")).offsetTop; - navToTop.classList.toggle("long", isNearEnd || scrolledPercent > 90); - percentDisplay.textContent = isNearEnd || scrolledPercent > 90 ? GLOBAL_CONFIG.lang.backtop : scrolledPercent; + navToTop && navToTop.classList.toggle("long", isNearEnd || scrolledPercent > 90); + rsToTop && rsToTop.classList.toggle("show", isNearEnd || scrolledPercent > 90); + percentDisplay.textContent = isNearEnd || scrolledPercent > 90 ? navToTop ? GLOBAL_CONFIG.lang.backtop : '' : scrolledPercent; document.querySelectorAll(".needEndHide").forEach(item => item.classList.toggle("hide", totalScrollableHeight - scrollPos < 100)); } const showTodayCard = () => { diff --git a/source/js/tw_cn.js b/source/js/tw_cn.js index c6ffcac7..097f7729 100644 --- a/source/js/tw_cn.js +++ b/source/js/tw_cn.js @@ -1,5 +1,5 @@ document.addEventListener('DOMContentLoaded', function () { - const { defaultEncoding, translateDelay } = GLOBAL_CONFIG.right_menu.translate; + const { defaultEncoding, translateDelay } = GLOBAL_CONFIG.translate; const targetEncodingCookie = 'translate-chn-cht'; let currentEncoding = defaultEncoding;