From e294660e6229388cfe2ce993364c399dcbfdd9df Mon Sep 17 00:00:00 2001 From: "webmaster@grandhavenchristian.org" Date: Sat, 25 Apr 2015 16:42:02 -0400 Subject: [PATCH] Allow plugins to define custom load/unload animations for the modal --- js/modal.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/js/modal.js b/js/modal.js index e71c8e5..b3b3ba0 100755 --- a/js/modal.js +++ b/js/modal.js @@ -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')