Preview:
copyButtons = document.querySelectorAll('.copy-button')
    img = document.createElement('img')
    img.src = '/loading.svg'
    img.style.filter = 'invert(45%) sepia(99%) saturate(2815%) hue-rotate(179deg) brightness(97%) contrast(103%)'
    for(button of copyButtons) {
        button.addEventListener('click', async (event) => {
            clickedButton = event.target
            resultId = clickedButton.id.split('-')[1]

            // select button icon and remove it
            let buttonNode = document.querySelector(`#copyButton-${resultId}`)
            let icon = buttonNode.children[0]
            icon.classList.remove('icon-copy')
            buttonNode.insertBefore(img, buttonNode.firstChild)

            // Get the text field
            let copyText = document.getElementById(`urlInput-${resultId}`);
            // Select the text field
            copyText.select();
            copyText.setSelectionRange(0, 99999); // For mobile devices

            // Copy the text inside the text field
            navigator.clipboard.writeText(await shortenUrl(copyText, 1));
            buttonNode.removeChild(buttonNode.children[0])
            icon.classList.add('icon-copy')
        })
    }
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter