| 5 | * @param {string} name |
| 6 | */ |
| 7 | const changeTab = (container, name) => { |
| 8 | for (const child of container.children) { |
| 9 | if (!(child instanceof HTMLElement)) { |
| 10 | continue; |
| 11 | } |
| 12 | |
| 13 | if (child.classList.contains('mdbook-tabs')) { |
| 14 | for (const tab of child.children) { |
| 15 | if (!(tab instanceof HTMLElement)) { |
| 16 | continue; |
| 17 | } |
| 18 | |
| 19 | if (tab.dataset.tabname === name) { |
| 20 | tab.classList.add('active'); |
| 21 | } else { |
| 22 | tab.classList.remove('active'); |
| 23 | } |
| 24 | } |
| 25 | } else if (child.classList.contains('mdbook-tab-content')) { |
| 26 | if (child.dataset.tabname === name) { |
| 27 | child.classList.remove('hidden'); |
| 28 | } else { |
| 29 | child.classList.add('hidden'); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | }; |
| 34 | |
| 35 | document.addEventListener('DOMContentLoaded', () => { |
| 36 | const tabs = document.querySelectorAll('.mdbook-tab'); |