update AI recommendation numbering after delete (#996)

Co-authored-by: Lumi <LumiSnep@proton.me>
This commit is contained in:
LumiDev
2026-03-18 16:27:08 +01:00
committed by GitHub
parent 8f0b5d0a84
commit 4bb69e7df6
+10
View File
@@ -1,4 +1,13 @@
document.addEventListener("DOMContentLoaded", function () {
function updateAiRecommendationNumbers() {
document.querySelectorAll(".ai-recommendation-item").forEach(function (item, index) {
const numberSpan = item.querySelector(".ai-recommendation-header h3 > span");
if (numberSpan) {
numberSpan.textContent = `${index + 1}. `;
}
});
}
document.querySelectorAll(".ai-recommendation-item").forEach(function (item) {
item.addEventListener("click", function () {
item.classList.toggle("expanded");
@@ -25,6 +34,7 @@ document.addEventListener("DOMContentLoaded", function () {
.then(data => {
if (data.success) {
item.remove();
updateAiRecommendationNumbers();
showSuccessMessage(translate("success"));
} else {
showErrorMessage(data.message || translate("failed_delete_ai_recommendation"));