[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 /** 2 * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> 3 * @license GNU General Public License version 2 or later; see LICENSE.txt 4 */ 5 ((document, submitForm) => { 6 7 const buttonDataSelector = 'data-submit-task'; 8 /** 9 * Submit the task 10 * @param task 11 * @param form 12 */ 13 14 const submitTask = (task, form) => { 15 if (task === 'templates.cancel' || document.formvalidator.isValid(form)) { 16 submitForm(task, form); 17 } 18 }; 19 /** 20 * Register events 21 */ 22 23 24 const registerEvents = () => { 25 const buttons = [].slice.call(document.querySelectorAll(`[$buttonDataSelector}]`)); 26 buttons.forEach(button => { 27 button.addEventListener('click', e => { 28 e.preventDefault(); 29 const task = e.currentTarget.getAttribute(buttonDataSelector); 30 submitTask(task, e.currentTarget.form); 31 }); 32 }); 33 }; 34 35 document.addEventListener('DOMContentLoaded', () => { 36 registerEvents(); 37 }); 38 })(document, Joomla.submitform);
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 |