]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Show symbols description in scan output
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 30 Jun 2016 16:46:44 +0000 (17:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 30 Jun 2016 16:46:44 +0000 (17:46 +0100)
interface/js/rspamd.js

index f968e9444d75b88464c5bf56752d6aee3343aa13..fbb798b5f989a0121fbe2981eccde91b35af57b0 100644 (file)
                             '<td><span class="label ' + score + '">' + data.score.toFixed(2) + '/' + data.required_score.toFixed(2) + '</span></td>' +
                             '</tr></tbody>')
                             .insertAfter('#scanOutput thead');
+                        var sym_desc = {};
+                        var nsym = 0;
+
                         $.each(data, function (i, item) {
                             if (typeof item == 'object') {
-                                items.push('<div class="cell-overflow" tabindex="1">' + item.name + ': ' + item.score.toFixed(2) + '</div>');
+                                var sym_id = "sym_" + nsym;
+                                if (item.description) {
+                                    sym_desc[sym_id] = item.description;
+                                }
+                                items.push('<div class="cell-overflow" tabindex="1"><abbr id="' + sym_id +
+                                '">' + item.name + '</abbr>: ' + item.score.toFixed(2) + '</div>');
+                                    nsym ++;
                             }
                         });
                         $('<td/>', { id: 'tmpSymbols', html: items.join('') }).appendTo('#scanResult');
                         $('#tmpSymbols').insertAfter('#tmpBody td:last').removeAttr('id');
                         $('#tmpBody').removeAttr('id');
                         $('#scanResult').show();
+                        // Show tooltips
+                        $.each(sym_desc, function(k, v) {
+                            $('#' + k).tooltip({
+                                "placement": "bottom",
+                                "title": v
+                            });
+                        });
                         $('html, body').animate({
                             scrollTop: $('#scanResult').offset().top
                         }, 1000);