Fix instance stats week/month tabs not responding after embed preload.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -109,7 +109,7 @@
|
||||
global.toggleReviewMode();
|
||||
}
|
||||
}
|
||||
if (!revisit && tab === "stats") {
|
||||
if (tab === "stats") {
|
||||
if (typeof global.initStatsSegmentFromUrl === "function") global.initStatsSegmentFromUrl();
|
||||
}
|
||||
if (tab === "settings" || tab === "env_config") {
|
||||
|
||||
@@ -61,20 +61,25 @@
|
||||
switchStatsPeriod(period);
|
||||
}
|
||||
|
||||
function bindPeriodTabs() {
|
||||
document.querySelectorAll(".stats-period-tab").forEach(function (btn) {
|
||||
if (btn.getAttribute("data-stats-bound") === "1") return;
|
||||
btn.setAttribute("data-stats-bound", "1");
|
||||
btn.addEventListener("click", function () {
|
||||
switchStatsPeriod(btn.getAttribute("data-stats-period") || "day");
|
||||
});
|
||||
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");
|
||||
});
|
||||
}
|
||||
|
||||
function initStatsFromUrl() {
|
||||
var sel = statsSegmentSelect();
|
||||
if (!sel) return;
|
||||
bindPeriodTabs();
|
||||
ensurePeriodTabDelegation();
|
||||
var url = new URLSearchParams(global.location.search);
|
||||
var segKey = url.get("stats_segment");
|
||||
if (
|
||||
@@ -89,6 +94,8 @@
|
||||
switchStatsPeriod(period);
|
||||
}
|
||||
|
||||
ensurePeriodTabDelegation();
|
||||
|
||||
global.switchStatsSegment = switchStatsSegment;
|
||||
global.switchStatsPeriod = switchStatsPeriod;
|
||||
global.initStatsFromUrl = initStatsFromUrl;
|
||||
|
||||
@@ -100,13 +100,13 @@ 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=1"></script>
|
||||
<script src="/static/instance_stats.js?v=2"></script>
|
||||
{% include 'embed_boot_scripts.html' %}
|
||||
<script>
|
||||
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
|
||||
</script>
|
||||
<script src="/static/instance_settings_prefs.js?v=12"></script>
|
||||
<script src="/static/instance_live.js?v=4"></script>
|
||||
<script src="/static/instance_embed.js?v=22"></script>
|
||||
<script src="/static/instance_embed.js?v=23"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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=1"></script>
|
||||
<script src="/static/instance_stats.js?v=2"></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