[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 /** 2 * @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org> 3 * @license GNU General Public License version 2 or later; see LICENSE.txt 4 */ 5 (document => { 6 7 document.addEventListener('DOMContentLoaded', () => { 8 window.jSelectModuleType = () => { 9 const elements = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn.hidden'); 10 11 if (elements.length) { 12 setTimeout(() => { 13 elements.forEach(button => { 14 button.classList.remove('hidden'); 15 }); 16 }, 1000); 17 } 18 }; 19 20 const buttons = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn'); 21 const hideButtons = []; 22 let isSaving = false; 23 24 if (buttons.length) { 25 buttons.forEach(button => { 26 if (button.classList.contains('hidden')) { 27 hideButtons.push(button); 28 } 29 30 button.addEventListener('click', event => { 31 let elem = event.currentTarget; // There is some bug with events in iframe where currentTarget is "null" 32 // => prevent this here by bubble up 33 34 if (!elem) { 35 elem = event.target; 36 } 37 38 if (elem) { 39 const clickTarget = elem.dataset.bsTarget; // We remember to be in the saving process 40 41 isSaving = clickTarget === '#saveBtn'; // Reset saving process, if e.g. the validation of the form fails 42 43 setTimeout(() => { 44 isSaving = false; 45 }, 1500); 46 const iframe = document.querySelector('#moduleDashboardAddModal iframe'); 47 const content = iframe.contentDocument || iframe.contentWindow.document; 48 const targetBtn = content.querySelector(clickTarget); 49 50 if (targetBtn) { 51 targetBtn.click(); 52 } 53 } 54 }); 55 }); 56 } 57 58 const elementH = document.querySelector('#moduleDashboardAddModal'); 59 60 if (elementH) { 61 elementH.addEventListener('hide.bs.modal', () => { 62 hideButtons.forEach(button => { 63 button.classList.add('hidden'); 64 }); 65 }); 66 elementH.addEventListener('hidden.bs.modal', () => { 67 if (isSaving) { 68 setTimeout(() => { 69 window.parent.location.reload(); 70 }, 1000); 71 } 72 }); 73 } 74 }); 75 })(document);
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 |