", { "data-role": "footer", "data-id": persistentFooterID, "class": "ui-footer-duplicate" } ) : "" )
.parent()
.attr({
- id: id,
+ "data-url": id,
"data-theme": theme,
"data-count-theme": countTheme
})
diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js
index 4f758fd5..75cd50e3 100644
--- a/js/jquery.mobile.navigation.js
+++ b/js/jquery.mobile.navigation.js
@@ -20,14 +20,19 @@
newPath = location.hash;
}
newPath = newPath.replace(/#/,'').split('/');
- newPath.pop();
+ if(newPath.length){
+ var lastSegment = newPath[newPath.length-1];
+ if( lastSegment.indexOf('.') > -1 || lastSegment == ''){
+ newPath.pop();
+ }
+ }
return newPath.join('/') + (newPath.length ? '/' : '');
},
//return the substring of a filepath before the sub-page key, for making a server request
getFilePath: function( path ){
var splitkey = '&' + $.mobile.subPageUrlKey;
- return path.indexOf( splitkey ) > -1 ? path.split( splitkey )[0] : path;
+ return path && path.indexOf( splitkey ) > -1 ? path.split( splitkey )[0] : path;
},
set: function( path, disableListening){
@@ -36,7 +41,7 @@
},
//location pathname from intial directory request
- origin: null,
+ origin: '',
setOrigin: function(){
path.origin = path.get( location.protocol + '//' + location.host + location.pathname );
@@ -85,7 +90,6 @@
//set location pathname from intial directory request
path.setOrigin();
-
/*
internal utility functions
@@ -134,7 +138,7 @@
// changepage function
$.mobile.changePage = function( to, transition, back, changeHash){
-
+
//from is always the currently viewed page
var toIsArray = $.type(to) === "array",
from = toIsArray ? to[0] : $.mobile.activePage,
@@ -147,11 +151,13 @@
back = (back !== undefined) ? back : ( urlStack.length > 1 && urlStack[ urlStack.length - 2 ].url === url ),
transition = (transition !== undefined) ? transition : $.mobile.defaultTransition;
+
//If we are trying to transition to the same page that we are currently on ignore the request.
- if(urlStack.length > 1 && url === urlStack[urlStack.length -1].url) {
+ if(urlStack.length > 1 && url === urlStack[urlStack.length -1].url && !toIsArray ) {
return;
}
+
if( $.type(to) === "object" && to.url ){
url = to.url,
data = to.data,
@@ -163,6 +169,9 @@
data = undefined;
}
}
+
+
+
//reset base to pathname for new request
if(base){ base.reset(); }
@@ -243,9 +252,12 @@
function enhancePage(){
//set next page role, if defined
- if ( nextPageRole ) {
- to.attr( "data-role", nextPageRole );
- nextPageRole = undefined;
+ if ( nextPageRole || to.data('role') == 'dialog' ) {
+ changeHash = false;
+ if(nextPageRole){
+ to.attr( "data-role", nextPageRole );
+ nextPageRole = null;
+ }
}
//run page plugin
@@ -254,11 +266,11 @@
//if url is a string
if( url ){
- to = $( "[id='" + url + "']" ),
+ to = $( "[data-url='" + url + "']" );
fileUrl = path.getFilePath(url);
}
else{ //find base url of element, if avail
- var toID = to.attr('id'),
+ var toID = to.attr('data-url'),
toIDfileurl = path.getFilePath(toID);
if(toID != toIDfileurl){
@@ -287,13 +299,12 @@
type: type,
data: data,
success: function( html ) {
-
if(base){ base.set(fileUrl); }
var all = $("
");
//workaround to allow scripts to execute when included in page divs
all.get(0).innerHTML = html;
- to = all.find('[data-role="page"]');
+ to = all.find('[data-role="page"], [data-role="dialog"]').first();
//rewrite src and href attrs to use a base url
if( !$.support.dynamicBaseTag ){
@@ -310,24 +321,9 @@
}
});
}
-
- //preserve ID on a retrieved page
- if ( to.attr('id') ) {
- //wrap page and transfer data-attrs if it has an ID
- var copyAttrs = ['data-role', 'data-theme', 'data-fullscreen'], //TODO: more page-level attrs?
- wrapper = to.wrap( "
" ).parent();
-
- $.each(copyAttrs,function(i){
- if( to.attr( copyAttrs[ i ] ) ){
- wrapper.attr( copyAttrs[ i ], to.attr( copyAttrs[ i ] ) );
- to.removeAttr( copyAttrs[ i ] );
- }
- });
- to = wrapper;
- }
to
- .attr( "id", fileUrl )
+ .attr( "data-url", fileUrl )
.appendTo( $.mobile.pageContainer );
enhancePage();
@@ -336,6 +332,7 @@
error: function() {
$.mobile.pageLoading( true );
removeActiveLinkClass(true);
+ base.set(path.get());
$("
Error Loading Page
")
.css({ "display": "block", "opacity": 0.96, "top": $(window).scrollTop() + 100 })
.appendTo( $.mobile.pageContainer )
@@ -349,8 +346,6 @@
};
-
-
/* Event Bindings - hashchange, submit, and click */
@@ -386,6 +381,7 @@
//click routing - direct to HTTP or Ajax, accordingly
$( "a" ).live( "click", function(event) {
+
if( !$.mobile.ajaxLinksEnabled ){ return; }
var $this = $(this),
//get href, remove same-domain protocol and host
@@ -418,8 +414,7 @@
else {
//use ajax
var transition = $this.data( "transition" ),
- back = $this.data( "back" ),
- changeHashOnSuccess = !$this.is( "[data-rel="+ $.mobile.nonHistorySelectors +"]" );
+ back = $this.data( "back" );
nextPageRole = $this.attr( "data-rel" );
@@ -430,7 +425,7 @@
href.replace(/^#/,'');
- $.mobile.changePage(href, transition, back, changeHashOnSuccess);
+ $.mobile.changePage(href, transition, back);
}
event.preventDefault();
});
diff --git a/themes/default/jquery.mobile.button.css b/themes/default/jquery.mobile.button.css
index 2ae040d7..0b10abba 100644
--- a/themes/default/jquery.mobile.button.css
+++ b/themes/default/jquery.mobile.button.css
@@ -50,4 +50,4 @@
.ui-btn-icon-top .ui-icon { top: 5px; }
.ui-btn-icon-bottom .ui-icon { bottom: 5px; }
/*hiding native button,inputs */
-.ui-btn-hidden { position: absolute; left: -9999px; }
+.ui-btn-hidden { position: absolute; top: 0; left: 0; width: 100%; height: 100%; -webkit-appearance: button; opacity: 0; cursor: pointer; }