From 56aeb1355e3f0267f5d80b18c3b6030e71c1aade Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 21 Feb 2013 18:50:59 +0530 Subject: [PATCH] update url controller --- static/js/pandora/URL.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index 99efbffb..23adc6b8 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -344,19 +344,21 @@ pandora.URL = (function() { }; // 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) { callback = arguments[0]; + url = null; + if (document.location.pathname.slice(0, 4) == 'url=') { + document.location.href = decodeURI(document.location.pathname.slice(4)); + } else { + self.URL.parse(function(state) { + // setState -> UI.set -> URL.update + set ? setState(state, callback) : callback(state); + }); + } } 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 -> UI.set -> URL.update - set ? setState(state, callback) : callback(state); - }); + self.URL.parse(url, callback); } return that; };