forked from 0x2620/pandora
update url controller
This commit is contained in:
parent
701caae2aa
commit
56aeb1355e
1 changed files with 12 additions and 10 deletions
|
@ -344,12 +344,11 @@ pandora.URL = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// on page load, this sets the state from the URL
|
// on page load, this sets the state from the URL
|
||||||
that.parse = function(set, callback) {
|
// can also be used to parse a URL
|
||||||
|
that.parse = function(url, callback) {
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
callback = arguments[0];
|
callback = arguments[0];
|
||||||
} else {
|
url = null;
|
||||||
set = set === false ? false : true;
|
|
||||||
}
|
|
||||||
if (document.location.pathname.slice(0, 4) == 'url=') {
|
if (document.location.pathname.slice(0, 4) == 'url=') {
|
||||||
document.location.href = decodeURI(document.location.pathname.slice(4));
|
document.location.href = decodeURI(document.location.pathname.slice(4));
|
||||||
} else {
|
} else {
|
||||||
|
@ -358,6 +357,9 @@ pandora.URL = (function() {
|
||||||
set ? setState(state, callback) : callback(state);
|
set ? setState(state, callback) : callback(state);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
self.URL.parse(url, callback);
|
||||||
|
}
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue