Permalink
Browse files

create transition handler object

  • Loading branch information...
johnbender committed Mar 27, 2013
1 parent e900d62 commit 93b0b48a0668e937959ab1afe16500e1dfaca7ec
Showing with 24 additions and 19 deletions.
  1. +6 −6 js/jquery.mobile.navigation.js
  2. +18 −13 js/jquery.mobile.transition.js
@@ -272,7 +272,7 @@ define( [
//isn't one in our transitionHandlers dictionary, use the default one.
//call the handler immediately to kick-off the transition.
var th = $.mobile.transitionHandlers[ transition || "default" ] || $.mobile.defaultTransitionHandler,
promise = th( transition, reverse, toPage, fromPage );
promise = th.transition( transition, reverse, toPage, fromPage );
promise.done(function() {
//trigger show/hide events
@@ -296,7 +296,7 @@ define( [
aPageBorderB = parseFloat( aPage.css( "border-bottom-width" ) );
height = ( typeof height === "number" )? height : getScreenHeight();
aPage.css( "min-height", height - aPagePadT - aPagePadB - aPageBorderT - aPageBorderB );
};
@@ -430,7 +430,7 @@ define( [
.jqmData( "url", dataUrl );
}
// If we failed to find a page in the DOM, check the URL to see if it
// refers to the first page in the application. If it isn't a reference
// to the first page and refers to non-existent embedded page, error out.
@@ -452,7 +452,7 @@ define( [
return deferred.promise();
}
}
// If the page we are interested in is already in the DOM,
// and the caller did not indicate that we should force a
// reload of the file, we are done. Otherwise, track the
@@ -461,7 +461,7 @@ define( [
if ( !settings.reloadPage ) {
enhancePage( page, settings.role );
deferred.resolve( absUrl, options, page );
//if we are reloading the page make sure we update the base if its not a prefetch
//if we are reloading the page make sure we update the base if its not a prefetch
if( base && !options.prefetch ){
base.set(url);
}
@@ -499,7 +499,7 @@ define( [
};
}
// Reset base to the default document base.
// only reset if we are not prefetching
// only reset if we are not prefetching
if ( base && typeof options.prefetch === "undefined" ) {
base.reset();
}
@@ -9,14 +9,18 @@ define( [ "jquery", "./jquery.mobile.core" ], function( jQuery ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, window, undefined ) {
var createHandler = function( sequential ) {
// Default to sequential
if ( sequential === undefined ) {
sequential = true;
}
$.mobile.TransitionHandler = function( sequential ) {
// Default to sequential
if ( sequential === undefined ) {
sequential = true;
}
this.sequential = sequential;
};
return function( name, reverse, $to, $from ) {
$.mobile.TransitionHandler.prototype.transition = function( name, reverse, $to, $from ) {
// TODO temporary
var self = this;
var deferred = new $.Deferred(),
reverseClass = reverse ? " reverse" : "",
@@ -48,7 +52,7 @@ var createHandler = function( sequential ) {
},
startOut = function() {
// if it's not sequential, call the doneOut transition to start the TO page animating in simultaneously
if ( !sequential ) {
if ( !self.sequential ) {
doneOut();
}
else {
@@ -64,7 +68,7 @@ var createHandler = function( sequential ) {
doneOut = function() {
if ( $from && sequential ) {
if ( $from && self.sequential ) {
cleanFrom();
}
@@ -105,7 +109,7 @@ var createHandler = function( sequential ) {
doneIn = function() {
if ( !sequential ) {
if ( !self.sequential ) {
if ( $from ) {
cleanFrom();
@@ -138,11 +142,12 @@ var createHandler = function( sequential ) {
return deferred.promise();
};
};
// generate the handlers from the above
var sequentialHandler = createHandler(),
simultaneousHandler = createHandler( false ),
var sequentialHandler = new $.mobile.TransitionHandler(),
simultaneousHandler = new $.mobile.TransitionHandler( false ),
defaultGetMaxScrollForTransition = function() {
return $.mobile.getScreenHeight() * 3;
};

0 comments on commit 93b0b48

Please sign in to comment.