From 25930a5d14cfa4497dcead106d27bdb30a102049 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 18 Jul 2013 12:56:19 +0000 Subject: [PATCH] video editor: use Ox.nextValue --- source/Ox.UI/js/Video/VideoEditor.js | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/source/Ox.UI/js/Video/VideoEditor.js b/source/Ox.UI/js/Video/VideoEditor.js index 6e8d912d..d51a3bba 100644 --- a/source/Ox.UI/js/Video/VideoEditor.js +++ b/source/Ox.UI/js/Video/VideoEditor.js @@ -960,7 +960,7 @@ Ox.VideoEditor = function(options, self) { } function getNextAnnotation(type, direction) { - // type can be 'annotation' or 'result + // type can be 'annotation' or 'result' var annotation, annotations = type == 'annotation' ? self.annotations : self.results, index, @@ -984,9 +984,7 @@ Ox.VideoEditor = function(options, self) { // fixme: why not goToNextPosition()? function getNextPosition(type, direction) { // type can be 'annotation', 'cut' or 'result' - var found = false, - position = 0, - positions; + var positions; if (type == 'annotation') { positions = self.positions; } else if (type == 'cut') { @@ -996,23 +994,7 @@ Ox.VideoEditor = function(options, self) { return result['in']; })); } - direction == -1 && positions.reverse(); - Ox.forEach(positions, function(v) { - if ( - direction == 1 - ? v > self.options.position - : v < self.options.position - ) { - position = v; - found = true; - return false; // break - } - }); - direction == -1 && positions.reverse(); - if (!found) { - position = positions[direction == 1 ? 0 : positions.length - 1]; - } - return position; + return Ox.nextValue(positions, self.options.position, direction); } function getPositions() {