From 00fee0f55d1056baf232374c8473bf4c9b734e4d Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 21 Feb 2013 18:44:12 +0530 Subject: [PATCH] URL parser: add option to parse URL, but not set state --- static/js/pandora/URL.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index 981b897a4..99efbffbc 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -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;