PluginProbe
ElasticPress / 4.6.0
ElasticPress v4.6.0
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / assets / js / status-report / index.js

index.js in ElasticPress 4.6.0, at assets/js/status-report/index.js

52 lines 960 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global ClipboardJS */
2
3 /**
4 * WordPress dependencies.
5 */
6 import domReady from '@wordpress/dom-ready';
7 import { render } from '@wordpress/element';
8
9 /**
10 * Internal dependencies.
11 */
12 import { reports } from './config';
13 import Reports from './components/reports';
14
15 /**
16 * Status report copy button.
17 *
18 * @returns {void}
19 */
20 const init = () => {
21 const report = document.getElementById('ep-status-reports');
22 const clipboard = new ClipboardJS('#ep-copy-report');
23
24 /**
25 * Handle successful copy.
26 *
27 * @param {Event} event Copy event.
28 * @returns {void}
29 */
30 const onSuccess = (event) => {
31 event.trigger.nextElementSibling.style.display = 'initial';
32
33 setTimeout(() => {
34 event.trigger.nextElementSibling.style.display = 'none';
35 }, 3000);
36
37 event.clearSelection();
38 };
39
40 /**
41 * Bind copy button events.
42 */
43 clipboard.on('success', onSuccess);
44
45 /**
46 * Render reports.
47 */
48 render(<Reports reports={reports} />, report);
49 };
50
51 domReady(init);
52