update Ox.URL

This commit is contained in:
rlx 2012-01-06 17:28:53 +05:30
commit dc4a8bf464
3 changed files with 38 additions and 41 deletions

View file

@ -82,6 +82,7 @@ Ox.AnnotationPanel = function(options, self) {
self.$annotations = Ox.ArrayEditable({
editable: self.options.editable,
items: getAnnotations(),
selected: self.options.selected,
sort: self.sort,
width: self.options.width,
type: self.options.type == 'text' ? 'textarea' : 'input'
@ -104,20 +105,16 @@ Ox.AnnotationPanel = function(options, self) {
}
self.$annotations.appendTo(that.$content);
/*
self.$annotations = Ox.Element()
.appendTo(that.$content);
self.$annotation = [];
self.options.items.forEach(function(item, i) {
self.$annotation[i] = Ox.Element()
.addClass('OxAnnotation')
.html(item.value.replace(/\n/g, '<br/>'))
.click(function() {
clickAnnotation(i);
})
.appendTo(self.$annotations);
});
*/
Ox.print('SOS', self.options.selected);
self.options.selected && setTimeout(function() {
selectAnnotation({id: self.options.selected});
}, 0);
function editAnnotation(data) {
var item = Ox.getObjectById(self.options.items, data.id);
item.value = data.value;
that.triggerEvent('submit', item);
}
function getAnnotations() {
return self.options.items.filter(function(item) {
@ -128,7 +125,7 @@ Ox.AnnotationPanel = function(options, self) {
) || (
self.options.range == 'position'
&& item['in'] <= self.options.position
&& item.out > self.options.position
&& item.out >= self.options.position
)
});
}
@ -144,12 +141,6 @@ Ox.AnnotationPanel = function(options, self) {
} : {}));
}
function editAnnotation(data) {
var item = Ox.getObjectById(self.options.items, data.id);
item.value = data.value;
that.triggerEvent('submit', item);
}
function togglePanel() {
}

View file

@ -157,6 +157,8 @@ Ox.VideoEditor = function(options, self) {
margin: 8,
});
Ox.print('VIDEO EDITOR OPTIONS', self.options)
self.words = [];
Ox.forEach(Ox.count(Ox.words(self.options.subtitles.map(function(subtitle) {
return subtitle.text;
@ -309,6 +311,8 @@ Ox.VideoEditor = function(options, self) {
self.$annotationPanel = [];
self.options.layers.forEach(function(layer, i) {
var item = Ox.getObjectById(layer.items, self.options.selected),
selected = item ? item.id : '';
self.$annotationPanel[i] = Ox.AnnotationPanel(
Ox.extend({
font: self.options.annotationsFont,
@ -316,7 +320,7 @@ Ox.VideoEditor = function(options, self) {
out: self.options.out,
position: self.options.position,
range: self.options.annotationsRange,
// selected: self.options.selected,
selected: selected,
sort: self.options.annotationsSort,
width: self.options.annotationsSize - Ox.UI.SCROLLBAR_SIZE
}, layer)
@ -338,13 +342,15 @@ Ox.VideoEditor = function(options, self) {
});
},
select: function(data) {
if(data.id) {
if (data.id) {
self.options.layers.forEach(function(layer_, i_) {
if (i_ != i) {
self.$annotationPanel[i_].deselectItems();
}
});
selectAnnotation(data);
} else {
// ...
}
},
submit: editAnnotation
@ -873,9 +879,9 @@ Ox.VideoEditor = function(options, self) {
//Ox.Log('Video', 'getSizes', scrollbarIsVisible, height, self.options.height, size)
return (!scrollbarIsVisible && height > self.options.height - 16) ? getSizes(true) : size;
function getHeight() {
return size.player[0].height + self.controlsHeight +
size.timeline[0].height + lines * 16 +
(lines + 3) * self.margin;
return size.player[0].height + self.controlsHeight
+ size.timeline[0].height + lines * 16
+ (lines + 3) * self.margin;
}
}
@ -930,11 +936,14 @@ Ox.VideoEditor = function(options, self) {
function selectAnnotation(data) {
self.options.annotationsRange != 'position' && setPosition(data['in']);
setState(data.id ? 'selected' : 'default');
that.triggerEvent('select', {
id: data.id || ''
});
if (data.id) {
setPoint('in', data['in']);
setPoint('out', data.out);
}
setState(data.id ? 'selected' : 'default');
}
function select(type) {
@ -942,7 +951,7 @@ Ox.VideoEditor = function(options, self) {
setPoints();
}
function setPoint(point, position) {
function setPoint(point, position, annotation) {
var otherPoint = point == 'in' ? 'out' : 'in';
self.options[point] = position;
if (self.options.state == 'selected') {