first commit
This commit is contained in:
45
media/com_finder/js/debug.js
Normal file
45
media/com_finder/js/debug.js
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @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');
|
||||
try {
|
||||
const parsed = JSON.parse(response);
|
||||
output.innerHTML = parsed.rendered;
|
||||
} catch (e) {
|
||||
output.innerHTML = response;
|
||||
}
|
||||
},
|
||||
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();
|
||||
});
|
||||
1
media/com_finder/js/debug.min.js
vendored
Normal file
1
media/com_finder/js/debug.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
((e,n)=>{if(!e)throw new Error("core.js was not properly initialised");e.finderIndexer=()=>{const r=`&${n.getElementById("finder-indexer-token").getAttribute("name")}=1`;e.debugIndexing=()=>{const t=new URLSearchParams(Array.from(new FormData(n.getElementById("debug-form")))).toString();e.request({url:`index.php?option=com_finder&task=indexer.debug&tmpl=component&format=json${r}&${t}`,method:"GET",data:"",perform:!0,headers:{"Content-Type":"application/x-www-form-urlencoded"},onSuccess:e=>{const r=n.getElementById("indexer-output");try{const n=JSON.parse(e);r.innerHTML=n.rendered}catch(n){r.innerHTML=e}},onError:e=>{n.getElementById("indexer-output").innerHTML=e.response}})}}})(Joomla,document),document.addEventListener("DOMContentLoaded",(()=>{window.Indexer=Joomla.finderIndexer()}));
|
||||
BIN
media/com_finder/js/debug.min.js.gz
Normal file
BIN
media/com_finder/js/debug.min.js.gz
Normal file
Binary file not shown.
23
media/com_finder/js/filters.js
Normal file
23
media/com_finder/js/filters.js
Normal 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);
|
||||
1
media/com_finder/js/filters.min.js
vendored
Normal file
1
media/com_finder/js/filters.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
(t=>{t||(window.Joomla={});const e=()=>{t.submitbutton=e=>!("filters.delete"===e&&!window.confirm(t.Text._("COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT")))&&(t.submitform(e),!0),document.addEventListener("DOMContentLoaded",e)};document.addEventListener("DOMContentLoaded",e)})(Joomla);
|
||||
BIN
media/com_finder/js/filters.min.js.gz
Normal file
BIN
media/com_finder/js/filters.min.js.gz
Normal file
Binary file not shown.
54
media/com_finder/js/finder-edit.js
Normal file
54
media/com_finder/js/finder-edit.js
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @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
|
||||
[].slice.call(document.querySelectorAll('.filter-toggle-all')).forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
[].slice.call(document.querySelectorAll('.filter-node')).forEach(node => {
|
||||
node.click();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Update the count
|
||||
[].slice.call(document.querySelectorAll('.filter-node')).forEach(() => {
|
||||
const count = document.getElementById('jform_map_count');
|
||||
if (count) {
|
||||
count.value = document.querySelectorAll('input[type="checkbox"]:checked').length;
|
||||
}
|
||||
});
|
||||
Array.from(document.querySelectorAll('.js-filter')).forEach(button => {
|
||||
button.addEventListener('click', event => {
|
||||
const btn = event.currentTarget;
|
||||
Array.from(document.querySelectorAll(`.${btn.dataset.id}`)).map(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 = [].slice.call(document.querySelectorAll('.accordion-button.collapsed'));
|
||||
} else {
|
||||
event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL');
|
||||
elements = [].slice.call(document.querySelectorAll('.accordion-button:not(.collapsed)'));
|
||||
}
|
||||
if (elements) {
|
||||
elements.forEach(element => {
|
||||
element.click();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
1
media/com_finder/js/finder-edit.min.js
vendored
Normal file
1
media/com_finder/js/finder-edit.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
Joomla=window.Joomla||{},document.addEventListener("DOMContentLoaded",(()=>{[].slice.call(document.querySelectorAll(".filter-toggle-all")).forEach((e=>{e.addEventListener("click",(()=>{[].slice.call(document.querySelectorAll(".filter-node")).forEach((e=>{e.click()}))}))})),[].slice.call(document.querySelectorAll(".filter-node")).forEach((()=>{const e=document.getElementById("jform_map_count");e&&(e.value=document.querySelectorAll('input[type="checkbox"]:checked').length)})),Array.from(document.querySelectorAll(".js-filter")).forEach((e=>{e.addEventListener("click",(e=>{const t=e.currentTarget;Array.from(document.querySelectorAll(`.${t.dataset.id}`)).map((e=>e.click()))}))}));const e=document.getElementById("expandAccordion");e&&e.addEventListener("click",(e=>{let t;e.preventDefault(),e.target.innerText===Joomla.Text._("COM_FINDER_FILTER_SHOW_ALL")?(e.target.innerText=Joomla.Text._("COM_FINDER_FILTER_HIDE_ALL"),t=[].slice.call(document.querySelectorAll(".accordion-button.collapsed"))):(e.target.innerText=Joomla.Text._("COM_FINDER_FILTER_SHOW_ALL"),t=[].slice.call(document.querySelectorAll(".accordion-button:not(.collapsed)"))),t&&t.forEach((e=>{e.click()}))}))}));
|
||||
BIN
media/com_finder/js/finder-edit.min.js.gz
Normal file
BIN
media/com_finder/js/finder-edit.min.js.gz
Normal file
Binary file not shown.
88
media/com_finder/js/finder.js
Normal file
88
media/com_finder/js/finder.js
Normal 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) {
|
||||
Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr, 'parsererror'));
|
||||
return;
|
||||
}
|
||||
if (Object.prototype.toString.call(response.suggestions) === '[object Array]') {
|
||||
target.awesomplete.list = response.suggestions;
|
||||
}
|
||||
}).catch(xhr => {
|
||||
Joomla.renderMessages(Joomla.ajaxErrorsMessages(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 = () => {
|
||||
const searchWords = [].slice.call(document.querySelectorAll('.js-finder-search-query'));
|
||||
searchWords.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);
|
||||
}
|
||||
}
|
||||
});
|
||||
const forms = [].slice.call(document.querySelectorAll('.js-finder-searchform'));
|
||||
forms.forEach(form => {
|
||||
form.addEventListener('submit', onSubmit);
|
||||
});
|
||||
|
||||
// Cleanup
|
||||
document.removeEventListener('DOMContentLoaded', onBoot);
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', onBoot);
|
||||
})(window.Awesomplete, window.Joomla, window, document);
|
||||
1
media/com_finder/js/finder.min.js
vendored
Normal file
1
media/com_finder/js/finder.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
((e,t,r,s)=>{if(!t)throw new Error("core.js was not properly initialised");const o=({target:e})=>{e.value.length>1&&(e.awesomplete.list=[],t.request({url:`${t.getOptions("finder-search").url}&q=${e.value}`,promise:!0}).then((r=>{let s;try{s=JSON.parse(r.responseText)}catch(e){return void t.renderMessages(t.ajaxErrorsMessages(r,"parsererror"))}"[object Array]"===Object.prototype.toString.call(s.suggestions)&&(e.awesomplete.list=s.suggestions)})).catch((e=>{t.renderMessages(t.ajaxErrorsMessages(e))})))},a=e=>{e.stopPropagation();const t=e.target.querySelector(".js-finder-advanced");if(t){[].slice.call(t.querySelectorAll("select")).forEach((e=>{e.value||e.setAttribute("disabled","disabled")}))}},l=e=>{const t=e.target.closest("form");t&&t.submit()},n=()=>{[].slice.call(s.querySelectorAll(".js-finder-search-query")).forEach((r=>{if(t.getOptions("finder-search")){r.awesomplete=new e(r),r.addEventListener("input",o);r.closest("form").querySelector(".js-finder-advanced")||r.addEventListener("awesomplete-selectcomplete",l)}}));[].slice.call(s.querySelectorAll(".js-finder-searchform")).forEach((e=>{e.addEventListener("submit",a)})),s.removeEventListener("DOMContentLoaded",n)};s.addEventListener("DOMContentLoaded",n)})(window.Awesomplete,window.Joomla,window,document);
|
||||
BIN
media/com_finder/js/finder.min.js.gz
Normal file
BIN
media/com_finder/js/finder.min.js.gz
Normal file
Binary file not shown.
179
media/com_finder/js/indexer.js
Normal file
179
media/com_finder/js/indexer.js
Normal 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();
|
||||
});
|
||||
1
media/com_finder/js/indexer.min.js
vendored
Normal file
1
media/com_finder/js/indexer.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
((e,t)=>{if(!e)throw new Error("core.js was not properly initialised");e.finderIndexer=()=>{let r,n=null,s=null,a=null,i=!1;const d=`&${t.getElementById("finder-indexer-token").getAttribute("name")}=1`,o=e=>{const r=t.getElementById(e);return r?r.parentNode.removeChild(r):null},l=(d,l)=>{const c=t.getElementById("finder-progress-header"),E=t.getElementById("finder-progress-message");try{if(null===d)throw new Error(l);if(d.error)throw new Error(d);if(d.start&&(n=d.totalItems,t.getElementById("finder-debug-data"))){const r=t.getElementById("finder-debug-data");Object.entries(d.pluginState).forEach((t=>{let n=`<dt class="col-sm-3">${t[0]}</dt>`;n+=`<dd id="finder-${t[0].replace(/\s+/g,"-").toLowerCase()}" class="col-sm-9"></dd>`,r.insertAdjacentHTML("beforeend",e.sanitizeHtml(n,{dd:["class","id"],dt:["class"]}))}))}s+=d.batchOffset,((r,i)=>{a=s/n*100;const d=t.getElementById("progress-bar"),l=t.getElementById("finder-progress-header"),c=t.getElementById("finder-progress-message");l&&(l.innerText=r),c&&(c.innerHTML=e.sanitizeHtml(i)),d&&(a<100?(d.style.width=`${a}%`,d.setAttribute("aria-valuenow",a)):(d.classList.remove("bar-success"),d.classList.add("bar-warning"),d.setAttribute("aria-valuemin",100),d.setAttribute("aria-valuemax",200),d.style.width=`${a}%`,d.setAttribute("aria-valuenow",a)),i===e.Text._("COM_FINDER_INDEXER_MESSAGE_COMPLETE")&&(o("progress"),window.parent.location.reload()))})(d.header,d.message),t.getElementById("finder-debug-data")&&Object.entries(d.pluginState).forEach((r=>{t.getElementById(`finder-${r[0].replace(/\s+/g,"-").toLowerCase()}`).innerHTML=e.sanitizeHtml(`${d.pluginState[r[0]].offset} of ${d.pluginState[r[0]].total}`)})),s<n?r("indexer.batch"):i||(i=!0,r("indexer.optimize"))}catch(t){o("progress");try{d.error&&(c&&(c.innerText=d.header,c.classList.add("finder-error")),E&&(E.innerHTML=e.sanitizeHtml(d.message),E.classList.add("finder-error")))}catch(r){""===t&&(t=e.Text._("COM_FINDER_NO_ERROR_RETURNED")),c&&(c.innerText=e.Text._("COM_FINDER_AN_ERROR_HAS_OCCURRED"),c.classList.add("finder-error")),E&&(E.innerHTML=e.sanitizeHtml(t),E.classList.add("finder-error"))}}return!0};r=r=>{e.request({url:`index.php?option=com_finder&tmpl=component&format=json&task=${r}${d}`,promise:!0}).then((e=>{l(JSON.parse(e.responseText))})).catch((r=>{(r=>{const n=t.getElementById("finder-progress-header"),s=t.getElementById("finder-progress-message");let a;if(r instanceof Error){const n=t.createElement("div");n.textContent=r.message,a=n.innerHTML,r instanceof SyntaxError&&(a=e.Text._("JLIB_JS_AJAX_ERROR_PARSE").replace("%s",a))}else if("object"==typeof r&&r.responseText){a=r.responseText;try{a=JSON.parse(a)}catch(t){a=e.Text._("JLIB_JS_AJAX_ERROR_OTHER").replace("%s",r.status)}}o("progress");const i=a&&a.header?a.header:e.Text._("COM_FINDER_AN_ERROR_HAS_OCCURRED"),d=a&&a.message?a.message:`${e.Text._("COM_FINDER_MESSAGE_RETURNED")}<br>${a}`;n&&(n.innerText=i,n.classList.add("finder-error")),s&&(s.innerHTML=e.sanitizeHtml(d),s.classList.add("finder-error"))})(r)}))};s=0,a=0,r("indexer.start")}})(Joomla,document),document.addEventListener("DOMContentLoaded",(()=>{window.Indexer=Joomla.finderIndexer()}));
|
||||
BIN
media/com_finder/js/indexer.min.js.gz
Normal file
BIN
media/com_finder/js/indexer.min.js.gz
Normal file
Binary file not shown.
19
media/com_finder/js/maps.js
Normal file
19
media/com_finder/js/maps.js
Normal 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;
|
||||
};
|
||||
});
|
||||
})();
|
||||
1
media/com_finder/js/maps.min.js
vendored
Normal file
1
media/com_finder/js/maps.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
Joomla=window.Joomla||{},document.addEventListener("DOMContentLoaded",(()=>{Joomla.submitbutton=o=>!("map.delete"===o&&!window.confirm(Joomla.Text._("COM_FINDER_MAPS_CONFIRM_DELETE_PROMPT"))||(Joomla.submitform(o),0))}));
|
||||
BIN
media/com_finder/js/maps.min.js.gz
Normal file
BIN
media/com_finder/js/maps.min.js.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user