update video editor

This commit is contained in:
rlx 2012-01-11 17:24:58 +05:30
parent 43d04f242d
commit ef82ff8967
3 changed files with 17 additions and 12 deletions

View file

@ -37,10 +37,11 @@ Ox.ArrayEditable = function(options, self) {
}); });
self.$items = []; self.$items = [];
self.selected = getSelectedPosition();
renderItems(); renderItems();
self.selected = getSelectedPosition();
function anyclick(e) { function anyclick(e) {
var $target = $(e.target), var $target = $(e.target),
$parent = $target.parent(), $parent = $target.parent(),
@ -107,11 +108,8 @@ Ox.ArrayEditable = function(options, self) {
function renderItems() { function renderItems() {
that.empty(); that.empty();
( sortItems();
Ox.isEmpty(self.options.sort) self.options.items.forEach(function(item, i) {
? self.options.items
: Ox.sortBy(self.options.items, self.options.sort)
).forEach(function(item, i) {
i && self.options.type == 'input' i && self.options.type == 'input'
&& $('<span>') && $('<span>')
.html(', ') .html(', ')
@ -186,6 +184,13 @@ Ox.ArrayEditable = function(options, self) {
self.selected > 0 && selectItem(self.selected - 1); 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) { function submit(position, value) {
var item = self.options.items[position]; var item = self.options.items[position];
if (value === '') { if (value === '') {

View file

@ -101,7 +101,6 @@ Ox.AnnotationPanel = function(options, self) {
} }
self.$annotations.appendTo(that.$content); self.$annotations.appendTo(that.$content);
//Ox.print('SOS', self.options.selected);
self.options.selected && setTimeout(function() { self.options.selected && setTimeout(function() {
selectAnnotation({id: self.options.selected}); selectAnnotation({id: self.options.selected});
}, 0); }, 0);
@ -142,6 +141,7 @@ Ox.AnnotationPanel = function(options, self) {
var item = Ox.getObjectById(self.options.items, data.id); var item = Ox.getObjectById(self.options.items, data.id);
item.value = data.value; item.value = data.value;
self.editing = false; self.editing = false;
self.$annotations.options({items: self.options.items});
that.triggerEvent('submit', item); that.triggerEvent('submit', item);
} }
@ -174,10 +174,10 @@ Ox.AnnotationPanel = function(options, self) {
items: getAnnotations() items: getAnnotations()
}); });
} else if (key == 'selected') { } else if (key == 'selected') {
self.$annotations.options('selected', value); self.$annotations.options({selected: value});
} else if (key == 'sort') { } else if (key == 'sort') {
self.sort = getSort(); self.sort = getSort();
self.$annotations.options('sort', self.sort); self.$annotations.options({sort: self.sort});
} }
}; };

View file

@ -1290,11 +1290,11 @@ Ox.VideoEditor = function(options, self) {
function togglePaused() { function togglePaused() {
self.$player[0].togglePaused(); self.$player[0].togglePaused();
/* fixme ///* FIXME
self.$player[0].options('paused') && that.triggerEvent('position', { self.$player[0].options('paused') && that.triggerEvent('position', {
position: self.$player[0].options('position')
}); });
*/ //*/
} }
function toggleSize() { function toggleSize() {