refactor: trying copilot edits
This commit is contained in:
parent
fd1d015a18
commit
e77351e5dd
1 changed files with 23 additions and 15 deletions
|
|
@ -49,21 +49,29 @@ AP0YLC768PFTBm9CM5T1BE0xjJ7s4dZSrVoI4n8RSe1nCA==
|
|||
|
||||
<script>
|
||||
/* Clipboard copy logic */
|
||||
document.querySelector('.copy-btn').addEventListener('click', async () => {
|
||||
const keyText = document.querySelector('#public-key code').innerText.trim()
|
||||
try {
|
||||
await navigator.clipboard.writeText(keyText)
|
||||
const btn = document.querySelector('.copy-btn')
|
||||
const original = btn.textContent
|
||||
btn.textContent = 'Copied!'
|
||||
setTimeout(() => {
|
||||
btn.textContent = original
|
||||
}, 2000)
|
||||
} catch (err) {
|
||||
console.error('Copy failed', err)
|
||||
alert('Unable to copy the key. Please copy it manually.')
|
||||
}
|
||||
})
|
||||
const copyBtn = document.querySelector('.copy-btn')
|
||||
if (copyBtn) {
|
||||
copyBtn.addEventListener('click', async () => {
|
||||
const keyText = (
|
||||
document.querySelector('#public-key code') as HTMLElement
|
||||
)?.innerText.trim()
|
||||
if (!keyText) return
|
||||
try {
|
||||
await navigator.clipboard.writeText(keyText)
|
||||
const btn = document.querySelector('.copy-btn')
|
||||
if (btn) {
|
||||
const original = btn.textContent
|
||||
btn.textContent = 'Copied!'
|
||||
setTimeout(() => {
|
||||
btn.textContent = original
|
||||
}, 2000)
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Copy failed', err)
|
||||
alert('Unable to copy the key. Please copy it manually.')
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
Loading…
Reference in a new issue