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>
|
<script>
|
||||||
/* Clipboard copy logic */
|
/* Clipboard copy logic */
|
||||||
document.querySelector('.copy-btn').addEventListener('click', async () => {
|
const copyBtn = document.querySelector('.copy-btn')
|
||||||
const keyText = document.querySelector('#public-key code').innerText.trim()
|
if (copyBtn) {
|
||||||
try {
|
copyBtn.addEventListener('click', async () => {
|
||||||
await navigator.clipboard.writeText(keyText)
|
const keyText = (
|
||||||
const btn = document.querySelector('.copy-btn')
|
document.querySelector('#public-key code') as HTMLElement
|
||||||
const original = btn.textContent
|
)?.innerText.trim()
|
||||||
btn.textContent = 'Copied!'
|
if (!keyText) return
|
||||||
setTimeout(() => {
|
try {
|
||||||
btn.textContent = original
|
await navigator.clipboard.writeText(keyText)
|
||||||
}, 2000)
|
const btn = document.querySelector('.copy-btn')
|
||||||
} catch (err) {
|
if (btn) {
|
||||||
console.error('Copy failed', err)
|
const original = btn.textContent
|
||||||
alert('Unable to copy the key. Please copy it manually.')
|
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>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue