Skip to content

Commit

Permalink
Upstream from videojs-hotkeys/pull/35
Browse files Browse the repository at this point in the history
  • Loading branch information
mehanig committed Oct 4, 2016
1 parent 25ee21e commit 985a749
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions videojs.hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
enableNumbers: true,
enableJogStyle: false,
alwaysCaptureHotkeys: false,
enableModifiersForNumbers: true,
playPauseKey: playPauseKey,
rewindKey: rewindKey,
forwardKey: forwardKey,
Expand Down Expand Up @@ -61,7 +62,8 @@
enableFull = options.enableFullscreen,
enableNumbers = options.enableNumbers,
enableJogStyle = options.enableJogStyle,
alwaysCaptureHotkeys = options.alwaysCaptureHotkeys;
alwaysCaptureHotkeys = options.alwaysCaptureHotkeys,
enableModifiersForNumbers = options.enableModifiersForNumbers;

// Set default player tabindex to handle keydown and doubleclick events
if (!pEl.hasAttribute('tabIndex')) {
Expand Down Expand Up @@ -190,14 +192,17 @@
default:
// Number keys from 0-9 skip to a percentage of the video. 0 is 0% and 9 is 90%
if ((ewhich > 47 && ewhich < 59) || (ewhich > 95 && ewhich < 106)) {
if (enableNumbers) {
var sub = 48;
if (ewhich > 95) {
sub = 96;
// Do not handle if enableModifiersForNumbers set to false and keys are Ctrl, Cmd or Alt
if (enableModifiersForNumbers || !(event.metaKey || event.ctrlKey || event.altKey)) {
if (enableNumbers) {
var sub = 48;
if (ewhich > 95) {
sub = 96;
}
var number = ewhich - sub;
ePreventDefault();
player.currentTime(player.duration() * number * 0.1);
}
var number = ewhich - sub;
ePreventDefault();
player.currentTime(player.duration() * number * 0.1);
}
}

Expand Down

0 comments on commit 985a749

Please sign in to comment.