From: moisseev Date: Wed, 23 Jun 2021 08:45:13 +0000 (+0300) Subject: [Minor] Dismiss popover by clicking outside X-Git-Tag: 3.0~243^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a881e460062d8487d439011b5ddab2b70485fbf5;p=rspamd.git [Minor] Dismiss popover by clicking outside --- diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 171812a0c..711ec1971 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -468,6 +468,19 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_ custom_locale = $(localeTextbox).val(); validateLocale(true); }); + + // Dismiss Bootstrap popover by clicking outside + $("body").on("click", function (e) { + $(".popover").each(function () { + if ( + // Popover's descendant + $(this).has(e.target).length || + // Button (or icon within a button) that triggers the popover. + $(e.target).closest("button").attr("aria-describedby") === this.id + ) return; + $(this).popover("hide"); + }); + }); }()); $("#selData").change(function () {