properly parse numbers in query

This commit is contained in:
rolux 2013-02-12 13:44:28 +05:30
parent ec43a7c194
commit aecfd18a01

View file

@ -224,15 +224,17 @@ Ox.load('UI', {
},
defaults = {
view: 'video',
paused: true,
item: ''
paused: true
};
vars.forEach(function(v) {
v = v.split('=');
query[v[0]] = decodeURIComponent(v[1]);
query[v[0]] = {
kv = v.split('='), k = kv[0], v = kv[1];
query[k] = decodeURIComponent(v);
query[k] = {
'true': true, 'false': false
}[query[v[0]]] || query[v[0]];
}[query[k]] || query[k];
if (query[k].match(/^[\d\.]+$/)) {
query[k] = parseFloat(query[k]);
}
});
return Ox.extend({}, defaults, query);
}