@@ -179,20 +184,28 @@
const list = document.getElementById(LIST_ID);
const dot = document.getElementById('notification-dot');
const minimizeBtn = document.getElementById('minimize-notification');
+ const clearBtn = document.getElementById('clear-notification');
+ const NOTIFICATION_STATE_KEY = 'fuwari-notification-state';
+ const INIT_TIME_KEY = 'fuwari-notification-init-time';
if (!minimizedBtn || !panel || !list) return;
- // Always show the minimized bell
- minimizedBtn.classList.remove('translate-y-20', 'opacity-0');
+ // Show the minimized bell with animation
+ // Add a small delay to make the entrance noticeable after page load
+ requestAnimationFrame(() => {
+ minimizedBtn.classList.remove('translate-y-20', 'opacity-0');
+ });
const initTimeStr = new Date(initTime).toLocaleString();
+ const checkTimeStr = new Date(timestamp).toLocaleString();
// Logic for "No updates"
if (newPosts.length === 0) {
list.innerHTML = `
-
自上一次访问,暂无文章更新
-
检查于: ${new Date(timestamp).toLocaleString()}
-
初始化于: ${initTimeStr}
+
暂无文章更新
+
+ ${initTimeStr} - ${checkTimeStr}
+
`;
dot?.classList.add('hidden');
@@ -202,11 +215,10 @@
}
// Show timestamp header
- const timeStr = new Date(timestamp).toLocaleString();
let html = `
-
发现更新于: ${timeStr}
-
初始化于: ${initTimeStr}
+
发现更新
+
${initTimeStr} - ${checkTimeStr}
`;
newPosts.forEach(post => {
@@ -297,7 +309,28 @@
minimizeBtn.onclick = (e) => {
e.stopPropagation();
closePanel();
+ // Completely hide the bell after closing the panel via the 'X' button
+ // Wait for panel closing animation to finish
+ setTimeout(() => {
+ minimizedBtn.classList.add('translate-y-20', 'opacity-0');
+ minimizedBtn.classList.add('pointer-events-none'); // Prevent clicks while hidden
+ }, 300);
};
+
+ if (clearBtn) {
+ clearBtn.onclick = (e) => {
+ e.stopPropagation();
+ // Clear state from localStorage
+ localStorage.removeItem(NOTIFICATION_STATE_KEY);
+
+ // Update init time to current time since we are "resetting" the baseline
+ const now = Date.now();
+ localStorage.setItem(INIT_TIME_KEY, now.toString());
+
+ // Refresh view with new init time
+ showNotification([], now, false, now);
+ };
+ }
// Add event delegation for toggles
// Ensure we don't add duplicate listeners to list
diff --git a/src/content/posts/pin.md b/src/content/posts/pin.md
index dcf2c6586..ea5c47d24 100644
--- a/src/content/posts/pin.md
+++ b/src/content/posts/pin.md
@@ -3,9 +3,6 @@ title: 加群向导
image: /random/h
published: 2025-05-24
pinned: true
-category: 置顶
-tags:
- - 联系
description: 关于如何联系二叉树树~
---