Browse Source

#1417 #1432 #1420, typo in failSafe, should be useFailSafe. Adds animation queueing as a setting for modal

pull/1481/head
jlukic 10 years ago
parent
commit
04b63bfa10
1 changed files with 50 additions and 45 deletions
  1. 95
      src/definitions/modules/modal.js

95
src/definitions/modules/modal.js

@ -272,7 +272,6 @@ $.fn.modal = function(parameters) {
: function(){} : function(){}
; ;
module.refreshModals(); module.refreshModals();
module.showDimmer();
module.showModal(callback); module.showModal(callback);
}, },
@ -282,9 +281,6 @@ $.fn.modal = function(parameters) {
: function(){} : function(){}
; ;
module.refreshModals(); module.refreshModals();
if( !module.othersActive() ) {
module.hideDimmer();
}
module.hideModal(callback); module.hideModal(callback);
}, },
@ -295,6 +291,13 @@ $.fn.modal = function(parameters) {
; ;
if( module.is.animating() || !module.is.active() ) { 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) { if( !settings.allowMultiple && $otherModals.filter(':visible').size() > 0) {
module.debug('Other modals visible, queueing show animation'); module.debug('Other modals visible, queueing show animation');
module.hideOthers(module.showModal); module.hideOthers(module.showModal);
@ -303,18 +306,13 @@ $.fn.modal = function(parameters) {
$.proxy(settings.onShow, element)(); $.proxy(settings.onShow, element)();
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) { if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
module.debug('Showing modal with css animations'); module.debug('Showing modal with css animations');
module.cacheSizes();
module.set.position();
module.set.screenHeight();
module.set.type();
module.set.clickaway();
$module $module
.transition({ .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() { onComplete : function() {
$.proxy(settings.onVisible, element)(); $.proxy(settings.onVisible, element)();
module.add.keyboardShortcuts(); 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) { hideModal: function(callback) {
callback = $.isFunction(callback) callback = $.isFunction(callback)
? callback ? callback
@ -382,12 +356,15 @@ $.fn.modal = function(parameters) {
module.remove.active(); module.remove.active();
$module $module
.transition({ .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(); module.remove.keyboardShortcuts();
}, },
onComplete : function() { onComplete : function() {
@ -400,6 +377,9 @@ $.fn.modal = function(parameters) {
} }
else { else {
module.remove.active(); module.remove.active();
if( !module.othersActive() ) {
module.hideDimmer();
}
module.remove.keyboardShortcuts(); module.remove.keyboardShortcuts();
$module $module
.fadeOut(settings.duration, settings.easing, function() { .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) { hideAll: function(callback) {
callback = $.isFunction(callback) callback = $.isFunction(callback)
? callback ? callback
@ -792,7 +796,7 @@ $.fn.modal.settings = {
name : 'Modal', name : 'Modal',
namespace : 'modal', namespace : 'modal',
debug : false,
debug : true,
verbose : true, verbose : true,
performance : true, performance : true,
@ -803,6 +807,7 @@ $.fn.modal.settings = {
context : 'body', context : 'body',
queue : false,
duration : 500, duration : 500,
easing : 'easeOutExpo', easing : 'easeOutExpo',
offset : 0, offset : 0,

Loading…
Cancel
Save