全仓复利开启时隐藏并禁用单笔预算;关闭后才显示可用打满预算。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -202,6 +202,7 @@
|
||||
function renderEnvFieldRow(field) {
|
||||
const row = document.createElement("div");
|
||||
row.className = "env-field-row" + (field.restart_required ? " env-field-row--restart" : "");
|
||||
row.dataset.envKey = field.key;
|
||||
const label = document.createElement("label");
|
||||
label.className = "env-field-label";
|
||||
label.htmlFor = "env-f-" + field.key;
|
||||
@@ -345,9 +346,40 @@
|
||||
body.appendChild(panelsWrap);
|
||||
body.dataset.envModeSectionIdx = String(modeSectionIdx);
|
||||
bindTradeModeAutoRefresh(body);
|
||||
bindCompoundBudgetVisibility(body);
|
||||
return body;
|
||||
}
|
||||
|
||||
function envFieldRowByKey(body, key) {
|
||||
if (!body || !key) return null;
|
||||
const byRow = body.querySelector('.env-field-row[data-env-key="' + key + '"]');
|
||||
if (byRow) return byRow;
|
||||
const input = body.querySelector('.env-field-input[data-env-key="' + key + '"]');
|
||||
return input ? input.closest(".env-field-row") : null;
|
||||
}
|
||||
|
||||
function syncCompoundBudgetVisibility(body) {
|
||||
if (!body) return;
|
||||
const compoundSel = body.querySelector(
|
||||
'.env-field-input[data-env-key="OKX_OPTIONS_COMPOUND_FULL_ENABLED"]'
|
||||
);
|
||||
const budgetRow = envFieldRowByKey(body, "OKX_OPTIONS_TRADE_BUDGET_USDC");
|
||||
if (!budgetRow) return;
|
||||
const compoundOn = !compoundSel || String(compoundSel.value || "").toLowerCase() === "true";
|
||||
budgetRow.hidden = compoundOn;
|
||||
}
|
||||
|
||||
function bindCompoundBudgetVisibility(body) {
|
||||
if (!body) return;
|
||||
syncCompoundBudgetVisibility(body);
|
||||
const compoundSel = body.querySelector(
|
||||
'.env-field-input[data-env-key="OKX_OPTIONS_COMPOUND_FULL_ENABLED"]'
|
||||
);
|
||||
if (!compoundSel || compoundSel.dataset.compoundBudgetBound === "1") return;
|
||||
compoundSel.dataset.compoundBudgetBound = "1";
|
||||
compoundSel.addEventListener("change", () => syncCompoundBudgetVisibility(body));
|
||||
}
|
||||
|
||||
function bindTradeModeAutoRefresh(body) {
|
||||
const modeSel = body.querySelector('.env-field-input[data-env-key="OKX_TRADE_MODE"]');
|
||||
if (!modeSel || modeSel.dataset.modeRefreshBound === "1") return;
|
||||
@@ -542,7 +574,10 @@
|
||||
loadEnvConfig(false);
|
||||
const root = envConfigRoot();
|
||||
const body = root && root.querySelector("#env-config-body");
|
||||
if (body) bindTradeModeAutoRefresh(body);
|
||||
if (body) {
|
||||
bindTradeModeAutoRefresh(body);
|
||||
bindCompoundBudgetVisibility(body);
|
||||
}
|
||||
if (global.__INSTANCE_DISPLAY__) applyDisplayToNav(global.__INSTANCE_DISPLAY__);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user