增加控制樱花特效开启按钮,待解决首次进入页面需要点击两次才能控制的问题

This commit is contained in:
wenyongda 2025-08-17 16:13:00 +08:00
parent fb69d04f92
commit 75593a32c0
7 changed files with 74 additions and 56 deletions

View File

@ -133,7 +133,7 @@ error_img:
# A simple 404 page
error_404:
enable: false
subtitle: 'Page Not Found'
subtitle: "Page Not Found"
background: https://i.loli.net/2020/05/19/aKOcLiyPl2JQdFD.png
post_meta:
@ -551,7 +551,7 @@ canvas_fluttering_ribbon:
# https://github.com/hustcc/canvas-nest.js
canvas_nest:
enable: false
color: '0,0,255' #color of lines, default: '0,0,0'; RGB values: (R,G,B).(note: use ',' to separate.)
color: "0,0,255" #color of lines, default: '0,0,0'; RGB values: (R,G,B).(note: use ',' to separate.)
opacity: 0.7 # the opacity of line (0~1), default: 0.5.
zIndex: -1 # z-index property of the background, default: -1.
count: 99 # the number of lines, default: 99.
@ -669,7 +669,7 @@ aside:
enable: true
icon: fab fa-github
text: Follow Me
link: https://github.com/xxxxxx
link: https://github.com/wenyongda
card_announcement:
enable: true
content: This is my Blog
@ -735,9 +735,9 @@ translate:
# Time delay
translateDelay: 0
# The text of the button when the language is Simplified Chinese
msgToTraditionalChinese: '繁'
msgToTraditionalChinese: "繁"
# The text of the button when the language is Traditional Chinese
msgToSimplifiedChinese: '簡'
msgToSimplifiedChinese: "簡"
# Read Mode (閲讀模式)
readmode: true
@ -823,8 +823,8 @@ aplayerInject:
snackbar:
enable: false
position: bottom-left
bg_light: '#49b1f5' # The background color of Toast Notification in light mode
bg_dark: '#1f1f1f' # The background color of Toast Notification in dark mode
bg_light: "#49b1f5" # The background color of Toast Notification in light mode
bg_dark: "#1f1f1f" # The background color of Toast Notification in dark mode
# https://instant.page/
# prefetch (預加載)

View File

@ -40,7 +40,7 @@ search:
algolia_search:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}."
hits_stats: '${hits} results found in ${time} ms'
hits_stats: "${hits} results found in ${time} ms"
local_search:
input_placeholder: Search for Posts
@ -103,6 +103,7 @@ rightside:
setting: Setting
aside: Toggle between single-column and double-column
chat: Chat
toggle_sakura: Sakura effect toggled on or off
copy_copyright:
author: Author

View File

@ -40,7 +40,7 @@ search:
algolia_search:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}."
hits_stats: '${hits} results found in ${time} ms'
hits_stats: "${hits} results found in ${time} ms"
local_search:
input_placeholder: Search for Posts
@ -103,6 +103,7 @@ rightside:
setting: Setting
aside: Toggle between single-column and double-column
chat: Chat
toggle_sakura: Sakura effect toggled
copy_copyright:
author: Author

View File

@ -40,12 +40,12 @@ search:
load_data: 数据库加载中
algolia_search:
input_placeholder: 搜索文章
hits_empty: '找不到您查询的内容:${query}'
hits_stats: '找到 ${hits} 条结果,用时 ${time} 毫秒'
hits_empty: "找不到您查询的内容:${query}"
hits_stats: "找到 ${hits} 条结果,用时 ${time} 毫秒"
local_search:
input_placeholder: 搜索文章
hits_empty: '找不到您查询的内容:${query}'
hits_empty: "找不到您查询的内容:${query}"
pagination:
prev: 上一篇
@ -104,6 +104,7 @@ rightside:
setting: 设置
aside: 单栏和双栏切换
chat: 聊天
toggle_sakura: 樱花特效切换
copy_copyright:
author: 作者

View File

