From ac69ef64cce20bc80f15c6bb887fe0e757631c33 Mon Sep 17 00:00:00 2001 From: Jason Daly Date: Fri, 15 Nov 2013 16:00:28 -0500 Subject: [PATCH 1/3] Trailing whitespace cleanup --- jquery.modal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.modal.js b/jquery.modal.js index 9b98356..dc84fa6 100644 --- a/jquery.modal.js +++ b/jquery.modal.js @@ -175,11 +175,11 @@ if (!current) return; current.resize(); }; - + // Returns if there currently is an active modal $.modal.isActive = function () { return current ? true : false; - } + } $.modal.defaults = { overlay: "#000", From 7ce07c7ecd5db3d6a92b4febbe7efbd48955b658 Mon Sep 17 00:00:00 2001 From: Jason Daly Date: Fri, 15 Nov 2013 16:01:37 -0500 Subject: [PATCH 2/3] Whitespace consistency around `if (` --- jquery.modal.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jquery.modal.js b/jquery.modal.js index dc84fa6..c746be7 100644 --- a/jquery.modal.js +++ b/jquery.modal.js @@ -50,7 +50,7 @@ open: function() { var m = this; - if(this.options.doFade) { + if (this.options.doFade) { this.block(); setTimeout(function() { m.show(); @@ -85,14 +85,14 @@ opacity: initialOpacity }); this.$body.append(this.blocker); - if(this.options.doFade) { + if (this.options.doFade) { this.blocker.animate({opacity: this.options.opacity}, this.options.fadeDuration); } this.$elm.trigger($.modal.BLOCK, [this._ctx()]); }, unblock: function() { - if(this.options.doFade) { + if (this.options.doFade) { this.blocker.fadeOut(this.options.fadeDuration, function() { this.remove(); }); @@ -109,7 +109,7 @@ } this.$elm.addClass(this.options.modalClass + ' current'); this.center(); - if(this.options.doFade) { + if (this.options.doFade) { this.$elm.fadeIn(this.options.fadeDuration); } else { this.$elm.show(); @@ -122,7 +122,7 @@ if (this.closeButton) this.closeButton.remove(); this.$elm.removeClass('current'); - if(this.options.doFade) { + if (this.options.doFade) { this.$elm.fadeOut(this.options.fadeDuration); } else { this.$elm.hide(); From 727e6e130b10bd568ee947d450ca157d75fee820 Mon Sep 17 00:00:00 2001 From: Jason Daly Date: Fri, 15 Nov 2013 16:17:14 -0500 Subject: [PATCH 3/3] Fixes error on `modal:open` when previous `modal:open` failed (bad HTTP response) The `current`, but not open model isn't cleared when an Ajax request fails. This causes an unnecessary attempt to close the unopened modal, causing an error due to no `blocker` being created. --- jquery.modal.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jquery.modal.js b/jquery.modal.js index c746be7..c4ede0b 100644 --- a/jquery.modal.js +++ b/jquery.modal.js @@ -37,6 +37,7 @@ el.trigger($.modal.AJAX_FAIL); current.hideSpinner(); el.trigger($.modal.AJAX_COMPLETE); + current = null; }); } } else {