refactor(frontend): replace toast system with zibll notyf

This commit is contained in:
kate522 committed 2026-08-18 02:38:43 +08:00
1 parent fb11a7ed0c
commit 86614c4905
33 files changed
+603 -802

No files matched your search

+5 -15
View File
@@ -58,14 +58,6 @@
}
}
function showToast(msg, type) {
if (window.aksrt && aksrt.notyf) {
aksrt.notyf(msg, { type: type || "info", duration: 2200 });
} else {
console.log("[AKSRT Toast]", type, msg);
}
}
function initArticleTools() {
var buttons = document.querySelectorAll("[data-article-tool]");
if (!buttons.length) return;
@@ -80,9 +72,7 @@
if (tool === "pdf") {
window.print();
if (typeof showToast === "function") {
showToast("请在打印对话框中选择“另存为 PDF”", "info");
}
notyf("请在打印对话框中选择“另存为 PDF”", "info");
}
});
});
@@ -232,9 +222,9 @@
setButtonBusy(likeBtn, true);
requestInteraction("aksrt_toggle_like", postId, nextState).then(function (data) {
applyLikeState(!!data.active, parseInt(data.count, 10) || 0);
showToast(data.active ? "感谢你的点赞" : "已取消点赞", "success");
notyf(data.active ? "感谢你的点赞" : "已取消点赞", "success");
}).catch(function (error) {
showToast(error && error.message ? error.message : "点赞失败", "error");
notyf(error && error.message ? error.message : "点赞失败", "danger");
}).finally(function () {
setButtonBusy(likeBtn, false);
});
@@ -257,9 +247,9 @@
setButtonBusy(favBtn, true);
requestInteraction("aksrt_toggle_favorite", postId, nextState).then(function (data) {
applyFavoriteState(!!data.active, parseInt(data.count, 10) || 0);
showToast(data.active ? "收藏成功" : "已取消收藏", "success");
notyf(data.active ? "收藏成功" : "已取消收藏", "success");
}).catch(function (error) {
showToast(error && error.message ? error.message : "收藏失败", "error");
notyf(error && error.message ? error.message : "收藏失败", "danger");
}).finally(function () {
setButtonBusy(favBtn, false);
});