From 4174fdf0b0590fef36afc6585f7de8aadeaba33a Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Thu, 11 Oct 2018 15:25:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=EF=BC=9A$.bc=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0loading=E5=BC=B9=E7=AA=97=E6=97=B6=E9=97=B4=E8=BF=87?= =?UTF-8?q?=E7=9F=AD=E5=AF=BC=E8=87=B4=E5=BC=B9=E7=AA=97=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/wwwroot/js/longbow.common.js | 23 +++++++++---------- Bootstrap.Client/wwwroot/js/longbow.common.js | 23 +++++++++---------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Bootstrap.Admin/wwwroot/js/longbow.common.js b/Bootstrap.Admin/wwwroot/js/longbow.common.js index 191dc31f..8c40e7f9 100644 --- a/Bootstrap.Admin/wwwroot/js/longbow.common.js +++ b/Bootstrap.Admin/wwwroot/js/longbow.common.js @@ -133,11 +133,19 @@ return; } + var loadFlag = "loading"; if (options.loading && options.modal) { - $(options.modal).find('.close').addClass('hidden'); - $(options.modal).modal('show'); + var $modal = $(options.modal); + if (!$modal.hasClass('event')) { + $modal.on('shown.bs.modal', function () { + var $this = $(this); + if ($this.hasClass(loadFlag)) return; + $this.modal('hide'); + }); + } + $(options.modal).addClass(loadFlag).modal('show'); setTimeout(function () { - $(options.modal).find('.close').removeClass('hidden'); + $(options.modal).find('.close').removeClass('d-none'); }, options.loadingTimeout); } @@ -204,15 +212,6 @@ window.lgbSwal = $.lgbSwal; $.fn.extend({ - bc: function (options) { - if (this.attr('lgb_click')) return this; - this.attr('lgb_click', true); - var callback = options.callback; - var that = this; - options.callback = function () { that.removeAttr('lgb_click'); if ($.isFunction(callback)) callback.apply(arguments); }; - $.bc(options); - return this; - }, autoCenter: function (options) { options = $.extend({ top: 0 }, options); var that = this; diff --git a/Bootstrap.Client/wwwroot/js/longbow.common.js b/Bootstrap.Client/wwwroot/js/longbow.common.js index 7451b37a..82c2f8ff 100644 --- a/Bootstrap.Client/wwwroot/js/longbow.common.js +++ b/Bootstrap.Client/wwwroot/js/longbow.common.js @@ -132,11 +132,19 @@ return; } + var loadFlag = "loading"; if (options.loading && options.modal) { - $(options.modal).find('.close').addClass('hidden'); - $(options.modal).modal('show'); + var $modal = $(options.modal); + if (!$modal.hasClass('event')) { + $modal.on('shown.bs.modal', function () { + var $this = $(this); + if ($this.hasClass(loadFlag)) return; + $this.modal('hide'); + }); + } + $(options.modal).addClass(loadFlag).modal('show'); setTimeout(function () { - $(options.modal).find('.close').removeClass('hidden'); + $(options.modal).find('.close').removeClass('d-none'); }, options.loadingTimeout); } @@ -203,15 +211,6 @@ window.lgbSwal = $.lgbSwal; $.fn.extend({ - bc: function (options) { - if (this.attr('lgb_click')) return this; - this.attr('lgb_click', true); - const callback = options.callback; - const that = this; - options.callback = function () { that.removeAttr('lgb_click'); if ($.isFunction(callback)) callback.apply(arguments); }; - $.bc(options); - return this; - }, autoCenter: function (options) { options = $.extend({ top: 0 }, options); var that = this;