Skip to content

Commit

Permalink
Merge pull request #394 from everfu/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
everfu authored Oct 1, 2024
2 parents 3b33e40 + 4f5ad4e commit b929f1a
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 25 deletions.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -963,10 +963,12 @@ translate:
# 右下角悬停导航栏
rightside:
enable: false
percent: false
hide:
enable: false
translate: false
mode: false
aside: false
# --------------------------- start ---------------------------

# --------------------------- start ---------------------------
Expand Down
3 changes: 2 additions & 1 deletion languages/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,5 @@ rightside:
top: Top
hide:
translate: 简繁转换
mode: Mode
mode: Mode
aside: Sidebar
3 changes: 2 additions & 1 deletion languages/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,5 @@ rightside:
top: Top
hide:
translate: 简繁转换
mode: Mode
mode: Mode
aside: Sidebar
3 changes: 2 additions & 1 deletion languages/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,5 @@ rightside:
top: 返回顶部
hide:
translate: 简繁转换
mode: 显示模式切换
mode: 显示模式切换
aside: 侧边栏
3 changes: 2 additions & 1 deletion languages/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,5 @@ rightside:
top: 返回頂部
hide:
translate: 簡繁轉換
mode: 顯示模式切換
mode: 顯示模式切換
aside: 側邊欄
14 changes: 10 additions & 4 deletions layout/includes/head/config.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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},
};
10 changes: 5 additions & 5 deletions layout/includes/widgets/nav/right.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion layout/includes/widgets/post/postInfo.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
5 changes: 4 additions & 1 deletion layout/includes/widgets/rightside/hide.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
3 changes: 2 additions & 1 deletion layout/includes/widgets/rightside/show.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
i.fas.fa-arrow-up
span#percent= "0"
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.0",
"version": "2.1.1",
"description": "A beautiful, powerful, and efficient Hexo theme developed by everfu.",
"main": "package.json",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions scripts/event/merge_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ hexo.extend.filter.register('before_generate', () => {
},
rightside: {
enable: false,
percent: false,
hide: {
enable: false,
translate: false,
Expand Down
5 changes: 5 additions & 0 deletions source/css/_layout/capsule.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions source/css/_layout/rightside.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions source/css/_post/meta.styl
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
transition all .3s ease-out 0s

i
font-size 13px
font-size 14px
margin-right 4px

> div
Expand Down Expand Up @@ -241,7 +241,6 @@
margin 0 1rem 0 0

.post-meta-pv
margin-right 8px
padding 0 8px
display flex
align-items center
Expand All @@ -264,7 +263,6 @@
cursor pointer
transition .3s
border-radius 12px
padding 8px

&:hover
opacity 1
Expand Down
5 changes: 4 additions & 1 deletion source/css/_post/tools.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions source/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
2 changes: 1 addition & 1 deletion source/js/tw_cn.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit b929f1a

Please sign in to comment.