commit a881e46: [Minor] Dismiss popover by clicking outside

moisseev moiseev at mezonplus.ru
Thu Jun 24 09:14:04 UTC 2021


Author: moisseev
Date: 2021-06-23 11:45:13 +0300
URL: https://github.com/rspamd/rspamd/commit/a881e460062d8487d439011b5ddab2b70485fbf5 (refs/pull/3805/head)

[Minor] Dismiss popover by clicking outside

---
 interface/js/app/rspamd.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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 () {


More information about the Commits mailing list