BinKhoaLe1812 commited on
Commit
16c50b5
·
verified ·
1 Parent(s): dd9270c

Upd mermaid cache

Browse files
Files changed (1) hide show
  1. index.html +9 -10
index.html CHANGED
@@ -1354,7 +1354,7 @@ L_t = α * CE(y_t) + (1-α) * τ^2 * KL( p_T(·|τ) || p_S(·) )</code></pre>
1354
  }
1355
 
1356
  // Cache mermaid src (before any render)
1357
- cacheMermaidSources();
1358
 
1359
  function showToast(msg) {
1360
  const t = $('#toast');
@@ -1483,23 +1483,22 @@ L_t = α * CE(y_t) + (1-α) * τ^2 * KL( p_T(·|τ) || p_S(·) )</code></pre>
1483
  btn.addEventListener('click', () => {
1484
  const group = btn.closest('[role="tablist"]') || btn.parentElement;
1485
  const tabId = btn.dataset.tab;
1486
-
1487
- // activate tabs in the same group
1488
  $$('.tab', group).forEach(t => t.classList.remove('active'));
1489
  btn.classList.add('active');
1490
-
1491
- // show/hide related panels (by id)
1492
  const root = group.closest('.card-body') || document;
1493
  $$('.tabpanel', root).forEach(p => p.classList.add('hidden'));
1494
- const panel = $('#' + tabId);
 
1495
  if (panel) panel.classList.remove('hidden');
1496
-
1497
- // re-render mermaid if panel contains diagrams
1498
- requestAnimationFrame(() => await renderMermaid());
1499
  });
1500
  });
1501
  }
1502
 
 
1503
  // ---------- Accordion ----------
1504
  function initAccordion() {
1505
  $$('.accordion-item').forEach(item => {
@@ -1805,7 +1804,7 @@ L_t = α * CE(y_t) + (1-α) * τ^2 * KL( p_T(·|τ) || p_S(·) )</code></pre>
1805
  // Render math + mermaid after libs load
1806
  setTimeout(() => {
1807
  renderMath();
1808
- await renderMermaid();
1809
  }, 0);
1810
 
1811
  initGSAP();
 
1354
  }
1355
 
1356
  // Cache mermaid src (before any render)
1357
+ window.addEventListener('DOMContentLoaded', cacheMermaidSources);
1358
 
1359
  function showToast(msg) {
1360
  const t = $('#toast');
 
1483
  btn.addEventListener('click', () => {
1484
  const group = btn.closest('[role="tablist"]') || btn.parentElement;
1485
  const tabId = btn.dataset.tab;
1486
+
 
1487
  $$('.tab', group).forEach(t => t.classList.remove('active'));
1488
  btn.classList.add('active');
1489
+
 
1490
  const root = group.closest('.card-body') || document;
1491
  $$('.tabpanel', root).forEach(p => p.classList.add('hidden'));
1492
+
1493
+ const panel = document.getElementById(tabId);
1494
  if (panel) panel.classList.remove('hidden');
1495
+
1496
+ requestAnimationFrame(() => { renderMermaid(); });
 
1497
  });
1498
  });
1499
  }
1500
 
1501
+
1502
  // ---------- Accordion ----------
1503
  function initAccordion() {
1504
  $$('.accordion-item').forEach(item => {
 
1804
  // Render math + mermaid after libs load
1805
  setTimeout(() => {
1806
  renderMath();
1807
+ renderMermaid();
1808
  }, 0);
1809
 
1810
  initGSAP();