forked from EugenMayer/bootstrap-dialog
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit d1db8c0. # Conflicts: # dist/css/bootstrap-dialog.css # dist/css/bootstrap-dialog.min.css # dist/js/bootstrap-dialog.js # src/scss/bootstrap-dialog.scss
- Loading branch information
Showing
4 changed files
with
28 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
|
||
/* global define */ | ||
|
||
/* ================================================ | ||
* Make use of Bootstrap's modal more monkey-friendly. | ||
* | ||
* For Bootstrap 3. | ||
* | ||
* [email protected] | ||
* | ||
* https://github.com/nakupanda/bootstrap3-dialog | ||
* | ||
* Licensed under The MIT License. | ||
* ================================================ */ | ||
(function (root, factory) { | ||
|
||
"use strict"; | ||
|
@@ -322,13 +334,6 @@ | |
|
||
BootstrapDialog.METHODS_TO_OVERRIDE = {}; | ||
BootstrapDialog.METHODS_TO_OVERRIDE['v3.1'] = { | ||
handleModalBackdropEvent: function () { | ||
this.getModal().on('click', { dialog: this }, function (event) { | ||
event.target === this && event.data.dialog.isClosable() && event.data.dialog.canCloseByBackdrop() && event.data.dialog.close(); | ||
}); | ||
|
||
return this; | ||
}, | ||
/** | ||
* To make multiple opened dialogs look better. | ||
* | ||
|
@@ -361,7 +366,6 @@ | |
} | ||
}; | ||
BootstrapDialog.METHODS_TO_OVERRIDE['v3.2'] = { | ||
handleModalBackdropEvent: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['handleModalBackdropEvent'], | ||
updateZIndex: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['updateZIndex'], | ||
open: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['open'] | ||
}; | ||
|
@@ -371,7 +375,6 @@ | |
getModalBackdrop: function ($modal) { | ||
return $($modal.data('bs.modal')._backdrop); | ||
}, | ||
handleModalBackdropEvent: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['handleModalBackdropEvent'], | ||
updateZIndex: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['updateZIndex'], | ||
open: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['open'], | ||
getModalForBootstrapDialogModal: function () { | ||
|
@@ -382,7 +385,6 @@ | |
getModalBackdrop: function ($modal) { | ||
return $($modal.data('bs.modal')._backdrop); | ||
}, | ||
handleModalBackdropEvent: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['handleModalBackdropEvent'], | ||
updateZIndex: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['updateZIndex'], | ||
open: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['open'], | ||
getModalForBootstrapDialogModal: function () { | ||
|
@@ -546,14 +548,14 @@ | |
updateType: function () { | ||
if (this.isRealized()) { | ||
var types = [BootstrapDialog.TYPE_DEFAULT, | ||
BootstrapDialog.TYPE_INFO, | ||
BootstrapDialog.TYPE_PRIMARY, | ||
BootstrapDialog.TYPE_SECONDARY, | ||
BootstrapDialog.TYPE_SUCCESS, | ||
BootstrapDialog.TYPE_WARNING, | ||
BootstrapDialog.TYPE_DARK, | ||
BootstrapDialog.TYPE_LIGHT, | ||
BootstrapDialog.TYPE_DANGER]; | ||
BootstrapDialog.TYPE_INFO, | ||
BootstrapDialog.TYPE_PRIMARY, | ||
BootstrapDialog.TYPE_SECONDARY, | ||
BootstrapDialog.TYPE_SUCCESS, | ||
BootstrapDialog.TYPE_WARNING, | ||
BootstrapDialog.TYPE_DARK, | ||
BootstrapDialog.TYPE_LIGHT, | ||
BootstrapDialog.TYPE_DANGER]; | ||
|
||
this.getModal().removeClass(types.join(' ')).addClass(this.getType()); | ||
} | ||
|
@@ -1129,9 +1131,6 @@ | |
} | ||
}); | ||
|
||
// Backdrop, I did't find a way to change bs3 backdrop option after the dialog is popped up, so here's a new wheel. | ||
this.handleModalBackdropEvent(); | ||
|
||
// ESC key support | ||
this.getModal().on('keyup', { dialog: this }, function (event) { | ||
event.which === 27 && event.data.dialog.isClosable() && event.data.dialog.canCloseByKeyboard() && event.data.dialog.close(); | ||
|
@@ -1148,13 +1147,6 @@ | |
|
||
return this; | ||
}, | ||
handleModalBackdropEvent: function () { | ||
this.getModal().on('click', { dialog: this }, function (event) { | ||
$(event.target).hasClass('modal-backdrop') && event.data.dialog.isClosable() && event.data.dialog.canCloseByBackdrop() && event.data.dialog.close(); | ||
}); | ||
|
||
return this; | ||
}, | ||
isModalEvent: function (event) { | ||
return typeof event.namespace !== 'undefined' && event.namespace === 'bs.modal'; | ||
}, | ||
|
@@ -1198,7 +1190,7 @@ | |
this.getModalHeader().append(this.createHeaderContent()); | ||
this.getModalBody().append(this.createBodyContent()); | ||
this.getModal().data('bs.modal', new BootstrapDialogModal(this.getModalForBootstrapDialogModal(), { //FIXME for BootstrapV4 | ||
backdrop: 'static', | ||
backdrop: (this.isClosable() && this.canCloseByBackdrop()) ? true : 'static', | ||
keyboard: false, | ||
show: false | ||
})); | ||
|
Oops, something went wrong.