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,52 @@
/**
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// eslint-disable no-alert
((Joomla, document) => {
if (!Joomla) {
throw new Error('core.js was not properly initialised');
}
Joomla.finderIndexer = () => {
const path = 'index.php?option=com_finder&task=indexer.debug&tmpl=component&format=json';
const token = `&${document.getElementById('finder-indexer-token').getAttribute('name')}=1`;
Joomla.debugIndexing = () => {
const formEls = new URLSearchParams(Array.from(new FormData(document.getElementById('debug-form')))).toString();
Joomla.request({
url: `${path}${token}&${formEls}`,
method: 'GET',
data: '',
perform: true,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
onSuccess: response => {
const output = document.getElementById('indexer-output');
const allowedHtml = {
fieldset: [],
legend: [],
dl: ['class'],
dt: ['class'],
dd: ['class']
};
try {
const parsed = JSON.parse(response);
output.innerHTML = Joomla.sanitizeHtml(parsed.rendered, allowedHtml);
} catch (e) {
output.innerHTML = Joomla.sanitizeHtml(response, allowedHtml);
}
},
onError: xhr => {
const output = document.getElementById('indexer-output');
output.innerHTML = xhr.response;
}
});
};
};
})(Joomla, document);
// @todo use directly the Joomla.finderIndexer() instead of the Indexer()!!!
document.addEventListener('DOMContentLoaded', () => {
window.Indexer = Joomla.finderIndexer();
});

4
media/com_finder/js/debug.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/**
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/((e,t)=>{if(!e)throw new Error("core.js was not properly initialised");e.finderIndexer=()=>{const i="index.php?option=com_finder&task=indexer.debug&tmpl=component&format=json",s=`&${t.getElementById("finder-indexer-token").getAttribute("name")}=1`;e.debugIndexing=()=>{const a=new URLSearchParams(Array.from(new FormData(t.getElementById("debug-form")))).toString();e.request({url:`${i}${s}&${a}`,method:"GET",data:"",perform:!0,headers:{"Content-Type":"application/x-www-form-urlencoded"},onSuccess:n=>{const r=t.getElementById("indexer-output"),d={fieldset:[],legend:[],dl:["class"],dt:["class"],dd:["class"]};try{const o=JSON.parse(n);r.innerHTML=e.sanitizeHtml(o.rendered,d)}catch{r.innerHTML=e.sanitizeHtml(n,d)}},onError:n=>{const r=t.getElementById("indexer-output");r.innerHTML=n.response}})}}})(Joomla,document),document.addEventListener("DOMContentLoaded",()=>{window.Indexer=Joomla.finderIndexer()});

Binary file not shown.

View File

@ -0,0 +1,23 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(Joomla => {
if (!Joomla) {
window.Joomla = {};
}
const onBoot = () => {
Joomla.submitbutton = pressbutton => {
if (pressbutton === 'filters.delete' && !window.confirm(Joomla.Text._('COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT'))) {
return false;
}
Joomla.submitform(pressbutton);
return true;
};
// Cleanup
document.addEventListener('DOMContentLoaded', onBoot);
};
document.addEventListener('DOMContentLoaded', onBoot);
})(Joomla);

4
media/com_finder/js/filters.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/(e=>{e||(window.Joomla={});const t=()=>{e.submitbutton=n=>n==="filters.delete"&&!window.confirm(e.Text._("COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT"))?!1:(e.submitform(n),!0),document.addEventListener("DOMContentLoaded",t)};document.addEventListener("DOMContentLoaded",t)})(Joomla);

Binary file not shown.

View File

@ -0,0 +1,48 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Joomla = window.Joomla || {};
(() => {
document.addEventListener('DOMContentLoaded', () => {
// Handle toggle all
document.querySelectorAll('.filter-toggle-all').forEach(button => {
button.addEventListener('click', () => document.querySelectorAll('.filter-node').forEach(node => node.click()));
});
// Update the count
document.querySelectorAll('.filter-node').forEach(() => {
const count = document.getElementById('jform_map_count');
if (count) {
count.value = document.querySelectorAll('input[type="checkbox"]:checked').length;
}
});
document.querySelectorAll('.js-filter').forEach(button => {
button.addEventListener('click', event => {
const btn = event.currentTarget;
document.querySelectorAll(`.${btn.dataset.id}`).forEach(el => el.click());
});
});
// Expand/collapse
const expandAccordion = document.getElementById('expandAccordion');
if (expandAccordion) {
expandAccordion.addEventListener('click', event => {
event.preventDefault();
let elements;
if (event.target.innerText === Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL')) {
event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_HIDE_ALL');
elements = document.querySelectorAll('.accordion-button.collapsed');
} else {
event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL');
elements = document.querySelectorAll('.accordion-button:not(.collapsed)');
}
if (elements) {
elements.forEach(element => element.click());
}
});
}
});
})();

View File

@ -0,0 +1,4 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/Joomla=window.Joomla||{},document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".filter-toggle-all").forEach(e=>{e.addEventListener("click",()=>document.querySelectorAll(".filter-node").forEach(t=>t.click()))}),document.querySelectorAll(".filter-node").forEach(()=>{const e=document.getElementById("jform_map_count");e&&(e.value=document.querySelectorAll('input[type="checkbox"]:checked').length)}),document.querySelectorAll(".js-filter").forEach(e=>{e.addEventListener("click",t=>{const o=t.currentTarget;document.querySelectorAll(`.${o.dataset.id}`).forEach(l=>l.click())})});const c=document.getElementById("expandAccordion");c&&c.addEventListener("click",e=>{e.preventDefault();let t;e.target.innerText===Joomla.Text._("COM_FINDER_FILTER_SHOW_ALL")?(e.target.innerText=Joomla.Text._("COM_FINDER_FILTER_HIDE_ALL"),t=document.querySelectorAll(".accordion-button.collapsed")):(e.target.innerText=Joomla.Text._("COM_FINDER_FILTER_SHOW_ALL"),t=document.querySelectorAll(".accordion-button:not(.collapsed)")),t&&t.forEach(o=>o.click())})});

Binary file not shown.

View File

@ -0,0 +1,88 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
((Awesomplete, Joomla, window, document) => {
if (!Joomla) {
throw new Error('core.js was not properly initialised');
}
// Handle the autocomplete
const onInputChange = ({
target
}) => {
if (target.value.length > 1) {
target.awesomplete.list = [];
Joomla.request({
url: `${Joomla.getOptions('finder-search').url}&q=${target.value}`,
promise: true
}).then(xhr => {
let response;
try {
response = JSON.parse(xhr.responseText);
} catch (e) {
// Something went wrong, but we are not going to bother the enduser with this
// eslint-disable-next-line no-console
console.error(e);
return;
}
if (Object.prototype.toString.call(response.suggestions) === '[object Array]') {
target.awesomplete.list = response.suggestions;
}
}).catch(xhr => {
// Something went wrong, but we are not going to bother the enduser with this
// eslint-disable-next-line no-console
console.error(xhr);
});
}
};
// Handle the submit
const onSubmit = event => {
event.stopPropagation();
const advanced = event.target.querySelector('.js-finder-advanced');
// Disable select boxes with no value selected.
if (advanced) {
const fields = [].slice.call(advanced.querySelectorAll('select'));
fields.forEach(field => {
if (!field.value) {
field.setAttribute('disabled', 'disabled');
}
});
}
};
// Submits the form programmatically
const submitForm = event => {
const form = event.target.closest('form');
if (form) {
form.submit();
}
};
// The boot sequence
const onBoot = () => {
document.querySelectorAll('.js-finder-search-query').forEach(searchword => {
// Handle the auto suggestion
if (Joomla.getOptions('finder-search')) {
searchword.awesomplete = new Awesomplete(searchword);
// If the current value is empty, set the previous value.
searchword.addEventListener('input', onInputChange);
const advanced = searchword.closest('form').querySelector('.js-finder-advanced');
// Do not submit the form on suggestion selection, in case of advanced form.
if (!advanced) {
searchword.addEventListener('awesomplete-selectcomplete', submitForm);
}
}
});
document.querySelectorAll('.js-finder-searchform').forEach(form => form.addEventListener('submit', onSubmit));
// Cleanup
document.removeEventListener('DOMContentLoaded', onBoot);
};
document.addEventListener('DOMContentLoaded', onBoot);
})(window.Awesomplete, window.Joomla, window, document);

4
media/com_finder/js/finder.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/((l,s,f,o)=>{if(!s)throw new Error("core.js was not properly initialised");const a=({target:e})=>{e.value.length>1&&(e.awesomplete.list=[],s.request({url:`${s.getOptions("finder-search").url}&q=${e.value}`,promise:!0}).then(t=>{let n;try{n=JSON.parse(t.responseText)}catch(r){console.error(r);return}Object.prototype.toString.call(n.suggestions)==="[object Array]"&&(e.awesomplete.list=n.suggestions)}).catch(t=>{console.error(t)}))},c=e=>{e.stopPropagation();const t=e.target.querySelector(".js-finder-advanced");t&&[].slice.call(t.querySelectorAll("select")).forEach(r=>{r.value||r.setAttribute("disabled","disabled")})},d=e=>{const t=e.target.closest("form");t&&t.submit()},i=()=>{o.querySelectorAll(".js-finder-search-query").forEach(e=>{s.getOptions("finder-search")&&(e.awesomplete=new l(e),e.addEventListener("input",a),e.closest("form").querySelector(".js-finder-advanced")||e.addEventListener("awesomplete-selectcomplete",d))}),o.querySelectorAll(".js-finder-searchform").forEach(e=>e.addEventListener("submit",c)),o.removeEventListener("DOMContentLoaded",i)};o.addEventListener("DOMContentLoaded",i)})(window.Awesomplete,window.Joomla,window,document);

Binary file not shown.

View File

@ -0,0 +1,179 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// eslint-disable no-alert
((Joomla, document) => {
if (!Joomla) {
throw new Error('core.js was not properly initialised');
}
Joomla.finderIndexer = () => {
let getRequest;
let totalItems = null;
let offset = null;
let progress = null;
let optimized = false;
const path = 'index.php?option=com_finder&tmpl=component&format=json';
const token = `&${document.getElementById('finder-indexer-token').getAttribute('name')}=1`;
const removeElement = id => {
const element = document.getElementById(id);
if (element) {
return element.parentNode.removeChild(element);
}
return null;
};
const updateProgress = (header, message) => {
progress = offset / totalItems * 100;
const progressBar = document.getElementById('progress-bar');
const progressHeader = document.getElementById('finder-progress-header');
const progressMessage = document.getElementById('finder-progress-message');
if (progressHeader) {
progressHeader.innerText = header;
}
if (progressMessage) {
progressMessage.innerHTML = Joomla.sanitizeHtml(message);
}
if (progressBar) {
if (progress < 100) {
progressBar.style.width = `${progress}%`;
progressBar.setAttribute('aria-valuenow', progress);
} else {
progressBar.classList.remove('bar-success');
progressBar.classList.add('bar-warning');
progressBar.setAttribute('aria-valuemin', 100);
progressBar.setAttribute('aria-valuemax', 200);
progressBar.style.width = `${progress}%`;
progressBar.setAttribute('aria-valuenow', progress);
}
// Auto close the window
if (message === Joomla.Text._('COM_FINDER_INDEXER_MESSAGE_COMPLETE')) {
removeElement('progress');
window.parent.location.reload();
}
}
};
const handleResponse = (json, resp) => {
const progressHeader = document.getElementById('finder-progress-header');
const progressMessage = document.getElementById('finder-progress-message');
try {
if (json === null) {
throw new Error(resp);
}
if (json.error) {
throw new Error(json);
}
if (json.start) {
// eslint-disable-next-line prefer-destructuring
totalItems = json.totalItems;
if (document.getElementById('finder-debug-data')) {
const debuglist = document.getElementById('finder-debug-data');
Object.entries(json.pluginState).forEach(context => {
let item = `<dt class="col-sm-3">${context[0]}</dt>`;
item += `<dd id="finder-${context[0].replace(/\s+/g, '-').toLowerCase()}" class="col-sm-9"></dd>`;
debuglist.insertAdjacentHTML('beforeend', Joomla.sanitizeHtml(item, {
dd: ['class', 'id'],
dt: ['class']
}));
});
}
}
offset += json.batchOffset;
updateProgress(json.header, json.message);
if (document.getElementById('finder-debug-data')) {
Object.entries(json.pluginState).forEach(context => {
document.getElementById(`finder-${context[0].replace(/\s+/g, '-').toLowerCase()}`).innerHTML = Joomla.sanitizeHtml(`${json.pluginState[context[0]].offset} of ${json.pluginState[context[0]].total}`);
});
}
if (offset < totalItems) {
getRequest('indexer.batch');
} else if (!optimized) {
optimized = true;
getRequest('indexer.optimize');
}
} catch (error) {
removeElement('progress');
try {
if (json.error) {
if (progressHeader) {
progressHeader.innerText = json.header;
progressHeader.classList.add('finder-error');
}
if (progressMessage) {
progressMessage.innerHTML = Joomla.sanitizeHtml(json.message);
progressMessage.classList.add('finder-error');
}
}
} catch (ignore) {
if (error === '') {
// eslint-disable-next-line no-ex-assign
error = Joomla.Text._('COM_FINDER_NO_ERROR_RETURNED');
}
if (progressHeader) {
progressHeader.innerText = Joomla.Text._('COM_FINDER_AN_ERROR_HAS_OCCURRED');
progressHeader.classList.add('finder-error');
}
if (progressMessage) {
progressMessage.innerHTML = Joomla.sanitizeHtml(error);
progressMessage.classList.add('finder-error');
}
}
}
return true;
};
const handleFailure = error => {
const progressHeader = document.getElementById('finder-progress-header');
const progressMessage = document.getElementById('finder-progress-message');
let data;
if (error instanceof Error) {
// Encode any html in the message
const div = document.createElement('div');
div.textContent = error.message;
data = div.innerHTML;
if (error instanceof SyntaxError) {
data = Joomla.Text._('JLIB_JS_AJAX_ERROR_PARSE').replace('%s', data);
}
} else if (typeof error === 'object' && error.responseText) {
data = error.responseText;
try {
data = JSON.parse(data);
} catch (e) {
data = Joomla.Text._('JLIB_JS_AJAX_ERROR_OTHER').replace('%s', error.status);
}
}
removeElement('progress');
const header = data && data.header ? data.header : Joomla.Text._('COM_FINDER_AN_ERROR_HAS_OCCURRED');
const message = data && data.message ? data.message : `${Joomla.Text._('COM_FINDER_MESSAGE_RETURNED')}<br>${data}`;
if (progressHeader) {
progressHeader.innerText = header;
progressHeader.classList.add('finder-error');
}
if (progressMessage) {
progressMessage.innerHTML = Joomla.sanitizeHtml(message);
progressMessage.classList.add('finder-error');
}
};
getRequest = task => {
Joomla.request({
url: `${path}&task=${task}${token}`,
promise: true
}).then(xhr => {
handleResponse(JSON.parse(xhr.responseText));
}).catch(error => {
handleFailure(error);
});
};
const initialize = () => {
offset = 0;
progress = 0;
getRequest('indexer.start');
};
initialize();
};
})(Joomla, document);
// @todo use directly the Joomla.finderIndexer() instead of the Indexer()!!!
document.addEventListener('DOMContentLoaded', () => {
window.Indexer = Joomla.finderIndexer();
});

4
media/com_finder/js/indexer.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/((s,n)=>{if(!s)throw new Error("core.js was not properly initialised");s.finderIndexer=()=>{let g,c=null,E=null,d=null,p=!1;const _="index.php?option=com_finder&tmpl=component&format=json",R=`&${n.getElementById("finder-indexer-token").getAttribute("name")}=1`,o=e=>{const i=n.getElementById(e);return i?i.parentNode.removeChild(i):null},h=(e,i)=>{d=E/c*100;const r=n.getElementById("progress-bar"),t=n.getElementById("finder-progress-header"),a=n.getElementById("finder-progress-message");t&&(t.innerText=e),a&&(a.innerHTML=s.sanitizeHtml(i)),r&&(d<100?(r.style.width=`${d}%`,r.setAttribute("aria-valuenow",d)):(r.classList.remove("bar-success"),r.classList.add("bar-warning"),r.setAttribute("aria-valuemin",100),r.setAttribute("aria-valuemax",200),r.style.width=`${d}%`,r.setAttribute("aria-valuenow",d)),i===s.Text._("COM_FINDER_INDEXER_MESSAGE_COMPLETE")&&(o("progress"),window.parent.location.reload()))},I=(e,i)=>{const r=n.getElementById("finder-progress-header"),t=n.getElementById("finder-progress-message");try{if(e===null)throw new Error(i);if(e.error)throw new Error(e);if(e.start&&(c=e.totalItems,n.getElementById("finder-debug-data"))){const a=n.getElementById("finder-debug-data");Object.entries(e.pluginState).forEach(f=>{let l=`<dt class="col-sm-3">${f[0]}</dt>`;l+=`<dd id="finder-${f[0].replace(/\s+/g,"-").toLowerCase()}" class="col-sm-9"></dd>`,a.insertAdjacentHTML("beforeend",s.sanitizeHtml(l,{dd:["class","id"],dt:["class"]}))})}E+=e.batchOffset,h(e.header,e.message),n.getElementById("finder-debug-data")&&Object.entries(e.pluginState).forEach(a=>{n.getElementById(`finder-${a[0].replace(/\s+/g,"-").toLowerCase()}`).innerHTML=s.sanitizeHtml(`${e.pluginState[a[0]].offset} of ${e.pluginState[a[0]].total}`)}),E<c?g("indexer.batch"):p||(p=!0,g("indexer.optimize"))}catch(a){o("progress");try{e.error&&(r&&(r.innerText=e.header,r.classList.add("finder-error")),t&&(t.innerHTML=s.sanitizeHtml(e.message),t.classList.add("finder-error")))}catch{a===""&&(a=s.Text._("COM_FINDER_NO_ERROR_RETURNED")),r&&(r.innerText=s.Text._("COM_FINDER_AN_ERROR_HAS_OCCURRED"),r.classList.add("finder-error")),t&&(t.innerHTML=s.sanitizeHtml(a),t.classList.add("finder-error"))}}return!0},T=e=>{const i=n.getElementById("finder-progress-header"),r=n.getElementById("finder-progress-message");let t;if(e instanceof Error){const l=n.createElement("div");l.textContent=e.message,t=l.innerHTML,e instanceof SyntaxError&&(t=s.Text._("JLIB_JS_AJAX_ERROR_PARSE").replace("%s",t))}else if(typeof e=="object"&&e.responseText){t=e.responseText;try{t=JSON.parse(t)}catch{t=s.Text._("JLIB_JS_AJAX_ERROR_OTHER").replace("%s",e.status)}}o("progress");const a=t&&t.header?t.header:s.Text._("COM_FINDER_AN_ERROR_HAS_OCCURRED"),f=t&&t.message?t.message:`${s.Text._("COM_FINDER_MESSAGE_RETURNED")}<br>${t}`;i&&(i.innerText=a,i.classList.add("finder-error")),r&&(r.innerHTML=s.sanitizeHtml(f),r.classList.add("finder-error"))};g=e=>{s.request({url:`${_}&task=${e}${R}`,promise:!0}).then(i=>{I(JSON.parse(i.responseText))}).catch(i=>{T(i)})},(()=>{E=0,d=0,g("indexer.start")})()}})(Joomla,document),document.addEventListener("DOMContentLoaded",()=>{window.Indexer=Joomla.finderIndexer()});

Binary file not shown.

View File

@ -0,0 +1,19 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Joomla = window.Joomla || {};
(() => {
document.addEventListener('DOMContentLoaded', () => {
Joomla.submitbutton = pressbutton => {
// @todo replace with joomla-alert
if (pressbutton === 'map.delete' && !window.confirm(Joomla.Text._('COM_FINDER_MAPS_CONFIRM_DELETE_PROMPT'))) {
return false;
}
Joomla.submitform(pressbutton);
return true;
};
});
})();

4
media/com_finder/js/maps.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/Joomla=window.Joomla||{},document.addEventListener("DOMContentLoaded",()=>{Joomla.submitbutton=o=>o==="map.delete"&&!window.confirm(Joomla.Text._("COM_FINDER_MAPS_CONFIRM_DELETE_PROMPT"))?!1:(Joomla.submitform(o),!0)});

Binary file not shown.