Extract initCopyUrl to module, add tests for copy-url and event-map coverage
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
assets/modules/copy-url.js
Normal file
13
assets/modules/copy-url.js
Normal file
@@ -0,0 +1,13 @@
|
||||
export function initCopyUrl() {
|
||||
const btn = document.getElementById('copy-url-btn')
|
||||
if (!btn) return
|
||||
const url = document.getElementById('event-url')?.textContent?.trim()
|
||||
if (!url) return
|
||||
|
||||
btn.addEventListener('click', () => {
|
||||
globalThis.navigator.clipboard.writeText(url).then(() => {
|
||||
btn.textContent = 'Copie !'
|
||||
setTimeout(() => { btn.textContent = 'Copier le lien' }, 2000)
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user