Sha256: 2ec3bd3e89af41087d9c4c5eed968be5f60bd554ca2f7a311d0633e953256329
Contents?: true
Size: 660 Bytes
Versions: 80
Compression:
Stored size: 660 Bytes
Contents
import Clipboard from 'clipboard'; export default () => { document.querySelectorAll('.code-toolbar button').forEach(function(button) { button.addEventListener('click', createRequest, { once: true }) }); }; function createRequest(event) { let dataset = event.target.closest('.code-toolbar').firstChild.dataset; let params = { "language": dataset.lang, "snippet": dataset.block, "section": dataset.section, "event": "copy" }; fetch(new Request('/usage/code_snippet', { method: 'POST', credentials: 'same-origin', body: JSON.stringify(params), headers: { 'Content-Type': 'application/json' } })); }
Version data entries
80 entries across 80 versions & 1 rubygems