- md5
- 8983daa72fb30a902c8de98c8bf800af
- sha1
- 2e196fd2d44160ea1f7a89ad025ad48aed3f059c
- sha256
- 277bbf71e22d38bbe781b6c24df93ad245b4765d0f18f9e9b2352c7cdee466ec
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
/**
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION.
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD.
**/
/**
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Joomla = window.Joomla || {};
(document => {
'use strict';
document.addEventListener('DOMContentLoaded', () => {
window.jSelectModuleType = () => {
const elements = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn.hidden');
if (elements.length) {
setTimeout(() => {
elements.forEach(button => {
button.classList.remove('hidden');
});
}, 1000);
}
};
const buttons = document.querySelectorAll('#moduleDashboardAddModal .modal-footer .btn');
const hideButtons = [];
let isSaving = false;
if (buttons.length) {
buttons.forEach(button => {
if (button.classList.contains('hidden')) {
hideButtons.push(button);
}
button.addEventListener('click', event => {
let elem = event.currentTarget; // There is some bug with events in iframe where currentTarget is "null"
// => prevent this here by bubble up
if (!elem) {
elem = event.target;
}
if (elem) {
const clickTarget = elem.getAttribute('data-target'); // We remember to be in the saving process
isSaving = clickTarget === '#saveBtn'; // Reset saving process, if e.g. the validation of the form fails
setTimeout(() => {
isSaving = false;
}, 1500);
const iframe = document.querySelector('#moduleDashboardAddModal iframe');
const content = iframe.contentDocument || iframe.contentWindow.document;
const targetBtn = content.querySelector(clickTarget);
if (targetBtn) {
targetBtn.click();
}
}
});
});
} // @TODO remove jQuery dependency, when the modal is not bootstrap anymore
/* global jQuery */
jQuery('#moduleDashboardAddModal').on('hide.bs.modal', () => {
hideButtons.forEach(button => {
button.classList.add('hidden');
});
});
jQuery('#moduleDashboardAddModal').on('hidden.bs.modal', () => {
if (isSaving) {
setTimeout(() => {
window.parent.location.reload();
}, 1000);
}
});
});
})(document);
The same content is in 4 releases, Joomla 4.0.0-beta2 to 4.0.0-beta5. See them all, or every version of this file.