forked from 0x2620/oxjs
misc fixes
This commit is contained in:
parent
7ca9a4a9e7
commit
b77852296b
7 changed files with 28 additions and 44 deletions
|
|
@ -367,13 +367,7 @@ Ox.URL = function(options) {
|
|||
}
|
||||
|
||||
function parseDuration(str) {
|
||||
var parts = str.split(':').reverse();
|
||||
while (parts.length > 3) {
|
||||
parts.pop();
|
||||
}
|
||||
return parts.reduce(function(prev, curr, i) {
|
||||
return prev + (parseFloat(curr) || 0) * Math.pow(60, i);
|
||||
}, 0);
|
||||
return Ox.parseDuration(str);
|
||||
}
|
||||
|
||||
function parseFind(str) {
|
||||
|
|
@ -445,16 +439,6 @@ Ox.URL = function(options) {
|
|||
);
|
||||
}
|
||||
|
||||
function parseTime(str) {
|
||||
var split = str.split(':').reverse();
|
||||
while (split.length > 3) {
|
||||
split.pop();
|
||||
}
|
||||
return Ox.formatDuration(split.reduce(function(prev, curr, i) {
|
||||
return prev + (parseFloat(curr) || 0) * Math.pow(60, i);
|
||||
}, 0));
|
||||
}
|
||||
|
||||
function parseURL(str, callback) {
|
||||
// fixme: removing trailing slash makes it impossible to search for '/'
|
||||
str = str.replace(/(^\/|\/$)/g, '');
|
||||
|
|
@ -633,7 +617,7 @@ Ox.URL = function(options) {
|
|||
} else if (type == 'integer') {
|
||||
value = Math.round(str) || 0;
|
||||
} else if (type == 'time') {
|
||||
value = parseTime(value);
|
||||
value = Ox.formatDurarion(Ox.parseDuration(value));
|
||||
} else if (type == 'year') {
|
||||
value = Math.round(str) || 1970;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue