add recurrence limit + follow FinanceBuddy installments to stop finite plans (v1.6.1)

This commit is contained in:
2026-07-10 09:12:30 -03:00
parent e9fc5df763
commit daac5f3b54
8 changed files with 224 additions and 8 deletions

View File

@@ -38,10 +38,36 @@
}
}
// "Follow FinanceBuddy installments": when on, the current/limit fields mirror FinanceBuddy's
// live installment current/total and are disabled (so they do not post, keeping FinanceBuddy the
// single source of truth); when off, they restore RecoReco's own stored values.
function applyFollow(checkbox) {
var group = checkbox.closest(".recoreco-limit-group");
if (!group) { return; }
var count = group.querySelector('input[name="recoreco_count"]');
var limit = group.querySelector('input[name="recoreco_limit"]');
if (!count || !limit) { return; }
if (checkbox.checked) {
count.value = group.getAttribute("data-fb-current");
limit.value = group.getAttribute("data-fb-total");
} else {
count.value = group.getAttribute("data-rr-count");
limit.value = group.getAttribute("data-rr-limit");
}
count.disabled = checkbox.checked;
limit.disabled = checkbox.checked;
}
document.addEventListener("change", function (e) {
if (e.target && e.target.name === "recoreco_frequency") {
apply(e.target);
}
if (e.target && e.target.name === "recoreco_follow_finance") {
applyFollow(e.target);
}
});
if (window.MutationObserver) {