Index: remoting/webapp/base/js/base.js |
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js |
index 11bd091acf0ca9d5397e91db878a399403450da9..5c88dfd8fbabfe99c2b6bab848bea222e2f8d8f1 100644 |
--- a/remoting/webapp/base/js/base.js |
+++ b/remoting/webapp/base/js/base.js |
@@ -160,6 +160,20 @@ base.urlJoin = function(url, opt_params) { |
return url + '?' + queryParameters.join('&'); |
}; |
+ |
+/** |
+ * @return {Object.<string, string>} The URL parameters. |
+ */ |
+base.getUrlParameters = function() { |
kelvinp
2015/02/03 01:15:33
Grouping it closer to the other url utilities
|
+ var result = {}; |
+ var parts = window.location.search.substring(1).split('&'); |
+ for (var i = 0; i < parts.length; i++) { |
+ var pair = parts[i].split('='); |
+ result[pair[0]] = decodeURIComponent(pair[1]); |
+ } |
+ return result; |
+}; |
+ |
/** |
* Convert special characters (e.g. &, < and >) to HTML entities. |
* |
@@ -444,7 +458,7 @@ base.encodeUtf8 = function(string) { |
for (var i = 0; i < utf8String.length; i++) |
result[i] = utf8String.charCodeAt(i); |
return result.buffer; |
-} |
+}; |
/** |
* Decodes UTF-8 string from ArrayBuffer. |
@@ -455,7 +469,7 @@ base.encodeUtf8 = function(string) { |
base.decodeUtf8 = function(buffer) { |
return decodeURIComponent( |
escape(String.fromCharCode.apply(null, new Uint8Array(buffer)))); |
-} |
+}; |
/** |
* Generate a nonce, to be used as an xsrf protection token. |
@@ -479,4 +493,4 @@ base.jsonParseSafe = function(jsonString) { |
} catch (err) { |
return undefined; |
} |
-} |
+}; |