Sha256: 19114d0b8bfc9fe40bc69a2e206826596b493d2e8ef5f771914788f0a215bb2d
Contents?: true
Size: 682 Bytes
Versions: 2
Compression:
Stored size: 682 Bytes
Contents
import '@github/clipboard-copy-element'; function toggleSVG(svg) { if (svg.style.display === '' || svg.style.display === 'block') { svg.style.display = 'none'; } else { svg.style.display = 'block'; } } // Toggle a copy button. function toggleCopyButton(button) { const [clippyIcon, checkIcon] = button.querySelectorAll('.octicon'); if (!clippyIcon || !checkIcon) return; toggleSVG(clippyIcon); toggleSVG(checkIcon); } document.addEventListener('clipboard-copy', function ({ target }) { if (!(target instanceof HTMLElement)) return; toggleCopyButton(target); setTimeout(toggleCopyButton, 2000, target); });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
primer_view_components-0.0.40 | app/components/primer/clipboard_copy_component.js |
primer_view_components-0.0.39 | app/components/primer/clipboard_copy_component.js |