34 lines
706 B
JavaScript
34 lines
706 B
JavaScript
// Bootstrap modal convenience wrapper for the browser scripts.
|
|
|
|
(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
|
|
};
|
|
}()); |