andryyy 2019-10-12 19:00:03 +02:00
commit 726235e9ee
2 changed files with 24 additions and 13 deletions

View File

@ -468,11 +468,24 @@ jQuery(function($){
else {
item.rcpt = item.rcpt_smtp.join(", ");
}
Object.keys(item.symbols).map(function(key) {
item.symbols = Object.keys(item.symbols).sort(function (a, b) {
if (item.symbols[a].score === 0) return 1
if (item.symbols[b].score === 0) return -1
if (item.symbols[b].score < 0 && item.symbols[a].score < 0) {
return item.symbols[a].score - item.symbols[b].score
}
if (item.symbols[b].score > 0 && item.symbols[a].score > 0) {
return item.symbols[b].score - item.symbols[a].score
}
return item.symbols[b].score - item.symbols[a].score
}).map(function(key) {
var sym = item.symbols[key];
if (sym.score <= 0) {
if (sym.score < 0) {
sym.score_formatted = '(<span class="text-success"><b>' + sym.score + '</b></span>)'
}
else if (sym.score === 0) {
sym.score_formatted = '(<span><b>' + sym.score + '</b></span>)'
}
else {
sym.score_formatted = '(<span class="text-danger"><b>' + sym.score + '</b></span>)'
}
@ -480,17 +493,9 @@ jQuery(function($){
if (sym.options) {
str += ' [' + sym.options.join(", ") + "]";
}
item.symbols[key].str = str;
});
return str
}).join('<br>\n');
item.subject = escapeHtml(item.subject);
item.symbols = Object.keys(item.symbols).
map(function(key) {
return item.symbols[key];
}).sort(function(e1, e2) {
return Math.abs(e1.score) < Math.abs(e2.score);
}).map(function(e) {
return e.str;
}).join("<br>\n");
var scan_time = item.time_real.toFixed(3) + ' / ' + item.time_virtual.toFixed(3);
item.scan_time = {
"options": {

View File

@ -98,6 +98,12 @@ jQuery(function($){
data.symbols.sort(function (a, b) {
if (a.score === 0) return 1
if (b.score === 0) return -1
if (b.score < 0 && a.score < 0) {
return a.score - b.score
}
if (b.score > 0 && a.score > 0) {
return b.score - a.score
}
return b.score - a.score
})
$.each(data.symbols, function (index, value) {