|
106 | 106 | #manager-info .model-tip { color: #6c757d; margin: 0; } |
107 | 107 |
|
108 | 108 | /* ── Charts container ────────────────────────────────── */ |
109 | | - /* |
110 | | - * index.js checks getElementById('charts-container') first. |
111 | | - * If found it uses it directly — no new div is created. |
112 | | - * We pre-place it here with the right flex layout so the |
113 | | - * chart wrappers index.js injects get the correct sizing. |
114 | | - */ |
115 | 109 | #charts-container { |
116 | 110 | display: flex; |
117 | 111 | flex-wrap: wrap; |
|
121 | 115 | width: 100%; |
122 | 116 | box-sizing: border-box; |
123 | 117 | } |
124 | | - |
125 | | - /* |
126 | | - * index.js creates each wrapper with data-chart-wrapper="1" |
127 | | - * and inline flex/size styles. We layer card styling on top. |
128 | | - */ |
129 | 118 | #charts-container > div[data-chart-wrapper="1"] { |
130 | 119 | background: #fff; |
131 | 120 | border-radius: var(--radius); |
@@ -185,22 +174,11 @@ <h1> |
185 | 174 | </div> |
186 | 175 | </div> |
187 | 176 |
|
188 | | - <!-- ══ MODEL BANNER ══════════════════════════════════════ --> |
189 | | - <!-- |
190 | | - index.js owns innerHTML of this div via renderManagerInfo(). |
191 | | - It also appends a <select> dropdown here via setupUI(). |
192 | | - Keep it empty — do not put static content inside. |
193 | | - --> |
| 177 | + <!-- index.js owns innerHTML of this div via renderManagerInfo() --> |
| 178 | + <!-- It also appends a <select> dropdown here via setupUI() --> |
194 | 179 | <div id="manager-info" role="status" aria-live="polite"></div> |
195 | 180 |
|
196 | | - <!-- ══ CHARTS ════════════════════════════════════════════ --> |
197 | | - <!-- |
198 | | - Pre-placed so index.js → ensureChartElements() finds it |
199 | | - immediately via getElementById('charts-container') and |
200 | | - appends chart wrapper divs directly inside rather than |
201 | | - creating a new container and inserting it after #manager-info. |
202 | | - The CSS above styles each injected [data-chart-wrapper="1"]. |
203 | | - --> |
| 181 | + <!-- index.js → ensureChartElements() appends chart wrappers here --> |
204 | 182 | <div id="charts-container"></div> |
205 | 183 |
|
206 | 184 | <!-- ══ FOOTER ════════════════════════════════════════════ --> |
@@ -260,22 +238,39 @@ <h1> |
260 | 238 |
|
261 | 239 | /* ── model display (pre-index.js only; index.js overwrites innerHTML) ── */ |
262 | 240 | function updateModelDisplay(name, tip) { |
263 | | - /* Once index.js has written its own HTML (contains the span), step back */ |
| 241 | + /* Once index.js has written its own HTML (contains a span with inline color), |
| 242 | + step back and let it own the banner. */ |
264 | 243 | const m = $id('manager-info'); |
265 | 244 | if (m && m.querySelector('span[style*="color"]')) return; |
266 | 245 |
|
267 | 246 | const normalized = (typeof name === 'string' && name.trim()) ? name.trim() : null; |
268 | 247 | if (!normalized) return; |
269 | 248 |
|
270 | 249 | if (m) { |
271 | | - m.innerHTML = |
272 | | - `<div style="font-weight:700;font-size:1rem;margin-bottom:4px"> |
273 | | - Active Model: <span class="model-name">${normalized}</span> |
274 | | - </div> |
275 | | - <p class="model-tip">${ |
276 | | - tip || MODEL_TIPS[normalized] || 'No tip available for this model.' |
277 | | - }</p>`; |
| 250 | + /* ── FIX: build DOM with textContent instead of innerHTML ── */ |
| 251 | + /* Clear existing children */ |
| 252 | + while (m.firstChild) m.removeChild(m.firstChild); |
| 253 | + |
| 254 | + /* Header div: "Active Model: <span.model-name>" */ |
| 255 | + const headerDiv = document.createElement('div'); |
| 256 | + headerDiv.style.fontWeight = '700'; |
| 257 | + headerDiv.style.fontSize = '1rem'; |
| 258 | + headerDiv.style.marginBottom = '4px'; |
| 259 | + headerDiv.appendChild(document.createTextNode('Active Model: ')); |
| 260 | + const nameSpan = document.createElement('span'); |
| 261 | + nameSpan.className = 'model-name'; |
| 262 | + nameSpan.textContent = normalized; /* safe: no HTML parsing */ |
| 263 | + headerDiv.appendChild(nameSpan); |
| 264 | + |
| 265 | + /* Tip paragraph */ |
| 266 | + const tipP = document.createElement('p'); |
| 267 | + tipP.className = 'model-tip'; |
| 268 | + tipP.textContent = tip || MODEL_TIPS[normalized] || 'No tip available for this model.'; |
| 269 | + |
| 270 | + m.appendChild(headerDiv); |
| 271 | + m.appendChild(tipP); |
278 | 272 | } |
| 273 | + |
279 | 274 | lastKnownModel = normalized; |
280 | 275 | } |
281 | 276 |
|
|
0 commit comments