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();
|
global.toggleReviewMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!revisit && tab === "stats") {
|
if (tab === "stats") {
|
||||||
if (typeof global.initStatsSegmentFromUrl === "function") global.initStatsSegmentFromUrl();
|
if (typeof global.initStatsSegmentFromUrl === "function") global.initStatsSegmentFromUrl();
|
||||||
}
|
}
|
||||||
if (tab === "settings" || tab === "env_config") {
|
if (tab === "settings" || tab === "env_config") {
|
||||||
|
|||||||
@@ -61,20 +61,25 @@
|
|||||||
switchStatsPeriod(period);
|
switchStatsPeriod(period);
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindPeriodTabs() {
|
function ensurePeriodTabDelegation() {
|
||||||
document.querySelectorAll(".stats-period-tab").forEach(function (btn) {
|
if (global.__instanceStatsTabsDelegated) return;
|
||||||
if (btn.getAttribute("data-stats-bound") === "1") return;
|
global.__instanceStatsTabsDelegated = true;
|
||||||
btn.setAttribute("data-stats-bound", "1");
|
document.addEventListener("click", function (e) {
|
||||||
btn.addEventListener("click", function () {
|
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");
|
switchStatsPeriod(btn.getAttribute("data-stats-period") || "day");
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initStatsFromUrl() {
|
function initStatsFromUrl() {
|
||||||
var sel = statsSegmentSelect();
|
var sel = statsSegmentSelect();
|
||||||
if (!sel) return;
|
if (!sel) return;
|
||||||
bindPeriodTabs();
|
ensurePeriodTabDelegation();
|
||||||
var url = new URLSearchParams(global.location.search);
|
var url = new URLSearchParams(global.location.search);
|
||||||
var segKey = url.get("stats_segment");
|
var segKey = url.get("stats_segment");
|
||||||
if (
|
if (
|
||||||
@@ -89,6 +94,8 @@
|
|||||||
switchStatsPeriod(period);
|
switchStatsPeriod(period);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensurePeriodTabDelegation();
|
||||||
|
|
||||||
global.switchStatsSegment = switchStatsSegment;
|
global.switchStatsSegment = switchStatsSegment;
|
||||||
global.switchStatsPeriod = switchStatsPeriod;
|
global.switchStatsPeriod = switchStatsPeriod;
|
||||||
global.initStatsFromUrl = initStatsFromUrl;
|
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/symbol_live_price.js?v=2"></script>
|
||||||
<script src="/static/strategy_roll.js?v=6"></script>
|
<script src="/static/strategy_roll.js?v=6"></script>
|
||||||
<script src="/static/key_monitor_form.js?v=2"></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' %}
|
{% include 'embed_boot_scripts.html' %}
|
||||||
<script>
|
<script>
|
||||||
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
|
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
|
||||||
</script>
|
</script>
|
||||||
<script src="/static/instance_settings_prefs.js?v=12"></script>
|
<script src="/static/instance_settings_prefs.js?v=12"></script>
|
||||||
<script src="/static/instance_live.js?v=4"></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>
|
</body>
|
||||||
</html>
|
</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/manual_order_rr_preview.js?v=5"></script>
|
||||||
<script src="/static/symbol_live_price.js?v=2"></script>
|
<script src="/static/symbol_live_price.js?v=2"></script>
|
||||||
<script src="/static/strategy_roll.js?v=6"></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>
|
<script>
|
||||||
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
const JOURNAL_ENTRY_REASON_OPTIONS = {{ entry_reason_options | tojson }};
|
||||||
const JOURNAL_ORDER_TYPE_OPTIONS = {{ order_type_options | tojson }};
|
const JOURNAL_ORDER_TYPE_OPTIONS = {{ order_type_options | tojson }};
|
||||||
|
|||||||
Reference in New Issue
Block a user