|
134 | 134 | .nav-links a:hover{color:var(--fg-hi);text-decoration:none} |
135 | 135 |
|
136 | 136 | .nav-right{margin-left:auto;display:flex;gap:10px;align-items:center} |
137 | | -.nav-gh{ |
138 | | - color:var(--fg-dim);text-decoration:none; |
139 | | - font-size:11px;letter-spacing:0.06em;font-family:var(--mono); |
140 | | - border:1px solid var(--border); |
141 | | - padding:5px 12px;transition:all 0.18s;border-radius:4px; |
| 137 | + |
| 138 | +/* GitHub-style star button: [★ Star] [count] with the connecting caret */ |
| 139 | +.gh-star{ |
| 140 | + display:inline-flex;align-items:stretch; |
| 141 | + font-size:12px;font-weight:600;line-height:1; |
| 142 | + text-decoration:none;color:var(--fg); |
| 143 | +} |
| 144 | +.gh-star:hover{text-decoration:none} |
| 145 | +.gh-star-btn{ |
| 146 | + display:inline-flex;align-items:center;gap:6px; |
| 147 | + padding:5px 10px; |
| 148 | + color:var(--fg);background:var(--bg2); |
| 149 | + border:1px solid var(--border);border-radius:6px 0 0 6px; |
| 150 | + transition:background 0.15s,border-color 0.15s; |
| 151 | +} |
| 152 | +.gh-star-btn svg{width:14px;height:14px;fill:currentColor} |
| 153 | +.gh-star:hover .gh-star-btn{background:var(--bg3);border-color:var(--fg-dim)} |
| 154 | +.gh-star-count{ |
| 155 | + display:none;align-items:center;position:relative; |
| 156 | + padding:5px 10px;margin-left:7px; |
| 157 | + color:var(--fg);background:var(--bg); |
| 158 | + border:1px solid var(--border);border-radius:6px; |
| 159 | + font-variant-numeric:tabular-nums; |
| 160 | +} |
| 161 | +/* the little triangle that points from the count box back at the button */ |
| 162 | +.gh-star-count::before{ |
| 163 | + content:"";position:absolute;left:-7px;top:50%;transform:translateY(-50%); |
| 164 | + border:7px solid transparent;border-right-color:var(--border);border-left:0; |
| 165 | +} |
| 166 | +.gh-star-count::after{ |
| 167 | + content:"";position:absolute;left:-6px;top:50%;transform:translateY(-50%); |
| 168 | + border:6px solid transparent;border-right-color:var(--bg);border-left:0; |
142 | 169 | } |
143 | | -.nav-gh:hover{color:var(--fg-hi);border-color:var(--fg-dim);text-decoration:none} |
144 | 170 |
|
145 | 171 | /* ─── SECTIONS ──────────────────────────────────────────────── */ |
146 | 172 | .sec{ |
|
488 | 514 | <a href="#faq">FAQ</a> |
489 | 515 | </div> |
490 | 516 | <div class="nav-right"> |
491 | | - <a href="https://github.com/dirge-code/dirge" class="nav-gh">★ Star on GitHub</a> |
| 517 | + <a href="https://github.com/dirge-code/dirge" class="gh-star" aria-label="Star dirge-code/dirge on GitHub"> |
| 518 | + <span class="gh-star-btn"> |
| 519 | + <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z"/></svg> |
| 520 | + Star |
| 521 | + </span> |
| 522 | + <span class="gh-star-count" id="ghStars"></span> |
| 523 | + </a> |
492 | 524 | </div> |
493 | 525 | </div> |
494 | 526 | </nav> |
@@ -1310,6 +1342,19 @@ <h5>Built with</h5> |
1310 | 1342 | d.style.display=(d.dataset.thc===th)?'':'none'; |
1311 | 1343 | }); |
1312 | 1344 | }; |
| 1345 | + |
| 1346 | +// Live GitHub star count for the nav star button. Graceful: if the API |
| 1347 | +// is unreachable or rate-limited, the count box stays hidden and the |
| 1348 | +// button still reads "★ Star". |
| 1349 | +fetch('https://api.github.com/repos/dirge-code/dirge') |
| 1350 | + .then(function(r){return r.ok?r.json():null;}) |
| 1351 | + .then(function(d){ |
| 1352 | + if(!d||typeof d.stargazers_count!=='number')return; |
| 1353 | + var n=d.stargazers_count, el=document.getElementById('ghStars'); |
| 1354 | + el.textContent=n>=1000?(n/1000).toFixed(1).replace(/\.0$/,'')+'k':String(n); |
| 1355 | + el.style.display='inline-flex'; |
| 1356 | + }) |
| 1357 | + .catch(function(){}); |
1313 | 1358 | </script> |
1314 | 1359 | </body> |
1315 | 1360 | </html> |
0 commit comments