first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,93 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @since 3.5.0
*/
Joomla = window.Joomla || {};
((Joomla, document) => {
const allowed = {
input: ['type', 'name', 'value'],
'joomla-alert': ['type', 'dismiss', 'role'],
button: ['type'],
table: [],
tbody: [],
thead: [],
caption: [],
th: ['scope'],
tr: [],
td: []
};
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'
});
}
});
// 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: _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.insertAdjacentHTML('beforeend', Joomla.sanitizeHtml(json.html, allowed));
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);

View File

@ -0,0 +1 @@
Joomla=window.Joomla||{},((e,t)=>{const s={input:["type","name","value"],"joomla-alert":["type","dismiss","role"],button:["type"],table:[],tbody:[],thead:[],caption:[],th:["scope"],tr:[],td:[]},n=({plugin:a="sendStats"}={})=>{const o=`index.php?option=com_ajax&group=system&plugin=${a}&format=raw`,r=t.getElementById("system-message-container");e.request({url:o,headers:{"Content-Type":"application/json"},onSuccess:a=>{try{const o=JSON.parse(a);o&&o.html&&(r.insertAdjacentHTML("beforeend",e.sanitizeHtml(o.html,s)),r.querySelector(".js-pstats-alert").classList.remove("hidden"),(e=>{const s=t.getElementById("system-message-container"),n=s.querySelector(".js-pstats-alert"),a=s.querySelector("#js-pstats-data-details");t.addEventListener("click",(e=>{e.target.classList.contains("js-pstats-btn-details")&&(e.preventDefault(),a.classList.toggle("d-none"))})),t.addEventListener("click",(t=>{t.target.classList.contains("js-pstats-btn-allow-always")&&(t.preventDefault(),n.close(),e({plugin:"sendAlways"}))})),t.addEventListener("click",(t=>{t.target.classList.contains("js-pstats-btn-allow-never")&&(t.preventDefault(),n.close(),e({plugin:"sendNever"}))}))})(n))}catch(e){throw new Error(e)}},onError:t=>{e.renderMessages({error:[t.response]})}})};t.addEventListener("DOMContentLoaded",(()=>{n()}))})(Joomla,document);

Binary file not shown.

View File

@ -0,0 +1,42 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @since 3.5.0
*/
(document => {
// Selectors used by this script
const statsDataTogglerId = 'js-pstats-data-details-toggler';
const statsDataDetailsId = 'js-pstats-data-details';
const resetId = 'js-pstats-reset-uid';
const uniqueIdFieldId = 'jform_params_unique_id';
const onToggle = event => {
event.preventDefault();
const element = document.getElementById(statsDataDetailsId);
if (element) {
element.classList.toggle('d-none');
}
};
const onReset = event => {
event.preventDefault();
document.getElementById(uniqueIdFieldId).value = '';
Joomla.submitbutton('plugin.apply');
};
const onBoot = () => {
// Toggle stats details
const toggler = document.getElementById(statsDataTogglerId);
if (toggler) {
toggler.addEventListener('click', onToggle);
}
// Reset the unique id
const reset = document.getElementById(resetId);
if (reset) {
reset.addEventListener('click', onReset);
}
// Cleanup
document.removeEventListener('DOMContentLoaded', onBoot);
};
document.addEventListener('DOMContentLoaded', onBoot);
})(document, Joomla);

View File

@ -0,0 +1 @@
(e=>{const t=t=>{t.preventDefault();const n=e.getElementById("js-pstats-data-details");n&&n.classList.toggle("d-none")},n=t=>{t.preventDefault(),e.getElementById("jform_params_unique_id").value="",Joomla.submitbutton("plugin.apply")},s=()=>{const a=e.getElementById("js-pstats-data-details-toggler");a&&a.addEventListener("click",t);const d=e.getElementById("js-pstats-reset-uid");d&&d.addEventListener("click",n),e.removeEventListener("DOMContentLoaded",s)};e.addEventListener("DOMContentLoaded",s)})(document,Joomla);

Binary file not shown.