- md5
- 528e6c374e2b7b653bf576fe251793ec
- sha1
- d926014f7f671ffcec13b7991a8f54fe475e44cd
- sha256
- 08c27a6d5bbd72c759913da453fe33155436808f4f7466edaf92cf2828bc9c3e
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
/**
* 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;
content.querySelector(clickTarget).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);
No other release has this exact content. See every version of this file.