Permalink
Browse files

Pagecontainer: Change changeHash option to changeUrl

Provide backcompatability also
Fixes #6295
Closes #8447
  • Loading branch information...
apsdehal authored and arschmitz committed Jun 20, 2016
1 parent c1a9e23 commit b0fedab57478f927bf9acd8d1ff173e123180a8a
Showing with 12 additions and 5 deletions.
  1. +1 −1 js/init.js
  2. +11 −4 js/widgets/pagecontainer.js
View
@@ -128,7 +128,7 @@ $.extend( $.mobile, {
pagecontainer.pagecontainer( "change", $.mobile.firstPage, {
transition: "none",
reverse: true,
changeHash: false,
changeUrl: false,
fromHashChange: true
} );
} else {
@@ -60,6 +60,9 @@ $.widget( "mobile.pagecontainer", {
changeOptions: {
transition: undefined,
reverse: false,
changeUrl: true,
// Use changeUrl instead, changeHash is deprecated and will be removed in 1.6
changeHash: true,
fromHashChange: false,
duplicateCachedPage: undefined,
@@ -75,6 +78,10 @@ $.widget( "mobile.pagecontainer", {
initSelector: false,
_create: function() {
var currentOptions = this.options;
currentOptions.changeUrl = currentOptions.changeUrl ? currentOptions.changeUrl :
( currentOptions.changeHash ? true : false );
// Maintain a global array of pagecontainers
$.mobile.pagecontainers = ( $.mobile.pagecontainers ? $.mobile.pagecontainers : [] )
@@ -256,7 +263,7 @@ $.widget( "mobile.pagecontainer", {
$.mobile.navigate.history.previousIndex = activeIndex;
// Change to the new page
this.change( url, { direction: direction, changeHash: false, fromHashChange: true } );
this.change( url, { direction: direction, changeUrl: false, fromHashChange: true } );
}
},
@@ -354,7 +361,7 @@ $.widget( "mobile.pagecontainer", {
// the page and the hash, NOTE that the transition is derived from the previous history
// entry
changePageOptions = {
changeHash: false,
changeUrl: false,
fromHashChange: true,
reverse: data.direction === "back"
};
@@ -1115,7 +1122,7 @@ $.widget( "mobile.pagecontainer", {
!this.activePage.hasClass( "ui-page-dialog" ) &&
$.mobile.navigate.history.activeIndex > 0 ) {
settings.changeHash = false;
settings.changeUrl = false;
alreadyThere = true;
}
@@ -1170,7 +1177,7 @@ $.widget( "mobile.pagecontainer", {
role: settings.role
};
if ( settings.changeHash !== false && $.mobile.hashListeningEnabled ) {
if ( settings.changeUrl !== false && $.mobile.hashListeningEnabled ) {
$.mobile.navigate( this.window[ 0 ].encodeURI( url ), params, true );
} else if ( toPage[ 0 ] !== $.mobile.firstPage[ 0 ] ) {
$.mobile.navigate.history.add( url, params );

0 comments on commit b0fedab

Please sign in to comment.