highlight subtitles as-you-type

This commit is contained in:
rolux 2011-05-17 21:30:49 +02:00
parent 8e8b9c18a4
commit bb6af0ad41

View file

@ -1242,7 +1242,7 @@ Ox.VideoPlayer = function(options, self) {
v['in'] <= self.options.position &&
v.out > self.options.position
) {
subtitle = Ox.highlight(v.text, self.options.find, 'OxHighlight');
subtitle = v.text;
return false;
}
});
@ -1599,13 +1599,18 @@ Ox.VideoPlayer = function(options, self) {
var subtitle = getSubtitle();
if (subtitle != self.subtitle) {
self.subtitle = subtitle;
self.$subtitle.html(
Ox.highlight(self.subtitle, self.options.find, 'Ox.Highlight')
.replace(/\n/g, '<br/>')
);
setSubtitleText();
}
}
function setSubtitleText() {
Ox.print('setSubTx', self.subtitle, self.options.find)
self.$subtitle.html(
Ox.highlight(self.subtitle, self.options.find, 'OxHighlight')
.replace(/\n/g, '<br/>')
);
}
function changeVolumeBy(num) {
self.options.volume = Ox.limit(self.options.volume + num, 0, 1);
setVolume(self.options.volume);
@ -1686,6 +1691,7 @@ Ox.VideoPlayer = function(options, self) {
self.options.find = value;
self.results = find(self.options.find, hasPressedEnter);
self.$results.html(self.results.length);
self.subtitle && setSubtitleText();
self.$timeline && self.$timeline.options({
find: self.options.find,
results: self.results