33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-11-27 15:26:36 +00:00

Update script.js

This commit is contained in:
Dimitris Grammatikogiannis 2022-01-15 17:02:57 +01:00 committed by GitHub
parent b2ea065395
commit ed9f99db64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,7 @@
var success = [...target.querySelectorAll('.alert-success')].length; var success = [...target.querySelectorAll('.alert-success')].length;
[...sidebar.querySelectorAll('.badge.bg-info')].map(el => el.classList.toggle('hidden', !success)); [...sidebar.querySelectorAll('.badge.bg-info')].map(el => el.classList.toggle('hidden', !success));
[...sidebar.querySelectorAll('.badge.bg-border')].map(el => el.classList.add('hidden')); [...sidebar.querySelectorAll('.spinner-border')].map(el => el.classList.add('hidden'));
}) })
.catch(error => { .catch(error => {
console.log(error); console.log(error);
@ -61,22 +61,23 @@
[...sidebar.querySelectorAll('.badge.bg-danger')].map(el => el.textContent = '?'); [...sidebar.querySelectorAll('.badge.bg-danger')].map(el => el.textContent = '?');
[...sidebar.querySelectorAll('.badge.bg-danger, .badge.bg-secondary, .badge.bg-info')].map(el => el.textContent = ''); [...sidebar.querySelectorAll('.badge.bg-danger, .badge.bg-secondary, .badge.bg-info')].map(el => el.textContent = '');
[...sidebar.querySelectorAll('.badge.bg-success, .spinner-border')].map(el => el.addClass('hidden')); [...sidebar.querySelectorAll('.badge.bg-success, .spinner-border')].map(el => el.classList.add('hidden'));
}); });
} }
let jed_collapse_init = false; let jed_collapse_init = false;
window.Joomla.submitbutton = function (task) { window.Joomla.submitbutton = function (task) {
if (task == 'check') { if (task == 'check') {
[...document.querySelectorAll(".jedchecker-results")].map((el) => el.removeClass("hidden")); [...document.querySelectorAll(".jedchecker-results")].map((el) => el.classList.remove("hidden"));
[...document.querySelectorAll('.jedchecker-results .badge:not(.bg-success)')].map((el) => el.innerHTML = ''); [...document.querySelectorAll('.jedchecker-results .badge:not(.bg-success)')].map((el) => el.innerHTML = '');
[...document.querySelectorAll('.jedchecker-results .badge.bg-success')].map((el) => el.addClass('hidden')); [...document.querySelectorAll('.jedchecker-results .badge.bg-success')].map((el) => el.classList.add('hidden'));
[...document.querySelectorAll('.jedchecker-results .spinner-border')].map((el) => el.removeClass('hidden')); [...document.querySelectorAll('.jedchecker-results .spinner-border')].map((el) => el.classList.remove('hidden'));
[...document.querySelectorAll('.police-check-result')].map((el) => el.innerHTML = '<div class="text-center text-info"><span class="spinner-border"></span></div>'); [...document.querySelectorAll('.police-check-result')].map((el) => el.innerHTML = '<div class="text-center text-info"><span class="spinner-border"></span></div>');
if (!jed_collapse_init) { if (!jed_collapse_init) {
[...document.querySelectorAll(".card-header[data-bs-toggle]")].forEach((el) => { [...document.querySelectorAll(".card-header[data-bs-toggle]")].forEach((el) => {
el.addClass("accordion-button collapsed"); el.classList.add("accordion-button");
el.classList.add("collapsed");
el.setAttribute('href', el.dataset.href); el.setAttribute('href', el.dataset.href);
}); });