add support for data annotations

This commit is contained in:
j 2026-01-12 22:30:54 +00:00
commit 8243614546
5 changed files with 77 additions and 34 deletions

View file

@ -1069,10 +1069,16 @@ Ox.VideoAnnotationPanel = function(options, self) {
if (query.length) {
query = query.toLowerCase();
results = self.annotations.filter(function(annotation) {
return Ox.contains(['*', annotation.layer], self.options.findLayer)
&& Ox.decodeHTMLEntities(Ox.stripTags(
annotation.value.toLowerCase()
)).indexOf(query) > -1;
let value = annotation.value
if (!value.toLowerCase && value.toString) {
value = value.toString()
}
if (value.toLowerCase) {
return Ox.contains(['*', annotation.layer], self.options.findLayer)
&& Ox.decodeHTMLEntities(Ox.stripTags(
value.toLowerCase()
)).indexOf(query) > -1;
}
});
}
return results;
@ -1119,6 +1125,9 @@ Ox.VideoAnnotationPanel = function(options, self) {
Ox.forEach(layer.items, function(item) {
if (item.id == annotationId) {
value = item.value;
if (!value.toLowerCase && value.toString) {
value = value.toString()
}
found = true;
return false; // break
}
@ -1276,9 +1285,15 @@ Ox.VideoAnnotationPanel = function(options, self) {
var words = [];
Ox.forEach(Ox.count(Ox.words(
self.annotations.map(function(annotation) {
return Ox.decodeHTMLEntities(
Ox.stripTags(annotation.value.toLowerCase())
);
let value = annotation.value
if (!value.toLowerCase && value.toString) {
value = value.toString()
}
if (value.toLowerCase) {
return Ox.decodeHTMLEntities(
Ox.stripTags(value.toLowerCase())
);
}
}).join(' ')
)), function(count, value) {
words.push({count: count, value: value});
@ -1431,11 +1446,12 @@ Ox.VideoAnnotationPanel = function(options, self) {
position: self.options.position
});
if (self.editing && self.options.selected.length && self.options.selected[0] != '_') {
let value = $('.OxEditableElement input:visible').val()
that.triggerEvent('editannotation', {
id: self.options.selected,
'in': self.options['in'],
out: self.options.out,
value: $('.OxEditableElement input:visible').val()
value: value
});
}
}
@ -1568,6 +1584,9 @@ Ox.VideoAnnotationPanel = function(options, self) {
}
data['in'] = self.options['in'];
data.out = self.options.out;
if (data.layer == 'data' && Ox.isString(data.value)) {
data.value = JSON.parse(data.value)
}
that.triggerEvent('editannotation', data);
}