@ -40,12 +40,12 @@ search:
load_data: 資料庫載入中
algolia_search:
input_placeholder: 搜尋文章
hits_empty: '找不到您查詢的內容:${query}'
hits_stats: '找到 ${hits} 條結果,用時 ${time} 毫秒'
hits_empty: "找不到您查詢的內容:${query}"
hits_stats: "找到 ${hits} 條結果,用時 ${time} 毫秒"
local_search:
input_placeholder: 搜尋文章
hits_empty: '找不到您查詢的內容:${query}'
hits_empty: "找不到您查詢的內容:${query}"
pagination:
prev: 上一篇
@ -104,6 +104,7 @@ rightside:
setting: 設定
aside: 單欄和雙欄切換
chat: 聊天
toggle_sakura: 櫻花特效切換
copy_copyright:
author: 作者

View File

@ -29,14 +29,14 @@ mixin rightsideItem(array)
if commentsJsLoad
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
i.fas.fa-comments
when 'xxxx'
button#xxxx(type="button" title="测试按钮")
i.fas.fa-xxxx
when 'sakura'
button#toggle_sakura_btn(type="button" title=_p("rightside.toggle_sakura"))
i.fas.fa-seedling
#rightside
- const { enable, hide, show } = theme.rightside_item_order
- const hideArray = enable ? hide && hide.split(',') : ['readmode','translate','darkmode','hideAside', 'xxxx']
- const showArray = enable ? show && show.split(',') : ['toc','chat','comment']
- const hideArray = enable ? hide && hide.split(',') : ['readmode','translate','darkmode','hideAside']
- const showArray = enable ? show && show.split(',') : ['toc','chat','comment','sakura']
#rightside-config-hide

View File

@ -146,7 +146,7 @@ document.addEventListener('DOMContentLoaded', function () {
this.classList.toggle('expand-done')
}
function createEle (lang, item, service) {
function createEle(lang, item, service) {
const fragment = document.createDocumentFragment()
if (isShowTool) {
@ -205,7 +205,7 @@ document.addEventListener('DOMContentLoaded', function () {
/**
* PhotoFigcaption
*/
function addPhotoFigcaption () {
function addPhotoFigcaption() {
document.querySelectorAll('#article-container img').forEach(function (item) {
const parentEle = item.parentNode
const altValue = item.title || item.alt
@ -265,7 +265,7 @@ document.addEventListener('DOMContentLoaded', function () {
}
// find the scroll direction
function scrollDirection (currentTop) {
function scrollDirection(currentTop) {
const result = currentTop > initTop // true is down & false is up
initTop = currentTop
return result
@ -455,7 +455,7 @@ document.addEventListener('DOMContentLoaded', function () {
newEle.className = 'fas fa-sign-out-alt exit-readmode'
$body.appendChild(newEle)
function clickFn () {
function clickFn() {
$body.classList.remove('read-mode')
newEle.remove()
newEle.removeEventListener('click', clickFn)
@ -501,6 +501,17 @@ document.addEventListener('DOMContentLoaded', function () {
: saveToLocal.set('aside-status', 'hide', 2)
$htmlDom.toggle('hide-aside')
},
toggleSakuraBtn: () => {
const toggleBtn = document.getElementById('toggle_sakura_btn');
if (toggleBtn) {
// toggleBtn.addEventListener('click', function () {
const sakuraEffect = document.getElementById('canvas_sakura');
if (sakuraEffect) {
sakuraEffect.style.display = (sakuraEffect.style.display === 'none' || sakuraEffect.style.display === '') ? 'block' : 'none';
}
// });
}
},
runMobileToc: () => {
if (window.getComputedStyle(document.getElementById('card-toc')).getPropertyValue('opacity') === '0') window.mobileToc.open()
@ -529,6 +540,9 @@ document.addEventListener('DOMContentLoaded', function () {
case 'hide-aside-btn':
rightSideFn.hideAsideBtn()
break
case 'toggle_sakura_btn':
rightSideFn.toggleSakuraBtn()
break
default:
break
}