fixed 修复首页闪烁的bug

This commit is contained in:
Vaica committed 2026-02-05 21:56:27 +08:00
1 parent f658dcc767
commit 8b7f9e7ebf
3 files changed
+25 -2

No files matched your search

@@ -160,7 +160,10 @@ window.initFloatingTools = function() {
};
// Initial check
checkCommentVisibility(toComments);
// Use setTimeout to avoid initial render flickering
setTimeout(function() {
checkCommentVisibility(toComments);
}, 100);
var newToComments = toComments.cloneNode(true);
if (toComments.parentNode) {
+16 -1
View File
@@ -35,15 +35,30 @@ window.showToast = function(text, type) {
z-index: 9999;
font-size: 14px;
opacity: 0;
transition: opacity 0.3s;
transition: opacity 0.3s, background-color 0.3s;
pointer-events: none;
display: flex;
align-items: center;
gap: 8px;
`;
// Add dark mode support class
toast.setAttribute('data-toast', 'true');
document.body.appendChild(toast);
}
// Update toast style based on theme
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
if (isDark) {
toast.style.background = 'rgba(255, 255, 255, 0.9)';
toast.style.color = '#333';
toast.style.boxShadow = '0 4px 12px rgba(0,0,0,0.3)';
} else {
toast.style.background = 'rgba(0,0,0,0.8)';
toast.style.color = 'white';
toast.style.boxShadow = '0 4px 12px rgba(0,0,0,0.1)';
}
// Simple icon mapping for fallback
let icon = '';
if (type === 'success') icon = '✅ ';