33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-11-13 16:56:36 +00:00

simplify processing of ajax results

This commit is contained in:
Denis Ryabov 2021-03-09 23:24:49 +03:00
parent e69d2eb2cc
commit 2182167574

View File

@ -24,28 +24,19 @@ function check(url, rule) {
target.html(result);
var error = target.find('.alert-danger').length;
if (error) {
sidebar.find('.badge.bg-danger').text(error);
}
sidebar.find('.badge.bg-danger').text(error || '');
var warning = target.find('.alert-warning').length;
if (warning) {
sidebar.find('.badge.bg-warning').text(warning);
}
sidebar.find('.badge.bg-warning').text(warning || '');
var compat = target.find('.alert-secondary').length;
if (compat) {
sidebar.find('.badge.bg-secondary').text(compat);
}
sidebar.find('.badge.bg-secondary').text(compat || '');
var info = target.find('.alert-info').length;
if (info) {
sidebar.find('.badge.bg-info').text(info);
}
sidebar.find('.badge.bg-info').text(info || '');
if (target.find('.alert-success').length) {
sidebar.find('.badge.bg-success').removeClass("hidden");
}
var success = target.find('.alert-success').length;
sidebar.find('.badge.bg-success').toggleClass('hidden', !success);
sidebar.find('.spinner-border').addClass('hidden');
}