1
0
Fork 0
forked from 0x2620/oxjs

make find-as-you-type work with both timelines

This commit is contained in:
rolux 2011-05-19 20:34:53 +02:00
commit 1fe6765e8b
2 changed files with 31 additions and 11 deletions

View file

@ -173,8 +173,10 @@ Ox.LargeVideoTimeline = function(options, self) {
function setSubtitles() {
self.$subtitles = [];
self.options.subtitles.forEach(function(subtitle, i) {
var found = self.options.find &&
subtitle.text.toLowerCase().indexOf(self.options.find.toLowerCase()) > -1;
self.$subtitles[i] = $('<div>')
.addClass('OxSubtitle' + (self.options.matches.indexOf(i) > -1 ? ' OxHighlight' : ''))
.addClass('OxSubtitle' + (found ? ' OxHighlight' : ''))
.css({
left: (subtitle['in'] * self.fps) + 'px',
width: (((subtitle.out - subtitle['in']) * self.fps) - 2) + 'px'
@ -215,10 +217,11 @@ Ox.LargeVideoTimeline = function(options, self) {
}
self.setOption = function(key, value) {
if (key == 'in') {
setPointMarker('in');
} else if (key == 'out') {
setPointMarker('out');
if (key == 'find') {
that.find('.OxSubtitle').remove();
setSubtitles();
} else if (key == 'in' || key == 'out') {
setPointMarker(key);
} else if (key == 'position') {
setPosition();
} else if (key == 'subtitles') {