32 lines
641 B
JavaScript
32 lines
641 B
JavaScript
(function () {
|
|
function getOrCreate(modalElement) {
|
|
if (!modalElement || !window.bootstrap || !window.bootstrap.Modal) {
|
|
return null;
|
|
}
|
|
return window.bootstrap.Modal.getOrCreateInstance(modalElement);
|
|
}
|
|
|
|
function show(modalElement) {
|
|
var modal = getOrCreate(modalElement);
|
|
if (modal) {
|
|
modal.show();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function hide(modalElement) {
|
|
var modal = getOrCreate(modalElement);
|
|
if (modal) {
|
|
modal.hide();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
window.pulseModal = {
|
|
getOrCreate: getOrCreate,
|
|
show: show,
|
|
hide: hide
|
|
};
|
|
}()); |