Sha256: dee85aa3c8aac264719895bcfccab321c287cd780d3f71c3c858f8b0229275b0

Contents?: true

Size: 694 Bytes

Versions: 1

Compression:

Stored size: 694 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) {
        toggleSVG(clippyIcon);
    }
    if (checkIcon) {
        toggleSVG(checkIcon);
    }
}
document.addEventListener('clipboard-copy', function ({ target }) {
    if (!(target instanceof HTMLElement))
        return;
    toggleCopyButton(target);
    setTimeout(toggleCopyButton, 2000, target);
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
primer_view_components-0.0.38 app/components/primer/clipboard_copy_component.js