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 = { defaults = {
view: 'video', view: 'video',
paused: true, paused: true
item: ''
}; };
vars.forEach(function(v) { vars.forEach(function(v) {
v = v.split('='); kv = v.split('='), k = kv[0], v = kv[1];
query[v[0]] = decodeURIComponent(v[1]); query[k] = decodeURIComponent(v);
query[v[0]] = { query[k] = {
'true': true, 'false': false '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); return Ox.extend({}, defaults, query);
} }