add recurrence limit + follow FinanceBuddy installments to stop finite plans (v1.6.1)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user