Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[popup] Re-introduce interruptible transitions -- Fixes #5094

Conflicts:

	js/widgets/popup.js
  • Loading branch information...
commit e09195f6a0a2879ec2e4bad017b0a2de597d144f 1 parent 6c9135d
Gabriel "_|Nix|_" Schulhof gabrielschulhof authored
Showing with 33 additions and 4 deletions.
  1. +33 −4 js/widgets/popup.js
37 js/widgets/popup.js
View
@@ -451,6 +451,7 @@ define( [ "jquery",
.addClass( args.containerClassToAdd )
.removeClass( args.classToRemove );
} else {
+ this._ui.container.removeClass( args.classToRemove );
args.prereqs.container.resolve();
}
},
@@ -629,7 +630,7 @@ define( [ "jquery",
self._trigger( "afterclose" );
},
- _close: function() {
+ _close: function( immediate ) {
this._ui.container.removeClass( "ui-popup-active" );
this._page.removeClass( "ui-popup-open" );
@@ -645,7 +646,7 @@ define( [ "jquery",
this._animate( {
additionalCondition: this._ui.screen.hasClass( "in" ),
- transition: ( this._currentTransition || this.options.transition ),
+ transition: ( immediate ? "none" : ( this._currentTransition || this.options.transition ) ),
classToRemove: "in",
screenClassToAdd: "out",
containerClassToAdd: "reverse out",
@@ -683,6 +684,34 @@ define( [ "jquery",
}
},
+ _closePopup: function( e, data ) {
+ var parsedDst, toUrl;
+
+ if ( e.type === "pagebeforechange" && data ) {
+ // Determine whether we need to rapid-close the popup, or whether we can
+ // take the time to run the closing transition
+ if ( typeof data.toPage === "string" ) {
+ parsedDst = data.toPage;
+ } else {
+ parsedDst = data.toPage.jqmData( "url" );
+ }
+ parsedDst = $.mobile.path.parseUrl( parsedDst );
+ toUrl = parsedDst.pathname + parsedDst.search + parsedDst.hash;
+
+ if ( this._myUrl !== toUrl ) {
+ // Going to a different page - close immediately
+ this.options.container.unbind( this.options.closeEvents );
+ this._close( true );
+ } else {
+ this._close();
+ }
+
+ return;
+ }
+
+ this._close();
+ },
+
// any navigation event after a popup is opened should close the popup
// NOTE the pagebeforechange is bound to catch navigation events that don't
// alter the url (eg, dialogs from popups)
@@ -690,7 +719,7 @@ define( [ "jquery",
var self = this;
self.options.container
- .one( self.options.closeEvents, $.proxy( self._close, self ));
+ .one( self.options.closeEvents, $.proxy( self, "_closePopup" ) );
},
// TODO no clear deliniation of what should be here and
@@ -732,7 +761,7 @@ define( [ "jquery",
hashkey = $.mobile.dialogHashKey;
activePage = $.mobile.activePage;
currentIsDialog = activePage.is( ".ui-dialog" );
- url = $.mobile.urlHistory.getActive().url;
+ this._myUrl = url = $.mobile.urlHistory.getActive().url;
hasHash = ( url.indexOf( hashkey ) > -1 ) && !currentIsDialog;
urlHistory = $.mobile.urlHistory;
Please sign in to comment.
Something went wrong with that request. Please try again.