refactor: establish standalone application boundary
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
let sentimentChartAnimationFrame = null;
|
||||
|
||||
window.XiaobaiPageModules.register("sentiment", ["sentimentCycleView"], {
|
||||
bind: bindSentimentEvents,
|
||||
enter: ["loadSentiment"],
|
||||
});
|
||||
|
||||
/* PRESERVATION-SOURCE-BEGIN app.js:1207-1516 */
|
||||
async function loadSentimentHistory(force = false) {
|
||||
if (!state.dashboard || state.sentimentLoading) return;
|
||||
const key = `${elements.tradeDate.value}:${state.sentimentRange}`;
|
||||
@@ -313,4 +315,20 @@ function sentimentPhaseAdvice(phase) {
|
||||
}[phase] || "市场结构尚未形成清晰阶段,保持观察并等待确认。";
|
||||
}
|
||||
|
||||
/* PRESERVATION-SOURCE-END app.js:1207-1516 */
|
||||
|
||||
function trendClass(trend) {
|
||||
return { "升温": "trend-hot", "降温": "trend-cool", "新进": "trend-new", "持平": "trend-flat" }[trend] || "trend-flat";
|
||||
}
|
||||
|
||||
function bindSentimentEvents() {
|
||||
document.querySelector("#sentimentExportButton").addEventListener("click", exportSentimentHistory);
|
||||
document.querySelectorAll("[data-sentiment-range]").forEach((button) => {
|
||||
button.addEventListener("click", () => {
|
||||
state.sentimentRange = number(button.dataset.sentimentRange) || 20;
|
||||
document.querySelectorAll("[data-sentiment-range]").forEach((item) => {
|
||||
item.classList.toggle("active", item === button);
|
||||
});
|
||||
loadSentimentHistory(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user