primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 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,5 @@
/**
* @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||{},((r,e)=>{const i={input:["type","name","value"],"joomla-alert":["type","dismiss","role"],button:["type"],table:[],tbody:[],thead:[],caption:[],th:["scope"],tr:[],td:[]},c=a=>{const o=e.getElementById("system-message-container"),s=o.querySelector(".js-pstats-alert"),n=o.querySelector("#js-pstats-data-details");e.addEventListener("click",t=>{t.target.classList.contains("js-pstats-btn-details")&&(t.preventDefault(),n.classList.toggle("d-none"))}),e.addEventListener("click",t=>{t.target.classList.contains("js-pstats-btn-allow-always")&&(t.preventDefault(),s.close(),a({plugin:"sendAlways"}))}),e.addEventListener("click",t=>{t.target.classList.contains("js-pstats-btn-allow-never")&&(t.preventDefault(),s.close(),a({plugin:"sendNever"}))})},l=({plugin:a="sendStats"}={})=>{const o=`index.php?option=com_ajax&group=system&plugin=${a}&format=raw`,s=e.getElementById("system-message-container");r.request({url:o,headers:{"Content-Type":"application/json"},onSuccess:n=>{try{const t=JSON.parse(n);t&&t.html&&(s.insertAdjacentHTML("beforeend",r.sanitizeHtml(t.html,i)),s.querySelector(".js-pstats-alert").classList.remove("hidden"),c(l))}catch(t){throw new Error(t)}},onError:n=>{r.renderMessages({error:[n.response]})}})};e.addEventListener("DOMContentLoaded",()=>{l()})})(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,5 @@
/**
* @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
*/(t=>{const a="js-pstats-data-details-toggler",o="js-pstats-data-details",l="js-pstats-reset-uid",d="jform_params_unique_id",i=e=>{e.preventDefault();const s=t.getElementById(o);s&&s.classList.toggle("d-none")},g=e=>{e.preventDefault(),t.getElementById(d).value="",Joomla.submitbutton("plugin.apply")},n=()=>{const e=t.getElementById(a);e&&e.addEventListener("click",i);const s=t.getElementById(l);s&&s.addEventListener("click",g),t.removeEventListener("DOMContentLoaded",n)};t.addEventListener("DOMContentLoaded",n)})(document,Joomla);

Binary file not shown.