- md5
- d13b33f8298cccc1433465686ea63b52
- sha1
- a93ffcc088a9e9d72e60192c939bbc355bc3908f
- sha256
- 19c5b4b6297208d61faa5439d7ae8515350699a7a7cf4aeeec0383f99b49bad4
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
/**
* 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
* @since 3.5.0
*/
Joomla = window.Joomla || {};
((Joomla, document) => {
'use strict';
const initStatsEvents = callback => {
const messageContainer = document.getElementById('system-message-container');
const joomlaAlert = messageContainer.querySelector('.js-pstats-alert');
const detailsContainer = messageContainer.querySelector('#js-pstats-data-details'); // Show details about the information being sent
document.addEventListener('click', event => {
if (event.target.classList.contains('js-pstats-btn-details')) {
event.preventDefault();
detailsContainer.classList.toggle('d-none');
}
}); // Always allow
document.addEventListener('click', event => {
if (event.target.classList.contains('js-pstats-btn-allow-always')) {
event.preventDefault(); // Remove message
joomlaAlert.close();
callback({
plugin: 'sendAlways'
});
}
}); // Allow once
document.addEventListener('click', event => {
if (event.target.classList.contains('js-pstats-btn-allow-once')) {
event.preventDefault(); // Remove message
joomlaAlert.close();
callback({
plugin: 'sendOnce'
});
}
}); // Never allow
document.addEventListener('click', event => {
if (event.target.classList.contains('js-pstats-btn-allow-never')) {
event.preventDefault(); // Remove message
joomlaAlert.close();
callback({
plugin: 'sendNever'
});
}
});
};
const getJson = ({
plugin = 'sendStats'
} = {}) => {
const url = `index.php?option=com_ajax&group=system&plugin=${plugin}&format=raw`;
const messageContainer = document.getElementById('system-message-container');
Joomla.request({
url,
headers: {
'Content-Type': 'application/json'
},
onSuccess: response => {
try {
const json = JSON.parse(response);
if (json && json.html) {
messageContainer.innerHTML = json.html;
messageContainer.querySelector('.js-pstats-alert').classList.remove('hidden');
initStatsEvents(getJson);
}
} catch (e) {
throw new Error(e);
}
},
onError: xhr => {
Joomla.renderMessages({
error: [xhr.response]
});
}
});
};
document.addEventListener('DOMContentLoaded', () => {
getJson();
});
})(Joomla, document);
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.