|
217 | 217 | .site-footer { |
218 | 218 | border-top: 1px solid #d0d7de; |
219 | 219 | background: #f6f8fa; |
220 | | - padding: 1.2rem 2rem; |
| 220 | + padding: 1.4rem 2rem; |
221 | 221 | font-size: 0.8rem; |
222 | 222 | color: #57606a; |
| 223 | + text-align: center; |
223 | 224 | } |
224 | 225 | .site-footer-owner a, |
225 | 226 | .site-footer-credits a { color: #0969da; } |
| 227 | + .site-footer-credits { display: block; margin-top: 0.2rem; } |
| 228 | + |
| 229 | + /* ── Copy button ── */ |
| 230 | + .code-block-wrap { |
| 231 | + position: relative; |
| 232 | + } |
| 233 | + .copy-btn { |
| 234 | + position: absolute; |
| 235 | + top: 8px; |
| 236 | + right: 8px; |
| 237 | + background: #e6edf3; |
| 238 | + border: 1px solid #d0d7de; |
| 239 | + border-radius: 5px; |
| 240 | + padding: 3px 9px; |
| 241 | + font-size: 11px; |
| 242 | + font-family: "SFMono-Regular", Consolas, monospace; |
| 243 | + color: #57606a; |
| 244 | + cursor: pointer; |
| 245 | + opacity: 0; |
| 246 | + transition: opacity 0.15s, background 0.15s; |
| 247 | + line-height: 1.6; |
| 248 | + user-select: none; |
| 249 | + } |
| 250 | + .code-block-wrap:hover .copy-btn { opacity: 1; } |
| 251 | + .copy-btn.copied { |
| 252 | + background: #dafbe1; |
| 253 | + border-color: #2ea043; |
| 254 | + color: #116329; |
| 255 | + opacity: 1; |
| 256 | + } |
226 | 257 |
|
227 | 258 | /* ── Screenshot ── */ |
228 | 259 | .screenshot-wrap { |
|
287 | 318 | <footer class="site-footer"> |
288 | 319 | <span class="site-footer-owner"> |
289 | 320 | <a href="https://github.com/TMHSDigital/subenum">subenum</a> is maintained by |
290 | | - <a href="https://github.com/TMHSDigital">TMHSDigital</a>. |
| 321 | + <a href="https://github.com/TMHSDigital">TMHSDigital</a> |
291 | 322 | </span> |
292 | 323 | <span class="site-footer-credits"> |
293 | | - · |
294 | 324 | <a href="{{ '/CONTRIBUTING.html' | relative_url }}">Contributing</a> |
295 | 325 | · |
296 | 326 | <a href="https://github.com/TMHSDigital/subenum/blob/main/SECURITY.md">Security</a> |
|
300 | 330 | </footer> |
301 | 331 | </main> |
302 | 332 |
|
| 333 | + <script> |
| 334 | + // Click-to-copy for all code blocks |
| 335 | + document.querySelectorAll('pre').forEach(function(pre) { |
| 336 | + var wrap = document.createElement('div'); |
| 337 | + wrap.className = 'code-block-wrap'; |
| 338 | + pre.parentNode.insertBefore(wrap, pre); |
| 339 | + wrap.appendChild(pre); |
| 340 | + |
| 341 | + var btn = document.createElement('button'); |
| 342 | + btn.className = 'copy-btn'; |
| 343 | + btn.textContent = 'copy'; |
| 344 | + wrap.appendChild(btn); |
| 345 | + |
| 346 | + btn.addEventListener('click', function() { |
| 347 | + var code = pre.querySelector('code'); |
| 348 | + var text = code ? code.innerText : pre.innerText; |
| 349 | + navigator.clipboard.writeText(text).then(function() { |
| 350 | + btn.textContent = 'copied!'; |
| 351 | + btn.classList.add('copied'); |
| 352 | + setTimeout(function() { |
| 353 | + btn.textContent = 'copy'; |
| 354 | + btn.classList.remove('copied'); |
| 355 | + }, 2000); |
| 356 | + }); |
| 357 | + }); |
| 358 | + }); |
| 359 | + </script> |
303 | 360 | </body> |
304 | 361 | </html> |
0 commit comments