(platform: string)
| 17 | // find all platform-specific *block* elements and hide or show as appropriate |
| 18 | // example: {% mac %} block content {% endmac %} |
| 19 | function showPlatformSpecificContent(platform: string) { |
| 20 | const markdowns = Array.from(document.querySelectorAll<HTMLElement>('.extended-markdown')) |
| 21 | markdowns |
| 22 | .filter((el) => platforms.some((platform) => el.classList.contains(platform.value))) |
| 23 | .forEach((el) => { |
| 24 | el.style.display = el.classList.contains(platform) ? '' : 'none' |
| 25 | }) |
| 26 | |
| 27 | // find all platform-specific *inline* elements and hide or show as appropriate |
| 28 | // example: <span class="platform-mac">inline content</span> |
| 29 | const platformEls = Array.from( |
| 30 | document.querySelectorAll<HTMLElement>( |
| 31 | platforms.map((platform) => `.platform-${platform.value}`).join(', ') |
| 32 | ) |
| 33 | ) |
| 34 | platformEls.forEach((el) => { |
| 35 | el.style.display = el.classList.contains(`platform-${platform}`) ? '' : 'none' |
| 36 | }) |
| 37 | } |
| 38 | |
| 39 | export const PlatformPicker = () => { |
| 40 | const { defaultPlatform, detectedPlatforms } = useArticleContext() |
nothing calls this directly
no outgoing calls
no test coverage detected