PluginProbe
Booking Calendar / 11.1
Booking Calendar v11.1
11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 10.11.3 All 202 releases
booking / includes / page-form-builder / _src / support_functions.js

support_functions.js in Booking Calendar 11.1, at includes/page-form-builder/_src/support_functions.js

39 lines 946 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Help Fucntions.
3 * @file: ../includes/page-form-builder/_out/bfb_support_func.js
4 */
5
6 /**
7 * Clipboard (UI-only helper)
8 *
9 * @param text
10 * @returns {Promise<boolean>}
11 */
12 async function wpbc_copy_to_clipboard(text) {
13 try {
14 if ( window.isSecureContext && navigator.clipboard && navigator.clipboard.writeText ) {
15 await navigator.clipboard.writeText( String( text || '' ) );
16 return true;
17 }
18 } catch ( e ) {
19 window._wpbc?.dev?.error?.( 'wpbc_copy_to_clipboard', e );
20 }
21
22 try {
23 const ta = document.createElement( 'textarea' );
24 ta.value = String( text || '' );
25 ta.setAttribute( 'readonly', '' );
26 ta.style.position = 'fixed';
27 ta.style.top = '-9999px';
28 ta.style.opacity = '0';
29 document.body.appendChild( ta );
30 ta.focus();
31 ta.select();
32 const ok = document.execCommand( 'copy' );
33 document.body.removeChild( ta );
34 return !! ok;
35 } catch ( _ ) {
36 return false;
37 }
38 }
39