Show selected state on OO money filters and recommend buttons.

Muted idle chips, cyan checkmark when active so 平/虚 and 推荐跨式/双虚 are obvious after click.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-06 09:17:07 +08:00
parent baf928d064
commit 2181c81aba
5 changed files with 67 additions and 16 deletions
+24
View File
@@ -24,6 +24,7 @@
underlying: root.getAttribute("data-default-underly") || "ETH",
moneyFilter: "itm", // 永期锁定:实值+平值
ooMoneyFilter: "atm_otm", // 期期锁定:平值+虚值
ooRecommend: null, // atm_straddle | double_otm | null
chain: null,
selected: null,
legA: null,
@@ -245,10 +246,24 @@
document.querySelectorAll(".hp-money-btn").forEach(function (b) {
const on = b.getAttribute("data-money") === state.moneyFilter;
b.classList.toggle("active", on);
b.classList.toggle("is-selected", on);
b.setAttribute("aria-pressed", on ? "true" : "false");
});
document.querySelectorAll(".hp-oo-money-btn").forEach(function (b) {
const on = b.getAttribute("data-oo-money") === state.ooMoneyFilter;
b.classList.toggle("active", on);
b.classList.toggle("is-selected", on);
b.setAttribute("aria-pressed", on ? "true" : "false");
});
}
function syncOoRecommendUI() {
const cur = state.ooRecommend || "";
document.querySelectorAll(".hp-oo-recommend-btn").forEach(function (b) {
const on = (b.getAttribute("data-oo-rec") || "") === cur;
b.classList.toggle("active", on);
b.classList.toggle("is-selected", on);
b.setAttribute("aria-pressed", on ? "true" : "false");
});
}
@@ -1003,6 +1018,8 @@
state.legA = c;
state.legB = null;
}
state.ooRecommend = null;
syncOoRecommendUI();
renderOoLegs();
});
});
@@ -1091,6 +1108,8 @@
state.selected = null;
state.legA = null;
state.legB = null;
state.ooRecommend = null;
syncOoRecommendUI();
if ($("hp-entry")) $("hp-entry").value = "";
if ($("hp-contracts")) $("hp-contracts").value = "";
if ($("hp-tp")) $("hp-tp").value = "";
@@ -1348,6 +1367,8 @@
}
state.legA = pair.call;
state.legB = pair.put;
state.ooRecommend = "atm_straddle";
syncOoRecommendUI();
renderOoLegs();
autoFillOoSheets();
updateOoPremiumLine();
@@ -1362,6 +1383,8 @@
}
state.legA = pair.call;
state.legB = pair.put;
state.ooRecommend = "double_otm";
syncOoRecommendUI();
renderOoLegs();
autoFillOoSheets();
updateOoPremiumLine();
@@ -2052,6 +2075,7 @@
syncTabUI();
syncUnderlyingUI();
syncMoneyUI();
syncOoRecommendUI();
syncPoDirUI();
syncOoSizeModeUI();
syncOoCloseModeUI();