merging changes
This commit is contained in:
commit
4b1eadc021
3 changed files with 12 additions and 13 deletions
|
@ -473,17 +473,17 @@ Ox.Input = function(options, self) {
|
||||||
} else if (value == '.') {
|
} else if (value == '.') {
|
||||||
value = '0.' + self.decimals;
|
value = '0.' + self.decimals;
|
||||||
cursor = [2, value.length];
|
cursor = [2, value.length];
|
||||||
} else if (!/\./(value)) {
|
} else if (!/\./.test(value)) {
|
||||||
value += '.' + self.decimals
|
value += '.' + self.decimals;
|
||||||
cursor = [value.indexOf('.'), value.length];
|
cursor = [value.indexOf('.'), value.length];
|
||||||
} else if (/^\./(value)) {
|
} else if (/^\./.test(value)) {
|
||||||
value = '0' + value;
|
value = '0' + value;
|
||||||
cursor = [2, value.length];
|
cursor = [2, value.length];
|
||||||
} else if (/\.$/(value)) {
|
} else if (/\.$/.test(value)) {
|
||||||
//Ox.print('$$$$$$$$$$$')
|
//Ox.print('$$$$$$$$$$$')
|
||||||
value += self.decimals;
|
value += self.decimals;
|
||||||
cursor = [value.indexOf('.') + 1, value.length];
|
cursor = [value.indexOf('.') + 1, value.length];
|
||||||
} else if (/\./(value) && self.options.decimals) {
|
} else if (/\./.test(value) && self.options.decimals) {
|
||||||
length = value.split('.')[1].length;
|
length = value.split('.')[1].length;
|
||||||
if (length > self.options.decimals) {
|
if (length > self.options.decimals) {
|
||||||
value = value.substr(0, value.indexOf('.') + 1 + self.options.decimals);
|
value = value.substr(0, value.indexOf('.') + 1 + self.options.decimals);
|
||||||
|
@ -499,7 +499,7 @@ Ox.Input = function(options, self) {
|
||||||
cursor = [0, 1];
|
cursor = [0, 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (/^0\d/(value)) {
|
while (/^0\d/.test(value)) {
|
||||||
value = value.substr(1, value.length);
|
value = value.substr(1, value.length);
|
||||||
}
|
}
|
||||||
if (!regexp.test(value) || value < self.options.min || value > self.options.max) {
|
if (!regexp.test(value) || value < self.options.min || value > self.options.max) {
|
||||||
|
|
|
@ -1013,7 +1013,6 @@ Ox.Map = function(options, self) {
|
||||||
if (place) {
|
if (place) {
|
||||||
select();
|
select();
|
||||||
} else {
|
} else {
|
||||||
Ox.print()
|
|
||||||
// async && place doesn't exist yet
|
// async && place doesn't exist yet
|
||||||
self.options.places({
|
self.options.places({
|
||||||
keys: self.placeKeys,
|
keys: self.placeKeys,
|
||||||
|
|
12
source/Ox.js
12
source/Ox.js
|
@ -206,7 +206,7 @@ Ox.sort = function(arr, fn) {
|
||||||
values = fn ? arr.map(fn) : arr;
|
values = fn ? arr.map(fn) : arr;
|
||||||
// find leading numbers
|
// find leading numbers
|
||||||
values.forEach(function(val, i) {
|
values.forEach(function(val, i) {
|
||||||
var match = /^\d+/(val);
|
var match = /^\d+/.exec(val);
|
||||||
matches[val] = match ? match[0] : '';
|
matches[val] = match ? match[0] : '';
|
||||||
});
|
});
|
||||||
// get length of longest leading number
|
// get length of longest leading number
|
||||||
|
@ -1462,7 +1462,7 @@ Ox.parseDate <f> Takes a string ('YYYY-MM-DD HH:MM:SS') and returns a date
|
||||||
Ox.parseDate = function(str, utc) {
|
Ox.parseDate = function(str, utc) {
|
||||||
var date = new Date(0),
|
var date = new Date(0),
|
||||||
defaults = [, 1, 1, 0, 0, 0],
|
defaults = [, 1, 1, 0, 0, 0],
|
||||||
values = /(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/(str);
|
values = /(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/.exec(str);
|
||||||
values.shift();
|
values.shift();
|
||||||
values = values.map(function(v, i) {
|
values = values.map(function(v, i) {
|
||||||
return v || defaults[i];
|
return v || defaults[i];
|
||||||
|
@ -1486,7 +1486,7 @@ Ox.parseDateRange = function(start, end, utc) {
|
||||||
'FullYear', 'Month', 'Date', 'Hours', 'Minutes', 'Seconds'
|
'FullYear', 'Month', 'Date', 'Hours', 'Minutes', 'Seconds'
|
||||||
][
|
][
|
||||||
Ox.compact(
|
Ox.compact(
|
||||||
/(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/(end)
|
/(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/.exec(end)
|
||||||
).length - 2
|
).length - 2
|
||||||
];
|
];
|
||||||
Ox['set' + part](dates[1], Ox['get' + part](dates[1], utc) + 1, utc);
|
Ox['set' + part](dates[1], Ox['get' + part](dates[1], utc) + 1, utc);
|
||||||
|
@ -2320,7 +2320,7 @@ Ox.formatDateRange = function(start, end, utc) {
|
||||||
}),
|
}),
|
||||||
parts = range.map(function(str) {
|
parts = range.map(function(str) {
|
||||||
var parts = Ox.compact(
|
var parts = Ox.compact(
|
||||||
/(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/(str)
|
/(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/.exec(str)
|
||||||
);
|
);
|
||||||
parts.shift();
|
parts.shift();
|
||||||
return parts.map(function(part) {
|
return parts.map(function(part) {
|
||||||
|
@ -4151,7 +4151,7 @@ Ox.parsePath <f> Returns the components of a path
|
||||||
{extension: '', filename: '.foo', pathname: ''}
|
{extension: '', filename: '.foo', pathname: ''}
|
||||||
@*/
|
@*/
|
||||||
Ox.parsePath = function(str) {
|
Ox.parsePath = function(str) {
|
||||||
var matches = /^(.+\/)?(.+?(\..+)?)?$/(str);
|
var matches = /^(.+\/)?(.+?(\..+)?)?$/.exec(str);
|
||||||
return {
|
return {
|
||||||
pathname: matches[1] || '',
|
pathname: matches[1] || '',
|
||||||
filename: matches[2] || '',
|
filename: matches[2] || '',
|
||||||
|
@ -4400,7 +4400,7 @@ Ox.words = function(str) {
|
||||||
var arr = str.toLowerCase().split(/\b/),
|
var arr = str.toLowerCase().split(/\b/),
|
||||||
chr = "-'",
|
chr = "-'",
|
||||||
len = arr.length,
|
len = arr.length,
|
||||||
startsWithWord = !!/\w/(arr[0]);
|
startsWithWord = /\w/.test(arr[0]);
|
||||||
arr.forEach(function(v, i) {
|
arr.forEach(function(v, i) {
|
||||||
// find single occurrences of "-" or "-"
|
// find single occurrences of "-" or "-"
|
||||||
// that are not at the beginning or end of the string
|
// that are not at the beginning or end of the string
|
||||||
|
|
Loading…
Reference in a new issue