1
0
Fork 0
forked from 0x2620/oxjs

misc fixes

This commit is contained in:
rolux 2012-01-02 19:35:14 +05:30
commit b77852296b
7 changed files with 28 additions and 44 deletions

View file

@ -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;
}