(function () { 'use strict'; var bar = document.getElementById('share-bar'); if (!bar) { return; } var url = bar.getAttribute('data-url') || window.location.href; var title = bar.getAttribute('data-title') || document.title; var copyBtn = document.getElementById('share-copy'); if (copyBtn) { copyBtn.addEventListener('click', function () { if (!navigator.clipboard) { var ta = document.createElement('textarea'); ta.value = url; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta); copyBtn.textContent = 'CopiƩ !'; setTimeout(function () { copyBtn.textContent = 'Copier le lien'; }, 2000); return; } navigator.clipboard.writeText(url).then(function () { copyBtn.textContent = 'CopiƩ !'; setTimeout(function () { copyBtn.textContent = 'Copier le lien'; }, 2000); }); }); } var nativeBtn = document.getElementById('share-native'); if (nativeBtn) { if (navigator.share) { nativeBtn.hidden = false; nativeBtn.addEventListener('click', function () { navigator.share({ title: title, url: url }).catch(function () {}); }); } } }());