|
12 | 12 |
|
13 | 13 | <script> |
14 | 14 | (function () { |
15 | | - // Sourced from swiftlang/swift-org-website's assets/images/icon-swift.svg |
16 | | - // (the currentColor variant, meant for light/dark masthead use — the |
17 | | - // upstream asset intentionally leaves fill unset so consumers apply their |
18 | | - // own; fill="currentColor" below is added here to do that). |
| 15 | + // Sourced from swiftlang/swift-org-website's assets/images/icon-swift.svg, |
| 16 | + // the currentColor variant — fill="currentColor" below is added here since |
| 17 | + // the upstream asset leaves it unset for consumers to apply. |
19 | 18 | var LOGO_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="22" height="22" aria-hidden="true"><path fill="currentColor" fill-rule="nonzero" transform="matrix(.351937 0 0 .351937 -1.96558 -2.00601)" d="m46.955 36.578c-.002-.002-.003-.003-.005-.005.066-.223.134-.445.191-.673 2.46-9.799-3.543-21.384-13.701-27.484 4.452 6.035 6.42 13.344 4.671 19.735-.156.571-.343 1.118-.55 1.65-.225-.148-.509-.316-.889-.526 0 0-10.104-6.238-21.055-17.273-.288-.29 5.839 8.757 12.793 16.104-3.276-1.839-12.406-8.482-18.186-13.772.71 1.185 1.555 2.325 2.483 3.423 4.827 6.121 11.121 13.673 18.662 19.473-5.298 3.242-12.785 3.494-20.239.003-1.844-.864-3.577-1.907-5.182-3.091 3.156 5.047 8.015 9.401 13.93 11.943 7.054 3.032 14.068 2.826 19.292.05l-.004.006c.024-.015.054-.031.079-.047.214-.115.427-.232.636-.356 2.51-1.303 7.467-2.625 10.129 2.553.651 1.267 2.036-5.448-3.055-11.713z"/></svg>'; |
20 | 19 |
|
21 | | - // The masthead (.nav-content > .pre-title, .nav-title, .nav-menu) is |
22 | | - // rendered client-side by swift-docc-render (Vue), not present in this |
23 | | - // page's initial HTML, so it may not exist yet when this script runs — |
24 | | - // retry via MutationObserver until it mounts. Unlike the Navigator |
25 | | - // sidebar, the masthead has no loading-skeleton/real-content swap to |
26 | | - // race against: it mounts once from data already known at page load and |
27 | | - // stays, so this observer keeps running (harmlessly, guarded by the |
28 | | - // .masthead-swift-logo check below) rather than needing to disconnect at |
29 | | - // a precise moment. |
30 | | - // |
31 | | - // Appended as the last child of `.pre-title` rather than inserted as a |
32 | | - // sibling between `.pre-title` and `.nav-title`: swift-docc-render's own |
33 | | - // CSS assigns `.nav-title` its grid placement via the adjacent-sibling |
34 | | - // selector `.pre-title + .nav-title`, which requires them to stay |
35 | | - // immediate siblings. Landing inside `.pre-title` keeps that intact while |
36 | | - // still sitting visually between the sidebar toggle and the title text — |
37 | | - // and, being part of the persistent masthead rather than the sidebar |
38 | | - // itself, it stays visible regardless of whether the sidebar is shown, |
39 | | - // hidden, or a mobile drawer. |
| 20 | + // Appended inside `.pre-title` rather than inserted as a sibling before |
| 21 | + // `.nav-title`: swift-docc-render positions the title via the CSS rule |
| 22 | + // `.pre-title + .nav-title`, which needs them to stay adjacent siblings. |
| 23 | + // This keeps that intact while still landing between the sidebar toggle |
| 24 | + // and the title — and, being part of the masthead rather than the |
| 25 | + // sidebar, it stays visible regardless of the sidebar's own |
| 26 | + // shown/hidden/drawer state. |
40 | 27 | function insertLogoLink() { |
41 | 28 | var preTitle = document.querySelector('.pre-title'); |
42 | 29 | if (!preTitle || preTitle.querySelector('.masthead-swift-logo')) { |
|
0 commit comments