This commit is contained in:
parent
2f7473be0a
commit
43ad7241d4
10 changed files with 111 additions and 147 deletions
|
|
@ -1,14 +1,16 @@
|
|||
export function copyLink() {
|
||||
let buttons = document.querySelectorAll('.copy-link button');
|
||||
buttons.forEach(function (button, index) {
|
||||
let link = button.parentNode.querySelector("input").value;
|
||||
let input = button.parentNode.querySelector("input");
|
||||
let link = input.value;
|
||||
|
||||
button.addEventListener('click', function() {
|
||||
navigator.clipboard.writeText(link).then(() => {
|
||||
const originalText = button.textContent;
|
||||
button.textContent = 'Lien copié';
|
||||
input.value = 'Lien copié !';
|
||||
input.classList.add('is-copied');
|
||||
setTimeout(() => {
|
||||
button.textContent = originalText;
|
||||
input.value = link;
|
||||
input.classList.remove('is-copied');
|
||||
}, 1000);
|
||||
}).catch(err => {
|
||||
console.error('Erreur lors de la copie:', err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue