limit highlight to layer
This commit is contained in:
parent
03ba57f2b8
commit
8b14537dce
2 changed files with 61 additions and 14 deletions
|
@ -9,6 +9,7 @@ Ox.AnnotationPanel <f> Video Annotation Panel
|
||||||
clickLink <f|null> click link callback
|
clickLink <f|null> click link callback
|
||||||
editable <b|false> if true, annotations can be edited
|
editable <b|false> if true, annotations can be edited
|
||||||
highlight <s|''> highlight given string in annotations
|
highlight <s|''> highlight given string in annotations
|
||||||
|
highlightLayer <s|'*'> limit highlight to specific layer
|
||||||
layers <a|[]> array with annotation objects
|
layers <a|[]> array with annotation objects
|
||||||
mapSize <n|256> map size
|
mapSize <n|256> map size
|
||||||
range <s|'all'> all, position, selection
|
range <s|'all'> all, position, selection
|
||||||
|
@ -50,6 +51,7 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
enableExport: false,
|
enableExport: false,
|
||||||
enableImport: false,
|
enableImport: false,
|
||||||
highlight: '',
|
highlight: '',
|
||||||
|
highlightLayer: '*',
|
||||||
itemName: {singular: 'video', plural: 'videos'},
|
itemName: {singular: 'video', plural: 'videos'},
|
||||||
layers: [],
|
layers: [],
|
||||||
mapSize: 256,
|
mapSize: 256,
|
||||||
|
@ -64,9 +66,11 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
})
|
})
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
.update(function(key, value) {
|
.update(function(key, value) {
|
||||||
if (key == 'highlight') {
|
if (key == 'highlight' || key == 'highlightLayer') {
|
||||||
self.$folder.forEach(function($folder) {
|
self.$folder.forEach(function($folder) {
|
||||||
$folder.options({highlight: value});
|
$folder.options({
|
||||||
|
highlight: getHighlight($folder.options('id'))
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else if (['in', 'out', 'position'].indexOf(key) > -1) {
|
} else if (['in', 'out', 'position'].indexOf(key) > -1) {
|
||||||
self.$folder.forEach(function($folder) {
|
self.$folder.forEach(function($folder) {
|
||||||
|
@ -77,7 +81,8 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
} else if (key == 'selected') {
|
} else if (key == 'selected') {
|
||||||
self.options.editable && updateEditMenu();
|
self.options.editable && updateEditMenu();
|
||||||
if (value) {
|
if (value) {
|
||||||
getFolder(value).options({selected: value});
|
var folder = getFolder(value)
|
||||||
|
folder && folder.options({selected: value});
|
||||||
} else {
|
} else {
|
||||||
self.$folder.forEach(function($folder) {
|
self.$folder.forEach(function($folder) {
|
||||||
$folder.options({selected: ''});
|
$folder.options({selected: ''});
|
||||||
|
@ -179,6 +184,10 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getHighlight(layer) {
|
||||||
|
return Ox.contains(['*', layer], self.options.highlightLayer) ? self.options.highlight : '';
|
||||||
|
}
|
||||||
|
|
||||||
function getLanguages() {
|
function getLanguages() {
|
||||||
return Ox.sortBy(Ox.map(Ox.unique(Ox.flatten(
|
return Ox.sortBy(Ox.map(Ox.unique(Ox.flatten(
|
||||||
self.options.layers.map(function(layer) {
|
self.options.layers.map(function(layer) {
|
||||||
|
@ -354,7 +363,7 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
clickLink: self.options.clickLink,
|
clickLink: self.options.clickLink,
|
||||||
collapsed: !self.options.showLayers[layer.id],
|
collapsed: !self.options.showLayers[layer.id],
|
||||||
editable: self.options.editable,
|
editable: self.options.editable,
|
||||||
highlight: self.options.highlight,
|
highlight: getHighlight(layer.id),
|
||||||
id: layer.id,
|
id: layer.id,
|
||||||
'in': self.options['in'],
|
'in': self.options['in'],
|
||||||
keyboard: index < 9 ? index + 1 + '' : '',
|
keyboard: index < 9 ? index + 1 + '' : '',
|
||||||
|
|
|
@ -19,6 +19,7 @@ Ox.VideoAnnotationPanel <f> VideoAnnotationPanel Object
|
||||||
embedselection <!> embedselection
|
embedselection <!> embedselection
|
||||||
findannotations <!> findannotations
|
findannotations <!> findannotations
|
||||||
find <!> find
|
find <!> find
|
||||||
|
findLayer <s|*> limit find to layer
|
||||||
importannotations <!> importannotations
|
importannotations <!> importannotations
|
||||||
info <!> info
|
info <!> info
|
||||||
key_* <!> key_*
|
key_* <!> key_*
|
||||||
|
@ -66,6 +67,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
enableSetPosterFrame: false,
|
enableSetPosterFrame: false,
|
||||||
enableSubtitles: false,
|
enableSubtitles: false,
|
||||||
find: '',
|
find: '',
|
||||||
|
findLayer: '*',
|
||||||
fps: 25,
|
fps: 25,
|
||||||
getFrameURL: null,
|
getFrameURL: null,
|
||||||
getLargeTimelineURL: null,
|
getLargeTimelineURL: null,
|
||||||
|
@ -409,7 +411,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
enablePosition: true,
|
enablePosition: true,
|
||||||
enableSubtitles: self.options.enableSubtitles,
|
enableSubtitles: self.options.enableSubtitles,
|
||||||
externalControls: true,
|
externalControls: true,
|
||||||
find: self.options.find,
|
find: getSubtitlesFind(),
|
||||||
height: self.sizes.player[i].height,
|
height: self.sizes.player[i].height,
|
||||||
id: 'player' + Ox.toTitleCase(type),
|
id: 'player' + Ox.toTitleCase(type),
|
||||||
'in': self.options['in'],
|
'in': self.options['in'],
|
||||||
|
@ -495,7 +497,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
self.$timeline[0] = Ox.LargeVideoTimeline({
|
self.$timeline[0] = Ox.LargeVideoTimeline({
|
||||||
cuts: self.options.cuts,
|
cuts: self.options.cuts,
|
||||||
duration: self.options.duration,
|
duration: self.options.duration,
|
||||||
find: self.options.find,
|
find: getSubtitlesFind(),
|
||||||
getImageURL: self.options.getLargeTimelineURL,
|
getImageURL: self.options.getLargeTimelineURL,
|
||||||
id: 'timelineLarge',
|
id: 'timelineLarge',
|
||||||
'in': self.options['in'],
|
'in': self.options['in'],
|
||||||
|
@ -523,7 +525,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
self.$timeline[1] = Ox.BlockVideoTimeline({
|
self.$timeline[1] = Ox.BlockVideoTimeline({
|
||||||
cuts: self.options.cuts,
|
cuts: self.options.cuts,
|
||||||
duration: self.options.duration,
|
duration: self.options.duration,
|
||||||
find: self.options.find,
|
find: getSubtitlesFind(),
|
||||||
getImageURL: self.options.getSmallTimelineURL,
|
getImageURL: self.options.getSmallTimelineURL,
|
||||||
id: 'timelineSmall',
|
id: 'timelineSmall',
|
||||||
'in': self.options['in'],
|
'in': self.options['in'],
|
||||||
|
@ -789,6 +791,28 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
})
|
})
|
||||||
.appendTo(self.$menubar);
|
.appendTo(self.$menubar);
|
||||||
|
|
||||||
|
self.$findLayerSelect = Ox.Select({
|
||||||
|
items: [
|
||||||
|
{id: '*', title: Ox._('Find: {0}', [Ox._('All')])},
|
||||||
|
].concat(self.options.layers.map(function(layer) {
|
||||||
|
return {
|
||||||
|
id: layer.id,
|
||||||
|
title: Ox._('Find: {0}', [Ox._(layer.title)])
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
value: self.options.findLayer,
|
||||||
|
width: 128,
|
||||||
|
overlap: 'right',
|
||||||
|
})
|
||||||
|
.css({float: 'right', background: 'transparent'})
|
||||||
|
.bindEvent({
|
||||||
|
change: function(data) {
|
||||||
|
self.options.findLayer = data.value;
|
||||||
|
submitFindInput(self.$findInput.value(), false);
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.appendTo(self.$menubar);
|
||||||
|
|
||||||
self.$nextButton = Ox.Button({
|
self.$nextButton = Ox.Button({
|
||||||
disabled: true,
|
disabled: true,
|
||||||
style: 'symbol',
|
style: 'symbol',
|
||||||
|
@ -832,6 +856,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
enableExport: self.options.enableExport,
|
enableExport: self.options.enableExport,
|
||||||
enableImport: self.options.enableImport,
|
enableImport: self.options.enableImport,
|
||||||
highlight: self.options.find,
|
highlight: self.options.find,
|
||||||
|
highlightLayer: self.options.findLayer,
|
||||||
'in': self.options['in'],
|
'in': self.options['in'],
|
||||||
itemName: self.options.itemName,
|
itemName: self.options.itemName,
|
||||||
layers: self.options.layers,
|
layers: self.options.layers,
|
||||||
|
@ -1032,7 +1057,8 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
if (query.length) {
|
if (query.length) {
|
||||||
query = query.toLowerCase();
|
query = query.toLowerCase();
|
||||||
results = self.annotations.filter(function(annotation) {
|
results = self.annotations.filter(function(annotation) {
|
||||||
return Ox.decodeHTMLEntities(Ox.stripTags(
|
return Ox.contains(['*', annotation.layer], self.options.findLayer)
|
||||||
|
&& Ox.decodeHTMLEntities(Ox.stripTags(
|
||||||
annotation.value.toLowerCase()
|
annotation.value.toLowerCase()
|
||||||
)).indexOf(query) > -1;
|
)).indexOf(query) > -1;
|
||||||
});
|
});
|
||||||
|
@ -1069,7 +1095,9 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
|
|
||||||
function getAnnotations() {
|
function getAnnotations() {
|
||||||
return Ox.flatten(self.options.layers.map(function(layer) {
|
return Ox.flatten(self.options.layers.map(function(layer) {
|
||||||
return layer.items;
|
return layer.items.map(function(item) {
|
||||||
|
return Ox.extend({layer: layer.id}, item)
|
||||||
|
});
|
||||||
})).sort(sortAnnotations);
|
})).sort(sortAnnotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1226,6 +1254,12 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSubtitlesFind() {
|
||||||
|
return Ox.contains(
|
||||||
|
[self.options.subtitlesLayer, '*'], self.options.findLayer
|
||||||
|
) ? self.options.find : '';
|
||||||
|
}
|
||||||
|
|
||||||
function getWords() {
|
function getWords() {
|
||||||
var words = [];
|
var words = [];
|
||||||
Ox.forEach(Ox.count(Ox.words(
|
Ox.forEach(Ox.count(Ox.words(
|
||||||
|
@ -1542,11 +1576,12 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
self.$clearButton.options({
|
self.$clearButton.options({
|
||||||
disabled: !self.options.find
|
disabled: !self.options.find
|
||||||
});
|
});
|
||||||
|
|
||||||
self.$player.forEach(function($player) {
|
self.$player.forEach(function($player) {
|
||||||
$player.options({find: self.options.find});
|
$player.options({find: getSubtitlesFind()});
|
||||||
});
|
});
|
||||||
self.$timeline.forEach(function($timeline) {
|
self.$timeline.forEach(function($timeline) {
|
||||||
$timeline.options({find: self.options.find});
|
$timeline.options({find: getSubtitlesFind()});
|
||||||
});
|
});
|
||||||
self.$timeline[1].options({results: self.results});
|
self.$timeline[1].options({results: self.results});
|
||||||
if (hasPressedEnter) {
|
if (hasPressedEnter) {
|
||||||
|
@ -1558,7 +1593,10 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
self.$findInput.focusInput(true);
|
self.$findInput.focusInput(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.$annotationPanel.options({highlight: self.options.find});
|
self.$annotationPanel.options({
|
||||||
|
highlight: self.options.find,
|
||||||
|
highlightLayer: self.options.findLayer,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleAnnotations(data) {
|
function toggleAnnotations(data) {
|
||||||
|
|
Loading…
Reference in a new issue