use [].slice, not Ox.sub

This commit is contained in:
rolux 2012-05-24 11:02:59 +02:00
parent 915e98f829
commit f990f3b857
7 changed files with 10 additions and 10 deletions

View file

@ -46,7 +46,7 @@ Ox.SourceViewer = function(options, self) {
if (!/^\/\//.test(text)) {
if (type == 'comment') {
i && sections.push({comment: '', code: ''});
text = Ox.sub(text, 2, -2);
text = text.slice(2, -2);
self.options.replaceComment.forEach(function(replace) {
text = text.replace(replace[0], replace[1]);
});

View file

@ -397,7 +397,7 @@ Ox.URL = function(options) {
var ret;
if (condition[0] == '(') {
// re-insert subcondition
ret = parseFind(subconditions[parseInt(Ox.sub(condition, 1, -1))]);
ret = parseFind(subconditions[parseInt(condition.slice(1, -1))]);
} else {
ret = parseCondition(condition);
}

View file

@ -116,7 +116,7 @@ Ox.VideoElement = function(options, self) {
if (Ox.every(item.durations)) {
item.duration = Ox.sum(item.durations);
item.offsets = Ox.range(item.parts).map(function(i) {
return Ox.sum(Ox.sub(item.durations, 0, i));
return Ox.sum(item.durations.slice(0, i));
});
//Ox.Log('Video', 'METADATA OF', src, 'LOADED', item)
if (self.isPlaylist) {

View file

@ -498,8 +498,8 @@ Ox.Dialog = function(options, self) {
buttonsRight,
index = Ox.indexOf(self.options.buttons, Ox.isEmpty);
if (index) {
buttonsLeft = Ox.sub(self.options.buttons, 0, index);
buttonsRight = Ox.sub(self.options.buttons, index + 1);
buttonsLeft = self.options.buttons.slice(0, index);
buttonsRight = self.options.buttons.slice(index + 1);
} else {
buttonsLeft = [];
buttonsRight = self.options.buttons;

View file

@ -214,8 +214,8 @@ Ox.api = function(items, options) {
}
if (options.range) {
// apply range
result.data.items = Ox.sub(
result.data.items, options.range[0], options.range[1]
result.data.items = result.data.items.slice(
options.range[0], options.range[1]
);
}
}

View file

@ -314,7 +314,7 @@
}
};
}
Ox.forEach(Ox.sub(areas, 1), function(parts) {
Ox.forEach(areas.slice(1), function(parts) {
if (ret.length == 1 && parts.length == 1) {
ret = intersect(ret[0], parts[0]);
} else {
@ -383,7 +383,7 @@
});
return ret;
}
Ox.sub(areas, 1).forEach(function(area) {
areas.slice(1).forEach(function(area) {
var index, indices, intersections;
if (area.sw.lat < ret.sw.lat) {
ret.sw.lat = area.sw.lat;

View file

@ -280,7 +280,7 @@ Ox.doc = (function() {
}
});
function unwrap(str) {
return (isArray = /^\[.+\]$/.test(str)) ? Ox.sub(str, 1, -1) : str;
return (isArray = /^\[.+\]$/.test(str)) ? str.slice(1, -1) : str;
}
function wrap(str) {
return isArray ? '[' + str + 's' + ']' : str;