forked from 0x2620/pandora
URL parser: add option to parse URL, but not set state
This commit is contained in:
parent
c3d621350c
commit
00fee0f55d
1 changed files with 8 additions and 2 deletions
|
@ -344,12 +344,18 @@ pandora.URL = (function() {
|
|||
};
|
||||
|
||||
// on page load, this sets the state from the URL
|
||||
that.parse = function(callback) {
|
||||
that.parse = function(set, callback) {
|
||||
if (arguments.length == 1) {
|
||||
callback = arguments[0];
|
||||
} else {
|
||||
set = set === false ? false : true;
|
||||
}
|
||||
if (document.location.pathname.slice(0, 4) == 'url=') {
|
||||
document.location.href = decodeURI(document.location.pathname.slice(4));
|
||||
} else {
|
||||
self.URL.parse(function(state) {
|
||||
setState(state, callback); // setState -> UI.set -> URL.update
|
||||
// setState -> UI.set -> URL.update
|
||||
set ? setState(state, callback) : callback(state);
|
||||
});
|
||||
}
|
||||
return that;
|
||||
|
|
Loading…
Reference in a new issue