Refactor getUrlParamsArray()

This commit is contained in:
Clement Ho 2016-12-12 21:24:55 -06:00
parent bcb00bdc48
commit 49231ccef2
2 changed files with 7 additions and 3 deletions

View File

@ -80,9 +80,7 @@
}
loadSearchParamsFromURL() {
// We can trust that each param has one & since values containing & will be encoded
// Remove the first character of search as it is always ?
const params = window.location.search.slice(1).split('&');
const params = gl.utils.getUrlParamsArray();
let inputValues = [];
params.forEach((p) => {

View File

@ -124,6 +124,12 @@
return parsedUrl.pathname.charAt(0) === '/' ? parsedUrl.pathname : '/' + parsedUrl.pathname;
};
gl.utils.getUrlParamsArray = function () {
// We can trust that each param has one & since values containing & will be encoded
// Remove the first character of search as it is always ?
return window.location.search.slice(1).split('&');
}
gl.utils.getParameterByName = function(name) {
var url = window.location.href;
var param = name.replace(/[[\]]/g, '\\$&');