From d8739b6108b103d6558a9a6671d28b2e57c2400a Mon Sep 17 00:00:00 2001 From: Eltrac Date: Sun, 27 Jul 2025 09:08:39 +0800 Subject: chore(debug): log potential error in console I need like function running in production to see the result. Former-commit-id: 5f55b5990618b9d5b8862c54f5e6e7dcd15241a7 --- layouts/_partials/posts/action-menu.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/layouts/_partials/posts/action-menu.html b/layouts/_partials/posts/action-menu.html index 5d78d1ad..6fb7f4ee 100644 --- a/layouts/_partials/posts/action-menu.html +++ b/layouts/_partials/posts/action-menu.html @@ -56,6 +56,7 @@ // 初始化所有功能 function initializeFeatures() { const pageId = "{{ .File.UniqueID | urlize }}"; + console.log(pageId) if (!pageId) return; // 评论展开/收起功能 @@ -134,7 +135,8 @@ function initializeLikes(pageId) { if (localStorage.getItem("liked_" + pageId)) { setLikedState(); } - } catch { + } catch(e) { + console.log(e); elements.count.innerText = "❌"; } } @@ -152,7 +154,8 @@ function initializeLikes(pageId) { localStorage.setItem("liked_" + pageId, "1"); elements.count.innerText = data.likes ?? 1; setLikedState(); - } catch { + } catch(e) { + console.log(e); alert("点赞失败,请稍后再试"); } }; -- cgit v1.2.3