allow for grouped highlights in video annotations

This commit is contained in:
rolux 2018-10-09 18:29:13 +02:00
commit a5f7dd720a
5 changed files with 107 additions and 46 deletions

View file

@ -38,6 +38,7 @@ Ox.AnnotationFolder = function(options, self) {
collapsed: false,
editable: false,
highlight: '',
highlightAnnotations: false,
id: '',
'in': 0,
item: '',
@ -64,6 +65,10 @@ Ox.AnnotationFolder = function(options, self) {
if (key == 'highlight') {
self.$annotations.options({highlight: value});
}
if (key == 'highlightAnnotations') {
self.$annotations.options({highlightGroup: value});
updateAnnotations();
}
if (['in', 'out'].indexOf(key) > -1 && self.editing) {
var item = Ox.getObjectById(self.options.items, self.options.selected);
item[key] = value;
@ -282,6 +287,7 @@ Ox.AnnotationFolder = function(options, self) {
: null,
globalAttributes: ['data', 'lang'],
highlight: self.options.translate ? Ox._(self.options.highlight) : self.options.highlight,
highlightGroup: self.options.highlightAnnotations,
placeholder: Ox._('Loading...'),
separator: self.options.separator,
sort: self.sort,
@ -400,7 +406,6 @@ Ox.AnnotationFolder = function(options, self) {
});
});
showWarnings();
function changeAnnotation(data) {
@ -472,6 +477,10 @@ Ox.AnnotationFolder = function(options, self) {
|| self.options.users.indexOf(item.user) > -1
)
);
}).map(function(item) {
return Ox.extend(item, {
group: item['in'] + '-' + item.out
});
});
return annotations;
}
@ -658,7 +667,9 @@ Ox.AnnotationFolder = function(options, self) {
self.options.items.splice(pos, 0, item);
self.$panel.options({collapsed: false});
self.$annotations
.addItem(pos, item)
.addItem(pos, Ox.extend(item, {
group: item['in'] + '-' + item.out
}))
.options({selected: item.id})
.editItem();
showWarnings();
@ -735,6 +746,10 @@ Ox.AnnotationFolder = function(options, self) {
Ox.forEach(data, function(value, key) {
item[key] = value;
});
item.group = item['in'] + '-' + item.out;
if (self.options.highlightAnnotations) {
self.$annotations.updateItemGroup();
}
if (id != item.id) {
self.$annotations.find('.OxEditableElement').each(function() {
var $element = $(this);