diff --git a/templates/index.html b/templates/index.html index e0200f7..99bb401 100644 --- a/templates/index.html +++ b/templates/index.html @@ -145,19 +145,25 @@

${n.updated_at}

-
- - - +
`).join(''); @@ -340,6 +346,28 @@ URL.revokeObjectURL(url); } + // 显示/隐藏菜单 + function toggleMenu(id) { + const menu = document.getElementById(`menu-${id}`); + if (menu) { + // 先隐藏其他所有菜单 + document.querySelectorAll('[id^="menu-"]').forEach(m => { + if (m.id !== `menu-${id}`) m.classList.add('hidden'); + }); + menu.classList.toggle('hidden'); + } + } + + function hideMenu(id) { + const menu = document.getElementById(`menu-${id}`); + if (menu) menu.classList.add('hidden'); + } + + // 点击其他地方关闭所有菜单 + document.addEventListener('click', () => { + document.querySelectorAll('[id^="menu-"]').forEach(m => m.classList.add('hidden')); + }); + // 删除当前笔记 async function deleteCurrentNote() { if (!currentNoteId) return;