From 15b9bac755d378c0817d656d4fbd5862f7f64074 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 21 Sep 2021 12:39:22 +0200 Subject: [PATCH] modal.js: Do not open multiple modal windows by clicking more than once --- public/js/icinga/behavior/modal.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/js/icinga/behavior/modal.js b/public/js/icinga/behavior/modal.js index e445cb59d..3f734c4af 100644 --- a/public/js/icinga/behavior/modal.js +++ b/public/js/icinga/behavior/modal.js @@ -42,6 +42,11 @@ var $modal = _this.$ghost.clone(); var $urlTarget = _this.icinga.loader.getLinkTargetFor($a, false); + _this.modalOpener = event.currentTarget; + + // Disable pointer events to block further function calls + _this.modalOpener.style.pointerEvents = 'none'; + // Add showCompact, we don't want controls in a modal url = _this.icinga.utils.addUrlFlag(url, 'showCompact'); @@ -189,6 +194,10 @@ * @param $modal {jQuery} The modal element */ Modal.prototype.hide = function($modal) { + // Remove pointerEvent none style to make the button clickable again + this.modalOpener.style.pointerEvents = ''; + this.modalOpener = null; + $modal.removeClass('active'); // Using `setTimeout` here to let the transition finish setTimeout(function () {