Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Merge branch 'tmp'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Aug 8, 2012
2 parents 0a2d1cc + 1d85df6 commit d37d074
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
35 changes: 25 additions & 10 deletions js/jquery.mobile.navigation.js
Expand Up @@ -373,6 +373,8 @@ define( [
} else if ( forward ) {
( opts.either || opts.isForward )( false );
}

console.log( "directHashChange: " + urlHistory.activeIndex + " has become active" );
},

//disable hashchange event listener internally to ignore one change
Expand Down Expand Up @@ -1107,7 +1109,7 @@ define( [
// However, if a dialog is already displayed at this point, and we're
// about to display another dialog, then we must add another hash and
// history entry on top so that one may navigate back to the original dialog
if ( active.url.indexOf( dialogHashKey ) > -1 && !$.mobile.activePage.is( ".ui-dialog" ) ) {
if ( active.url.indexOf( dialogHashKey ) > -1 && active.pageUrl === toPage.jqmData( "url" ) ) {
settings.changeHash = false;
alreadyThere = true;
}
Expand Down Expand Up @@ -1432,6 +1434,7 @@ define( [
});

$.mobile._handleHashChange = function( hash ) {

//find first page via hash
var to = path.stripHash( hash ),
//transition is false if it's the first page, undefined otherwise (and may be overridden by default)
Expand Down Expand Up @@ -1492,15 +1495,27 @@ define( [
either: function( isBack ) {
var active = $.mobile.urlHistory.getActive();

to = active.pageUrl;

// make sure to set the role, transition and reversal
// as most of this is lost by the domCache cleaning
$.extend( changePageOptions, {
role: active.role,
transition: active.transition,
reverse: isBack
});
// If we've ended up at a stale dialog location, do not attempt to load it, but keep
// going in the same direction - much as if the current page had not been a dialog
// (the case above)
if ( active.stale ) {
if ( isBack) {
window.history.back();
} else {
window.history.forward();
}
return;
} else {
to = active.pageUrl;

// make sure to set the role, transition and reversal
// as most of this is lost by the domCache cleaning
$.extend( changePageOptions, {
role: active.role,
transition: active.transition,
reverse: isBack
});
}
}
});
}
Expand Down
1 change: 1 addition & 0 deletions js/widgets/dialog.js
Expand Up @@ -87,6 +87,7 @@ $.widget( "mobile.dialog", $.mobile.widget, {

if ( this._isCloseable ) {
this._isCloseable = false;
$.mobile.urlHistory.getActive().stale = true;
if ( $.mobile.hashListeningEnabled ) {
window.history.back();
} else {
Expand Down

0 comments on commit d37d074

Please sign in to comment.