Register instance_stats.js static route so period tabs work on all exchanges.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,7 +7,17 @@
|
||||
return document.getElementById("stats-segment-select");
|
||||
}
|
||||
|
||||
function activeSegmentPanel() {
|
||||
function panelFromTrigger(triggerEl) {
|
||||
if (triggerEl && triggerEl.closest) {
|
||||
var fromBtn = triggerEl.closest(".stats-segment-panel");
|
||||
if (fromBtn) return fromBtn;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function activeSegmentPanel(triggerEl) {
|
||||
var panel = panelFromTrigger(triggerEl);
|
||||
if (panel) return panel;
|
||||
var sel = statsSegmentSelect();
|
||||
if (!sel) return null;
|
||||
var key = sel.value;
|
||||
@@ -30,8 +40,8 @@
|
||||
);
|
||||
}
|
||||
|
||||
function switchStatsPeriod(periodKey) {
|
||||
var panel = activeSegmentPanel();
|
||||
function switchStatsPeriod(periodKey, triggerEl) {
|
||||
var panel = activeSegmentPanel(triggerEl);
|
||||
if (!panel) return;
|
||||
var key = PERIODS.indexOf(periodKey) >= 0 ? periodKey : "day";
|
||||
panel.querySelectorAll(".stats-period-pane").forEach(function (pane) {
|
||||
@@ -64,16 +74,20 @@
|
||||
function ensurePeriodTabDelegation() {
|
||||
if (global.__instanceStatsTabsDelegated) return;
|
||||
global.__instanceStatsTabsDelegated = true;
|
||||
document.addEventListener("click", function (e) {
|
||||
var btn =
|
||||
e.target && e.target.closest
|
||||
? e.target.closest(".stats-period-tab")
|
||||
: null;
|
||||
if (!btn) return;
|
||||
var card = document.getElementById("stats-card");
|
||||
if (!card || !card.contains(btn)) return;
|
||||
switchStatsPeriod(btn.getAttribute("data-stats-period") || "day");
|
||||
});
|
||||
document.addEventListener(
|
||||
"click",
|
||||
function (e) {
|
||||
var btn =
|
||||
e.target && e.target.closest
|
||||
? e.target.closest(".stats-period-tab")
|
||||
: null;
|
||||
if (!btn) return;
|
||||
var card = document.getElementById("stats-card");
|
||||
if (!card || !card.contains(btn)) return;
|
||||
switchStatsPeriod(btn.getAttribute("data-stats-period") || "day", btn);
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
function initStatsFromUrl() {
|
||||
|
||||
@@ -68,6 +68,7 @@ def install_instance_theme_static(app) -> None:
|
||||
"strategy_roll.js": "application/javascript; charset=utf-8",
|
||||
"instance_page.css": "text/css; charset=utf-8",
|
||||
"instance_embed.js": "application/javascript; charset=utf-8",
|
||||
"instance_stats.js": "application/javascript; charset=utf-8",
|
||||
"instance_live.js": "application/javascript; charset=utf-8",
|
||||
"instance_settings_prefs.js": "application/javascript; charset=utf-8",
|
||||
"options_panel.js": "application/javascript; charset=utf-8",
|
||||
|
||||
@@ -100,7 +100,7 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj
|
||||
<script src="/static/symbol_live_price.js?v=2"></script>
|
||||
<script src="/static/strategy_roll.js?v=6"></script>
|
||||
<script src="/static/key_monitor_form.js?v=2"></script>
|
||||
<script src="/static/instance_stats.js?v=3"></script>
|
||||
<script src="/static/instance_stats.js?v=4"></script>
|
||||
{% include 'embed_boot_scripts.html' %}
|
||||
<script>
|
||||
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
|
||||
|
||||
@@ -629,7 +629,7 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj
|
||||
<script src="/static/manual_order_rr_preview.js?v=5"></script>
|
||||
<script src="/static/symbol_live_price.js?v=2"></script>
|
||||
<script src="/static/strategy_roll.js?v=6"></script>
|
||||
<script src="/static/instance_stats.js?v=3"></script>
|
||||
<script src="/static/instance_stats.js?v=4"></script>
|
||||
<script>
|
||||
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
||||
const JOURNAL_ORDER_TYPE_OPTIONS = {{ order_type_options | tojson }};
|
||||
|
||||
Reference in New Issue
Block a user