From 04b63bfa106a8c4d2e7646390384b62c4e23a76f Mon Sep 17 00:00:00 2001 From: jlukic Date: Tue, 16 Dec 2014 15:48:19 -0500 Subject: [PATCH] #1417 #1432 #1420, typo in failSafe, should be useFailSafe. Adds animation queueing as a setting for modal --- src/definitions/modules/modal.js | 95 +++++++++++++++++--------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js index 30a0bcd9e..8dc5836ab 100644 --- a/src/definitions/modules/modal.js +++ b/src/definitions/modules/modal.js @@ -272,7 +272,6 @@ $.fn.modal = function(parameters) { : function(){} ; module.refreshModals(); - module.showDimmer(); module.showModal(callback); }, @@ -282,9 +281,6 @@ $.fn.modal = function(parameters) { : function(){} ; module.refreshModals(); - if( !module.othersActive() ) { - module.hideDimmer(); - } module.hideModal(callback); }, @@ -295,6 +291,13 @@ $.fn.modal = function(parameters) { ; if( module.is.animating() || !module.is.active() ) { + module.showDimmer(); + module.cacheSizes(); + module.set.position(); + module.set.screenHeight(); + module.set.type(); + module.set.clickaway(); + if( !settings.allowMultiple && $otherModals.filter(':visible').size() > 0) { module.debug('Other modals visible, queueing show animation'); module.hideOthers(module.showModal); @@ -303,18 +306,13 @@ $.fn.modal = function(parameters) { $.proxy(settings.onShow, element)(); if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) { module.debug('Showing modal with css animations'); - module.cacheSizes(); - module.set.position(); - module.set.screenHeight(); - module.set.type(); - module.set.clickaway(); $module .transition({ - debug : settings.debug, - animation : settings.transition + ' in', - queue : false, - duration : settings.duration, - failSafe : true, + debug : settings.debug, + animation : settings.transition + ' in', + queue : settings.queue, + duration : settings.duration, + useFailSafe : true, onComplete : function() { $.proxy(settings.onVisible, element)(); module.add.keyboardShortcuts(); @@ -345,30 +343,6 @@ $.fn.modal = function(parameters) { } }, - showDimmer: function() { - if($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active') ) { - module.debug('Showing dimmer'); - $dimmable.dimmer('show'); - } - else { - module.debug('Dimmer already visible'); - } - }, - - hideDimmer: function() { - if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) { - module.debug('Dimmer is not visible cannot hide'); - return; - } - module.debug('Hiding dimmer'); - $dimmable.dimmer('hide', function() { - if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) { - module.remove.clickaway(); - module.remove.screenHeight(); - } - }); - }, - hideModal: function(callback) { callback = $.isFunction(callback) ? callback @@ -382,12 +356,15 @@ $.fn.modal = function(parameters) { module.remove.active(); $module .transition({ - debug : settings.debug, - animation : settings.transition + ' out', - queue : false, - duration : settings.duration, - failSafe : true, - onStart : function() { + debug : settings.debug, + animation : settings.transition + ' out', + queue : settings.queue, + duration : settings.duration, + useFailSafe : true, + onStart : function() { + if( !module.othersActive() ) { + module.hideDimmer(); + } module.remove.keyboardShortcuts(); }, onComplete : function() { @@ -400,6 +377,9 @@ $.fn.modal = function(parameters) { } else { module.remove.active(); + if( !module.othersActive() ) { + module.hideDimmer(); + } module.remove.keyboardShortcuts(); $module .fadeOut(settings.duration, settings.easing, function() { @@ -412,6 +392,30 @@ $.fn.modal = function(parameters) { } }, + showDimmer: function() { + if($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active') ) { + module.debug('Showing dimmer'); + $dimmable.dimmer('show'); + } + else { + module.debug('Dimmer already visible'); + } + }, + + hideDimmer: function() { + if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) { + module.debug('Dimmer is not visible cannot hide'); + return; + } + module.debug('Hiding dimmer'); + $dimmable.dimmer('hide', function() { + if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) { + module.remove.clickaway(); + module.remove.screenHeight(); + } + }); + }, + hideAll: function(callback) { callback = $.isFunction(callback) ? callback @@ -792,7 +796,7 @@ $.fn.modal.settings = { name : 'Modal', namespace : 'modal', - debug : false, + debug : true, verbose : true, performance : true, @@ -803,6 +807,7 @@ $.fn.modal.settings = { context : 'body', + queue : false, duration : 500, easing : 'easeOutExpo', offset : 0,