Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,6 @@ pip-log.txt

# Mac crap
.DS_Store

# JetBrains WebStorm/IntelliJ IDEA
.idea
25 changes: 16 additions & 9 deletions js/bootstrap-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,17 @@
this.options.loading && this.loading();
},

hide: function (e) {
e && e.preventDefault();
hide: function (obj) {
var result;
if (obj){
if (obj instanceof $.Event || obj.preventDefault){
obj.preventDefault();
} else {
result = { modalResult: obj };
}
}

e = $.Event('hide');
var e = $.Event('hide', result);

this.$element.trigger(e);

Expand All @@ -96,8 +103,8 @@
.attr('aria-hidden', true);

$.support.transition && this.$element.hasClass('fade') ?
this.hideWithTransition() :
this.hideModal();
this.hideWithTransition(result) :
this.hideModal(result);
},

layout: function () {
Expand Down Expand Up @@ -188,7 +195,7 @@
}
},

hideWithTransition: function () {
hideWithTransition: function (result) {
var that = this
, timeout = setTimeout(function () {
that.$element.off($.support.transition.end);
Expand All @@ -197,11 +204,11 @@

this.$element.one($.support.transition.end, function () {
clearTimeout(timeout);
that.hideModal();
that.hideModal(result);
});
},

hideModal: function () {
hideModal: function (result) {
var prop = this.options.height ? 'height' : 'max-height';
var value = this.options.height || this.options.maxHeight;

Expand All @@ -213,7 +220,7 @@

this.$element
.hide()
.trigger('hidden');
.trigger($.Event('hidden', result));
},

removeLoading: function () {
Expand Down