diff --git a/crypto_monitor_binance/templates/index.html b/crypto_monitor_binance/templates/index.html
index 29b02ca..3953607 100644
--- a/crypto_monitor_binance/templates/index.html
+++ b/crypto_monitor_binance/templates/index.html
@@ -834,7 +834,7 @@
-
+
-
+
-
+
-
+
-
+
{% include 'embed_boot_scripts.html' %}
diff --git a/static/instance_theme.css b/static/instance_theme.css
index c4dbed6..98f60da 100644
--- a/static/instance_theme.css
+++ b/static/instance_theme.css
@@ -1305,10 +1305,6 @@ html[data-theme="light"] .detail-actions {
align-items: center;
}
-.roll-field[hidden] {
- display: none !important;
-}
-
#strategy-roll-panel .roll-risk-banner {
margin-bottom: 8px;
color: #8fc8ff;
diff --git a/static/strategy_roll.js b/static/strategy_roll.js
index 47b38ae..c4c8d02 100644
--- a/static/strategy_roll.js
+++ b/static/strategy_roll.js
@@ -1,6 +1,35 @@
(function () {
"use strict";
+ function syncRollFormMode(form, mode) {
+ if (!form) return;
+ const m = mode || "market";
+ form.setAttribute("data-add-mode", m);
+ const showFib = m === "fib_618" || m === "fib_786";
+ const showBreakout = m === "breakout";
+ const fibWrap = form.querySelector(".roll-field-fib");
+ const breakoutWrap = form.querySelector(".roll-field-breakout");
+ const fibUpper = form.querySelector("#roll-fib-upper");
+ const fibLower = form.querySelector("#roll-fib-lower");
+ const breakoutInput = form.querySelector("#roll-breakout");
+
+ function tuneInput(inp, active, required) {
+ if (!inp) return;
+ inp.disabled = !active;
+ inp.required = !!required && active;
+ inp.tabIndex = active ? 0 : -1;
+ if (!active) inp.value = "";
+ }
+
+ if (fibWrap) fibWrap.setAttribute("aria-hidden", showFib ? "false" : "true");
+ if (breakoutWrap) breakoutWrap.setAttribute("aria-hidden", showBreakout ? "false" : "true");
+ tuneInput(fibUpper, showFib, showFib);
+ tuneInput(fibLower, showFib, showFib);
+ tuneInput(breakoutInput, showBreakout, showBreakout);
+ }
+
+ window.syncRollFormMode = syncRollFormMode;
+
const form = document.getElementById("roll-form");
if (!form) return;
@@ -13,11 +42,6 @@
const previewBox = document.getElementById("roll-preview-box");
const previewText = document.getElementById("roll-preview-text");
const countdownEl = document.getElementById("roll-countdown");
- const fibWrap = form.querySelector(".roll-field-fib");
- const breakoutWrap = form.querySelector(".roll-field-breakout");
- const fibUpper = document.getElementById("roll-fib-upper");
- const fibLower = document.getElementById("roll-fib-lower");
- const breakoutInput = document.getElementById("roll-breakout");
let countdownTimer = null;
let previewOk = false;
@@ -40,24 +64,8 @@
"当前风险:" + rp + "%(来自监控单 #" + (opt.getAttribute("data-monitor-id") || "?") + ")";
}
- function setFieldGroup(wrap, inputs, visible, required) {
- if (!wrap) return;
- wrap.hidden = !visible;
- inputs.forEach(function (inp) {
- if (!inp) return;
- inp.disabled = !visible;
- inp.required = !!required && visible;
- if (!visible) inp.value = "";
- });
- }
-
function syncFieldVisibility() {
- const mode = modeSel.value || "market";
- form.setAttribute("data-add-mode", mode);
- const showFib = mode === "fib_618" || mode === "fib_786";
- const showBreakout = mode === "breakout";
- setFieldGroup(fibWrap, [fibUpper, fibLower], showFib, showFib);
- setFieldGroup(breakoutWrap, [breakoutInput], showBreakout, showBreakout);
+ syncRollFormMode(form, modeSel.value || "market");
resetPreview();
}
diff --git a/strategy_templates/strategy_roll_panel.html b/strategy_templates/strategy_roll_panel.html
index 791e3e7..3d52d7f 100644
--- a/strategy_templates/strategy_roll_panel.html
+++ b/strategy_templates/strategy_roll_panel.html
@@ -30,18 +30,18 @@
{% endfor %}
-