From ef82ff896784d0dfee04e9bb14b082fc17904bdb Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Wed, 11 Jan 2012 17:24:58 +0530 Subject: [PATCH] update video editor --- source/Ox.UI/js/Form/Ox.ArrayEditable.js | 17 +++++++++++------ source/Ox.UI/js/Video/Ox.AnnotationPanel.js | 6 +++--- source/Ox.UI/js/Video/Ox.VideoEditor.js | 6 +++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/source/Ox.UI/js/Form/Ox.ArrayEditable.js b/source/Ox.UI/js/Form/Ox.ArrayEditable.js index f55375ae..395dfeae 100644 --- a/source/Ox.UI/js/Form/Ox.ArrayEditable.js +++ b/source/Ox.UI/js/Form/Ox.ArrayEditable.js @@ -37,10 +37,11 @@ Ox.ArrayEditable = function(options, self) { }); self.$items = []; - self.selected = getSelectedPosition(); renderItems(); + self.selected = getSelectedPosition(); + function anyclick(e) { var $target = $(e.target), $parent = $target.parent(), @@ -107,11 +108,8 @@ Ox.ArrayEditable = function(options, self) { function renderItems() { that.empty(); - ( - Ox.isEmpty(self.options.sort) - ? self.options.items - : Ox.sortBy(self.options.items, self.options.sort) - ).forEach(function(item, i) { + sortItems(); + self.options.items.forEach(function(item, i) { i && self.options.type == 'input' && $('') .html(', ') @@ -186,6 +184,13 @@ Ox.ArrayEditable = function(options, self) { self.selected > 0 && selectItem(self.selected - 1); } + function sortItems() { + if (!Ox.isEmpty(self.options.sort)) { + self.options.items = Ox.sortBy(self.options.items, self.options.sort); + self.selected = getSelectedPosition(); + } + } + function submit(position, value) { var item = self.options.items[position]; if (value === '') { diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index 62d96a7e..37d573fb 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -101,7 +101,6 @@ Ox.AnnotationPanel = function(options, self) { } self.$annotations.appendTo(that.$content); - //Ox.print('SOS', self.options.selected); self.options.selected && setTimeout(function() { selectAnnotation({id: self.options.selected}); }, 0); @@ -142,6 +141,7 @@ Ox.AnnotationPanel = function(options, self) { var item = Ox.getObjectById(self.options.items, data.id); item.value = data.value; self.editing = false; + self.$annotations.options({items: self.options.items}); that.triggerEvent('submit', item); } @@ -174,10 +174,10 @@ Ox.AnnotationPanel = function(options, self) { items: getAnnotations() }); } else if (key == 'selected') { - self.$annotations.options('selected', value); + self.$annotations.options({selected: value}); } else if (key == 'sort') { self.sort = getSort(); - self.$annotations.options('sort', self.sort); + self.$annotations.options({sort: self.sort}); } }; diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index aff6235f..a91dbbe0 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -1290,11 +1290,11 @@ Ox.VideoEditor = function(options, self) { function togglePaused() { self.$player[0].togglePaused(); - /* fixme + ///* FIXME self.$player[0].options('paused') && that.triggerEvent('position', { - + position: self.$player[0].options('position') }); - */ + //*/ } function toggleSize() {