|
5 | 5 | const isRoot = parts.length === 0 || (parts.length === 1 && parts[0] === 'index.html'); |
6 | 6 | const prefix = isRoot ? '/' : '../'; |
7 | 7 |
|
8 | | - function isActive(name) { return path.includes('/' + name); } |
9 | | - function link(name, label, extra) { |
10 | | - const active = isActive(name) ? ' class="active"' : ''; |
11 | | - if (extra) return `<a href="${prefix}${name}"${active} style="${extra}">${label}</a>`; |
12 | | - return `<a href="${prefix}${name}"${active}>${label}</a>`; |
| 8 | + function isActive(name) { |
| 9 | + if (name === 'libraries#whats-new') return false; |
| 10 | + return path.includes('/' + name); |
| 11 | + } |
| 12 | + |
| 13 | + function link(href, label, style) { |
| 14 | + const active = isActive(href) ? ' class="active"' : ''; |
| 15 | + const s = style ? ` style="${style}"` : ''; |
| 16 | + return `<a href="${prefix}${href}"${active}${s}>${label}</a>`; |
13 | 17 | } |
14 | 18 |
|
15 | 19 | const nav = document.getElementById('site-nav'); |
|
32 | 36 | const sidebar = document.getElementById('site-sidebar') || document.querySelector('.sidebar'); |
33 | 37 | if (sidebar) { |
34 | 38 | sidebar.innerHTML = ` |
| 39 | + ${link('libraries#whats-new', "What's New", 'color:#e8b400;font-weight:700;')} |
| 40 | + <div style="height:1px;background:#e0e0e0;margin:0.5rem 0;"></div> |
35 | 41 | ${link('libraries', 'Libraries')} |
36 | 42 | ${link('reference', 'Reference')} |
37 | 43 | ${link('examples', 'Examples')} |
38 | 44 | ${link('about', 'About')} |
39 | | - <div style="height:1px;background:#e0e0e0;margin:0.75rem 0;"></div> |
40 | | - ${link('libraries#whats-new', "What's New", 'color:#e8b400;font-weight:600;font-size:13px;')} |
41 | 45 | `; |
42 | 46 | } |
43 | 47 |
|
|
69 | 73 | flex-direction: column; |
70 | 74 | line-height: 1.15; |
71 | 75 | } |
72 | | - .nav-title-top { |
73 | | - font-size: 13px; |
74 | | - font-weight: 700; |
75 | | - color: #e8b400; |
76 | | - } |
77 | | - .nav-title-bottom { |
78 | | - font-size: 13px; |
79 | | - font-weight: 700; |
80 | | - color: #e8b400; |
81 | | - } |
| 76 | + .nav-title-top { font-size: 13px; font-weight: 700; color: #e8b400; } |
| 77 | + .nav-title-bottom { font-size: 13px; font-weight: 700; color: #e8b400; } |
82 | 78 | .hamburger { |
83 | 79 | background: none; |
84 | 80 | border: none; |
|
88 | 84 | display: none; |
89 | 85 | margin-left: 0.5rem; |
90 | 86 | } |
91 | | - @media (max-width: 768px) { |
92 | | - .hamburger { display: block; } |
93 | | - } |
| 87 | + @media (max-width: 768px) { .hamburger { display: block; } } |
94 | 88 | `; |
95 | 89 | document.head.appendChild(style); |
96 | 90 | } |
|
0 commit comments