mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-13 09:03:10 +00:00
simplified the hash handling with help from @jblas
This commit is contained in:
parent
82dc08fee9
commit
b197e760fd
1 changed files with 7 additions and 10 deletions
|
|
@ -30,19 +30,16 @@
|
|||
|
||||
// only replaceState when pushState support is present and
|
||||
// the hash doesn't represent an embeded page
|
||||
// TODO alot of duplication with logic in nav
|
||||
if( $.support.pushState && $.mobile.path.isPath(location.hash) ) {
|
||||
var hash = location.hash || "#" + self.initialFilePath,
|
||||
href = hash.replace( "#", "" );
|
||||
|
||||
//support dialog urls
|
||||
if( href ) {
|
||||
if( href.indexOf( self.dialog ) > -1 ) {
|
||||
href = href.split( self.dialog ).join( "#" + self.dialog );
|
||||
} else if( href.indexOf( self.subkey ) > -1 ) {
|
||||
href = href.split( self.subkey ).join( "#" + self.subkey );
|
||||
}
|
||||
}
|
||||
// propulate the hash when its not available
|
||||
var hash = location.hash || "#" + self.initialFilePath, href;
|
||||
|
||||
// make the hash abolute with the current href
|
||||
href = $.mobile.path.makeUrlAbsolute(hash.replace("#", "") , location.href);
|
||||
|
||||
// replace the current url with the new href and store the state
|
||||
history.replaceState( { hash: hash, title: document.title }, document.title, href );
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue