forked from 0x2620/oxjs
resolve focus issues with video player find element
This commit is contained in:
parent
6480bddd4f
commit
ec7ec4d707
4 changed files with 48 additions and 35 deletions
|
|
@ -86,6 +86,9 @@ Ox.VideoPanelPlayer = function(options, self) {
|
|||
width: getPlayerWidth()
|
||||
})
|
||||
.bindEvent({
|
||||
find: function(data) {
|
||||
self.$timeline.options({find: data.find});
|
||||
},
|
||||
position: setPosition,
|
||||
muted: function(data) {
|
||||
that.triggerEvent('muted', data);
|
||||
|
|
|
|||
|
|
@ -224,7 +224,15 @@ Ox.VideoPlayer = function(options, self) {
|
|||
});
|
||||
} else {
|
||||
that.bind({
|
||||
click: that.gainFocus
|
||||
click: function() {
|
||||
var focused = Ox.Focus.focused();
|
||||
if (
|
||||
!focused
|
||||
|| !Ox.UI.elements[focused].is('.OxInput')
|
||||
) {
|
||||
that.gainFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1427,19 +1435,24 @@ Ox.VideoPlayer = function(options, self) {
|
|||
function goToNextResult(direction) {
|
||||
var found = false,
|
||||
position = 0;
|
||||
direction == -1 && self.results.reverse();
|
||||
Ox.forEach(self.results, function(v) {
|
||||
if (direction == 1 ? v['in'] > self.options.position : v.out < self.options.position) {
|
||||
position = v['in'];
|
||||
found = true;
|
||||
return false;
|
||||
if (self.results.length) {
|
||||
direction == -1 && self.results.reverse();
|
||||
Ox.forEach(self.results, function(v) {
|
||||
if (direction == 1 ? v['in'] > self.options.position : v.out < self.options.position) {
|
||||
position = v['in'];
|
||||
found = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
direction == -1 && self.results.reverse();
|
||||
if (!found) {
|
||||
position = self.results[direction == 1 ? 0 : self.results.length - 1]['in'];
|
||||
}
|
||||
});
|
||||
direction == -1 && self.results.reverse();
|
||||
if (!found) {
|
||||
position = self.results[direction == 1 ? 0 : self.results.length - 1]['in'];
|
||||
setPosition(position + self.secondsPerFrame);
|
||||
that.triggerEvent('position', {
|
||||
position: self.options.position
|
||||
});
|
||||
}
|
||||
setPosition(position + self.secondsPerFrame);
|
||||
}
|
||||
|
||||
function goToPoint() {
|
||||
|
|
@ -1956,10 +1969,8 @@ Ox.VideoPlayer = function(options, self) {
|
|||
}
|
||||
|
||||
function submitFindInput(value, hasPressedEnter) {
|
||||
//Ox.print('submitFindInput', value, hasPressedEnter)
|
||||
self.options.find = value;
|
||||
self.results = find(self.options.find);
|
||||
//Ox.print('results', self.results.length);
|
||||
if (self.$find) {
|
||||
self.$results.html(self.results.length);
|
||||
self.$previousResultButton.options({
|
||||
|
|
@ -1980,6 +1991,7 @@ Ox.VideoPlayer = function(options, self) {
|
|||
if (hasPressedEnter) {
|
||||
self.results.length ? goToNextResult(1) : self.$findInput.focusInput();
|
||||
}
|
||||
that.triggerEvent('find', {find: self.options.find});
|
||||
}
|
||||
|
||||
function submitPositionInput() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue