webutil.js: use decodeURIComponent on getQueryVar values.

This commit is contained in:
Joel Martin 2012-08-21 09:46:11 -05:00
parent fcff386b92
commit fa5b334dcb
1 changed files with 7 additions and 2 deletions

View File

@ -75,9 +75,14 @@ WebUtil.dirObj = function (obj, depth, parent) {
// Read a query string variable
WebUtil.getQueryVar = function(name, defVal) {
var re = new RegExp('[?][^#]*' + name + '=([^&#]*)');
var re = new RegExp('[?][^#]*' + name + '=([^&#]*)'),
match = document.location.href.match(re);
if (typeof defVal === 'undefined') { defVal = null; }
return (document.location.href.match(re) || ['',defVal])[1];
if (match) {
return decodeURIComponent(match[1]);
} else {
return defVal;
}
};