properly parse numbers in query
This commit is contained in:
parent
ec43a7c194
commit
aecfd18a01
1 changed files with 8 additions and 6 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue