|
258 | 258 | },
|
259 | 259 |
|
260 | 260 | // addNew is used whenever a new page is added
|
261 |
| - addNew: function( url, transition, title, pageUrl ) { |
| 261 | + addNew: function( url, transition, title, pageUrl, role ) { |
262 | 262 | //if there's forward history, wipe it
|
263 | 263 | if( urlHistory.getNext() ) {
|
264 | 264 | urlHistory.clearForward();
|
265 | 265 | }
|
266 | 266 |
|
267 |
| - urlHistory.stack.push( {url : url, transition: transition, title: title, pageUrl: pageUrl } ); |
| 267 | + urlHistory.stack.push( {url : url, transition: transition, title: title, pageUrl: pageUrl, role: role } ); |
268 | 268 |
|
269 | 269 | urlHistory.activeIndex = urlHistory.stack.length - 1;
|
270 | 270 | },
|
|
942 | 942 |
|
943 | 943 | //add page to history stack if it's not back or forward
|
944 | 944 | if( !historyDir ) {
|
945 |
| - urlHistory.addNew( url, settings.transition, pageTitle, pageUrl ); |
| 945 | + urlHistory.addNew( url, settings.transition, pageTitle, pageUrl, settings.role ); |
946 | 946 | }
|
947 | 947 |
|
948 | 948 | //set page title
|
|
1188 | 1188 | //hashchange event handler
|
1189 | 1189 | $window.bind( "hashchange", function( e, triggered ) {
|
1190 | 1190 | //find first page via hash
|
1191 |
| - var to = path.stripHash( location.hash ), |
| 1191 | + var role, to = path.stripHash( location.hash ), |
1192 | 1192 | //transition is false if it's the first page, undefined otherwise (and may be overridden by default)
|
1193 | 1193 | transition = $.mobile.urlHistory.stack.length === 0 ? "none" : undefined;
|
1194 | 1194 |
|
|
1199 | 1199 | }
|
1200 | 1200 |
|
1201 | 1201 | // special case for dialogs
|
1202 |
| - if( urlHistory.stack.length > 1 && |
1203 |
| - to.indexOf( dialogHashKey ) > -1 ) { |
| 1202 | + if( urlHistory.stack.length > 1 && to.indexOf( dialogHashKey ) > -1 ) { |
1204 | 1203 |
|
1205 | 1204 | // If current active page is not a dialog skip the dialog and continue
|
1206 | 1205 | // in the same direction
|
|
1216 | 1215 | // prevent changepage
|
1217 | 1216 | return;
|
1218 | 1217 | } else {
|
1219 |
| - var setTo = function() { to = $.mobile.urlHistory.getActive().pageUrl; }; |
| 1218 | + var setTo = function() { |
| 1219 | + var active = $.mobile.urlHistory.getActive(); |
| 1220 | + to = active.pageUrl; |
| 1221 | + role = active.role; |
| 1222 | + }; |
1220 | 1223 | // if the current active page is a dialog and we're navigating
|
1221 | 1224 | // to a dialog use the dialog objected saved in the stack
|
1222 | 1225 | urlHistory.directHashChange({ currentUrl: to, isBack: setTo, isForward: setTo });
|
|
1226 | 1229 | //if to is defined, load it
|
1227 | 1230 | if ( to ) {
|
1228 | 1231 | to = ( typeof to === "string" && !path.isPath( to ) ) ? ( '#' + to ) : to;
|
1229 |
| - $.mobile.changePage( to, { transition: transition, changeHash: false, fromHashChange: true } ); |
| 1232 | + $.mobile.changePage( to, { transition: transition, changeHash: false, fromHashChange: true , role: role} ); |
1230 | 1233 | }
|
1231 | 1234 | //there's no hash, go to the first page in the dom
|
1232 | 1235 | else {
|
1233 |
| - $.mobile.changePage( $.mobile.firstPage, { transition: transition, changeHash: false, fromHashChange: true } ); |
| 1236 | + $.mobile.changePage( $.mobile.firstPage, { transition: transition, changeHash: false, fromHashChange: true, roll: rolle } ); |
1234 | 1237 | }
|
1235 | 1238 | });
|
1236 | 1239 |
|
|
0 commit comments