Skip to content

Commit 26e66ec

Browse files
Copilotckrause
andcommitted
Auto-copy PARI code to clipboard when clicking Try it out
Co-authored-by: ckrause <840744+ckrause@users.noreply.github.com>
1 parent 7202932 commit 26e66ec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

programs.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,14 @@ <h1 class="post-title">Integer Sequences and LODA Programs</h1>
456456
pariTryButton.href = 'https://pari.math.u-bordeaux.fr/gp.html';
457457
pariTryButton.target = '_blank';
458458
pariTryButton.textContent = 'Try it out';
459+
pariTryButton.onclick = async (e) => {
460+
// Copy code to clipboard before opening PARI page
461+
try {
462+
await navigator.clipboard.writeText(pariCode);
463+
} catch (error) {
464+
console.error('Failed to copy PARI code:', error);
465+
}
466+
};
459467
pariButtonsContainer.appendChild(pariTryButton);
460468

461469
const pariCopyButton = document.createElement('button');

0 commit comments

Comments
 (0)