highlight subtitles as-you-type
This commit is contained in:
parent
8e8b9c18a4
commit
bb6af0ad41
1 changed files with 11 additions and 5 deletions
|
@ -1242,7 +1242,7 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
v['in'] <= self.options.position &&
|
v['in'] <= self.options.position &&
|
||||||
v.out > self.options.position
|
v.out > self.options.position
|
||||||
) {
|
) {
|
||||||
subtitle = Ox.highlight(v.text, self.options.find, 'OxHighlight');
|
subtitle = v.text;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1599,13 +1599,18 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
var subtitle = getSubtitle();
|
var subtitle = getSubtitle();
|
||||||
if (subtitle != self.subtitle) {
|
if (subtitle != self.subtitle) {
|
||||||
self.subtitle = subtitle;
|
self.subtitle = subtitle;
|
||||||
self.$subtitle.html(
|
setSubtitleText();
|
||||||
Ox.highlight(self.subtitle, self.options.find, 'Ox.Highlight')
|
|
||||||
.replace(/\n/g, '<br/>')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
function changeVolumeBy(num) {
|
||||||
self.options.volume = Ox.limit(self.options.volume + num, 0, 1);
|
self.options.volume = Ox.limit(self.options.volume + num, 0, 1);
|
||||||
setVolume(self.options.volume);
|
setVolume(self.options.volume);
|
||||||
|
@ -1686,6 +1691,7 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
self.options.find = value;
|
self.options.find = value;
|
||||||
self.results = find(self.options.find, hasPressedEnter);
|
self.results = find(self.options.find, hasPressedEnter);
|
||||||
self.$results.html(self.results.length);
|
self.$results.html(self.results.length);
|
||||||
|
self.subtitle && setSubtitleText();
|
||||||
self.$timeline && self.$timeline.options({
|
self.$timeline && self.$timeline.options({
|
||||||
find: self.options.find,
|
find: self.options.find,
|
||||||
results: self.results
|
results: self.results
|
||||||
|
|
Loading…
Reference in a new issue