Created
July 26, 2011 06:53
-
-
Save asadawan/1106154 to your computer and use it in GitHub Desktop.
Hack to override the the changePage handler in jQuery Mobile, so data can be passed to the "page" using a "__" in the data-url and appending the data to be passed after this delimiter. The nice part of this is that the resulting url can be used to bookmar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright: Asad Awan | |
// license: Apache | |
var utils: { | |
overrideChangePage: function() { | |
var cp = $.mobile.changePage; | |
$.mobile.changePage = function(url, opts) { | |
if (typeof(url) == 'string') { | |
var o = url.split('#'); | |
if (o.length == 2) { | |
var base = o[0]; | |
var s = o[1].split('__'); | |
if (s.length == 2) { | |
utils.globalData = s[1]; | |
url = base + '#' + s[0]; | |
} | |
} | |
} | |
cp(url, opts); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment