[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 /** 2 * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> 3 * @license GNU General Public License version 2 or later; see LICENSE.txt 4 */ 5 if (!window.Joomla) { 6 throw new Error('Joomla API was not properly initialised!'); 7 } 8 9 const copyToClipboardFallback = input => { 10 input.focus(); 11 input.select(); 12 13 try { 14 const copy = document.execCommand('copy'); 15 16 if (copy) { 17 Joomla.renderMessages({ 18 message: [Joomla.Text._('COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_SUCCESS')] 19 }); 20 } else { 21 Joomla.renderMessages({ 22 error: [Joomla.Text._('COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_FAIL')] 23 }); 24 } 25 } catch (err) { 26 Joomla.renderMessages({ 27 error: [err] 28 }); 29 } 30 }; 31 32 const copyToClipboard = () => { 33 const button = document.getElementById('link-copy'); 34 button.addEventListener('click', ({ 35 currentTarget 36 }) => { 37 const input = currentTarget.previousElementSibling; 38 39 if (!navigator.clipboard) { 40 copyToClipboardFallback(input); 41 return; 42 } 43 44 navigator.clipboard.writeText(input.value).then(() => { 45 Joomla.renderMessages({ 46 message: [Joomla.Text._('COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_SUCCESS')] 47 }); 48 }, () => { 49 Joomla.renderMessages({ 50 error: [Joomla.Text._('COM_SCHEDULER_CONFIG_WEBCRON_LINK_COPY_FAIL')] 51 }); 52 }); 53 }); 54 }; 55 56 const onBoot = () => { 57 copyToClipboard(); 58 document.removeEventListener('DOMContentLoaded', onBoot); 59 }; 60 61 document.addEventListener('DOMContentLoaded', onBoot);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |