document.addEventListener('DOMContentLoaded', function() { var copyButton = document.querySelector('.copy-premiumone'); var text = 'PREMIUMONE'; function fallbackCopy(t) { var textarea = document.createElement('textarea'); textarea.value = t; textarea.setAttribute('readonly', ''); textarea.style.position = 'absolute'; textarea.style.left = '-9999px'; document.body.appendChild(textarea); textarea.select(); document.execCommand('copy'); document.body.removeChild(textarea); } function showCopied() { if (copyButton.className.indexOf('copied') === -1) { copyButton.className += ' copied'; } setTimeout(function() { copyButton.className = copyButton.className.replace(' copied', ''); }, 1500); } if (copyButton) { copyButton.addEventListener('click', function() { if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(text).then(function() { showCopied(); }, function() { fallbackCopy(text); showCopied(); }); } else { fallbackCopy(text); showCopied(); } }); } });