bootstrap-show-modal
Advanced tools
Comparing version 3.0.2 to 3.0.3
{ | ||
"name": "bootstrap-show-modal", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "jQuery plugin to create bootstrap 4 modals in pure JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "src/bootstrap-show-modal.js", |
@@ -91,12 +91,10 @@ # bootstrap-show-modal | ||
# More Bootstrap extensions from shaack.com | ||
# You may want to check out my further Bootstrap and HTML extensions | ||
You may want to check out our other Bootstrap and HTML extensions | ||
- [bootstrap-input-spinner](https://shaack.com/projekte/bootstrap-input-spinner/) – Input numbers | ||
- [bootstrap-show-modal](https://shaack.com/projekte/bootstrap-show-modal/) – Show dialogs, dynamically | ||
- [bootstrap-show-notification](https://shaack.com/projekte/bootstrap-show-notification/) – Show notifications, dynamically | ||
- [bootstrap-detect-breakpoint](https://www.npmjs.com/package/bootstrap-detect-breakpoint) – Read the curr. BS BP from JS | ||
- [auto-resize-textarea](https://shaack.com/projekte/auto-resize-textarea/) – Auto resize textareas by its content | ||
- [external-links-blank](https://www.npmjs.com/package/external-links-blank) – Open all external links `_blank` | ||
- [bootstrap-input-spinner](https://shaack.com/en/open-source-components) – Input numbers | ||
- [bootstrap-show-modal](https://shaack.com/en/open-source-components) – Show dialogs, dynamically | ||
- [bootstrap-show-notification](https://shaack.com/en/open-source-components) – Show notifications, dynamically | ||
- [bootstrap-detect-breakpoint](https://shaack.com/en/open-source-components) – Read the curr. BS BP from JS | ||
- [auto-resize-textarea](https://shaack.com/en/open-source-components) – Auto resize textareas by its content | ||
- [external-links-blank](https://shaack.com/en/open-source-components) – Open external links auto `_blank` | ||
@@ -10,3 +10,3 @@ /** | ||
var i = 0 | ||
let i = 0 | ||
@@ -29,3 +29,3 @@ function Modal(props) { | ||
} | ||
for (var prop in props) { | ||
for (let prop in props) { | ||
// noinspection JSUnfilteredForInLoop | ||
@@ -43,3 +43,3 @@ this.props[prop] = props[prop] | ||
Modal.prototype.createContainerElement = function () { | ||
var self = this | ||
const self = this | ||
this.element = document.createElement("div") | ||
@@ -70,3 +70,3 @@ this.element.id = this.id | ||
$(this.element).on('shown.bs.modal', function () { | ||
if(self.props.onShown) { | ||
if (self.props.onShown) { | ||
self.props.onShown(self) | ||
@@ -81,11 +81,17 @@ } | ||
if (this.props.options) { | ||
var modalInstance = new bootstrap.Modal(this.element, this.props.options) | ||
if (modalInstance) { modalInstance.show() } | ||
const modalInstance = new bootstrap.Modal(this.element, this.props.options) | ||
if (modalInstance) { | ||
modalInstance.show() | ||
} | ||
} else { | ||
var modalInstance = new bootstrap.Modal(this.element) | ||
if (modalInstance) { modalInstance.show() } | ||
const modalInstance = new bootstrap.Modal(this.element) | ||
if (modalInstance) { | ||
modalInstance.show() | ||
} | ||
} | ||
} else { | ||
var modalInstance = bootstrap.Modal.getInstance(this.element) | ||
if (modalInstance) { modalInstance.show() } | ||
const modalInstance = bootstrap.Modal.getInstance(this.element) | ||
if (modalInstance) { | ||
modalInstance.show() | ||
} | ||
} | ||
@@ -113,9 +119,13 @@ if (this.props.title) { | ||
Modal.prototype.hide = function () { | ||
var modalInstance = bootstrap.Modal.getInstance(this.element) | ||
if (modalInstance) { modalInstance.hide() } | ||
const modalInstance = bootstrap.Modal.getInstance(this.element) | ||
if (modalInstance) { | ||
modalInstance.hide() | ||
} | ||
} | ||
Modal.prototype.dispose = function () { | ||
var modalInstance = bootstrap.Modal.getInstance(this.element) | ||
if (modalInstance) { modalInstance.dispose() } | ||
const modalInstance = bootstrap.Modal.getInstance(this.element) | ||
if (modalInstance) { | ||
modalInstance.dispose() | ||
} | ||
document.body.removeChild(this.element) | ||
@@ -130,6 +140,6 @@ if (this.props.onDispose) { | ||
if (props.buttons) { | ||
var footer = "" | ||
for (var key in props.buttons) { | ||
let footer = "" | ||
for (let key in props.buttons) { | ||
// noinspection JSUnfilteredForInLoop | ||
var buttonText = props.buttons[key] | ||
const buttonText = props.buttons[key] | ||
footer += '<button type="button" class="btn btn-primary" data-value="' + key + '" data-bs-dismiss="modal">' + buttonText + '</button>' | ||
@@ -150,4 +160,6 @@ } | ||
event.preventDefault() | ||
var modalInstance = bootstrap.Modal.getInstance(modal.element) | ||
if (modalInstance) { modalInstance.hide() } | ||
const modalInstance = bootstrap.Modal.getInstance(modal.element) | ||
if (modalInstance) { | ||
modalInstance.hide() | ||
} | ||
modal.props.onSubmit(event.target.getAttribute("class").indexOf("btn-true") !== -1, modal) | ||
@@ -160,2 +172,2 @@ }) | ||
}(jQuery)) | ||
}(jQuery)) |
Sorry, the diff of this file is not supported yet
37449
9
172
100