Allow plugins to define custom load/unload animations for the modal

This commit is contained in:
webmaster@grandhavenchristian.org
2015-04-25 16:42:02 -04:00
parent 4f5498efdf
commit e294660e62

View File

@@ -29,8 +29,13 @@
$('input[autofocus="autofocus"]')
.focus();
});
$('#modal, #modal-overlay')
.fadeIn(200);
// If a plugin has provided a custom load animation
if(typeof codiad.modal.onLoadAnimation == "function") {
codiad.modal.onLoadAnimation();
} else {
$('#modal, #modal-overlay')
.fadeIn(200);
}
codiad.sidebars.modalLock = true;
},
@@ -43,10 +48,17 @@
this._setBounds();
$('#modal-content form')
.die('submit'); // Prevent form bubbling
$('#modal, #modal-overlay')
.fadeOut(200);
$('#modal-content')
.html('');
// If a plugin has provided a custom unload animation (note
// that the custom animation function is responsible for removing
// the HTML from the modal)
if(typeof codiad.modal.onUnloadAnimation == "function") {
codiad.modal.onUnloadAnimation();
} else {
$('#modal, #modal-overlay')
.fadeOut(200);
$('#modal-content')
.html('');
}
codiad.sidebars.modalLock = false;
if (!codiad.sidebars.leftLock) { // Slide sidebar back
$('#sb-left')