mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-11-27 07:16:39 +00:00
Update script.js
This commit is contained in:
parent
9d12ef26e1
commit
8769bcc066
@ -1,18 +1,18 @@
|
||||
(() => {
|
||||
const jsonDataElement = document.getElementById('jed-rules-json');
|
||||
if (!jsonDataElement) {
|
||||
thrown new Error('Initialization data is missing');
|
||||
throw new Error('Initialization data is missing');
|
||||
}
|
||||
let jedOptions;
|
||||
try {
|
||||
jedOptions = JSON.parse(jsonDataElement.innerHTML);
|
||||
} catch (e) {
|
||||
thrown new Error('Initialization data is missing');
|
||||
throw new Error('Initialization data is missing');
|
||||
}
|
||||
|
||||
if (!jedOptions) thrown new Error('Initialization data is missing');
|
||||
if (!jedOptions) throw new Error('Initialization data is missing');
|
||||
|
||||
const add_validation = () => {
|
||||
add_validation = () => {
|
||||
// Loop over them and prevent submission
|
||||
[...document.querySelectorAll('.needs-validation')].forEach((form) => {
|
||||
form.addEventListener('submit', (event) => {
|
||||
@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
let jed_collapse_init = false;
|
||||
Joomla.submitbutton = function (task) {
|
||||
window.Joomla.submitbutton = function (task) {
|
||||
if (task == 'check') {
|
||||
[...document.querySelectorAll(".jedchecker-results")].map((el) => el.removeClass("hidden"));
|
||||
[...document.querySelectorAll('.jedchecker-results .badge:not(.bg-success)')].map((el) => el.innerHTML = '');
|
||||
@ -94,5 +94,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('extension-upload').addEventListener('click', (event) => {
|
||||
add_validation();
|
||||
document.getElementById('jed_uploading_spinner').classList.remove('hidden');
|
||||
Joomla.submitbutton('uploads.upload')
|
||||
});
|
||||
|
||||
new bootstrap.Tooltip(document.getElementById('jedchecker'), {container: 'body', selector: '[data-bs-toggle=tooltip]'});
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user