forked from 0x2620/oxjs
updates to url and filter
This commit is contained in:
parent
07c79ed7ac
commit
d2a2ddb66e
4 changed files with 73 additions and 19 deletions
|
|
@ -272,11 +272,11 @@ Ox.URL = function(options) {
|
|||
|
||||
function constructValue(str, key) {
|
||||
var findKey = Ox.getObjectById(self.options.findKeys, key),
|
||||
list = findKey.list,
|
||||
type = Ox.isArray(findKey.type) ? findKey.type[0] : findKey.type,
|
||||
value = str;
|
||||
if (type == 'list') {
|
||||
return list[value];
|
||||
value = str,
|
||||
values = findKey.values;
|
||||
if (type == 'enum') {
|
||||
return values[value];
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
@ -617,21 +617,21 @@ Ox.URL = function(options) {
|
|||
|
||||
function parseValue(str, key) {
|
||||
var findKey = Ox.getObjectById(self.options.findKeys, key),
|
||||
list = findKey.list,
|
||||
type = Ox.isArray(findKey.type) ? findKey.type[0] : findKey.type,
|
||||
value = str;
|
||||
value = str,
|
||||
values = findKey.values;
|
||||
if (type == 'boolean') {
|
||||
value = ['', 'false'].indexOf(str) == -1;
|
||||
} else if (type == 'date') {
|
||||
value = Ox.formatDate(Ox.parseDate(str, true), '%F', true);
|
||||
} else if (type == 'enum') {
|
||||
value = Math.max(values.map(function(value) {
|
||||
return value.toLowerCase();
|
||||
}).indexOf(str.toLowerCase()), 0);
|
||||
} else if (type == 'float') {
|
||||
value = parseFloat(str) || 0;
|
||||
} else if (type == 'integer') {
|
||||
value = Math.round(str) || 0;
|
||||
} else if (type == 'list') {
|
||||
value = Math.max(list.map(function(value) {
|
||||
return value.toLowerCase();
|
||||
}).indexOf(str.toLowerCase()), 0);
|
||||
} else if (type == 'time') {
|
||||
value = parseTime(value);
|
||||
} else if (type == 'year') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue