videojs-hotkeys
Advanced tools
Comparing version 0.2.12 to 0.2.13
@@ -1,3 +0,3 @@ | ||
/* videojs-hotkeys v0.2.12 - https://github.com/ctd1500/videojs-hotkeys */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b.bind(this,a,a.videojs)):"undefined"!=typeof module&&module.exports?module.exports=b(a,a.videojs):b(a,a.videojs)}(window,function(a,b){"use strict";a.videojs_hotkeys={version:"0.2.12"};var c=function(c){function d(a){return 32===a.which}function e(a){return 37===a.which}function f(a){return 39===a.which}function g(a){return 38===a.which}function h(a){return 40===a.which}function i(a){return 77===a.which}function j(a){return 70===a.which}var k=this,l=k.el(),m={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,playPauseKey:d,rewindKey:e,forwardKey:f,volumeUpKey:g,volumeDownKey:h,muteKey:i,fullscreenKey:j,customKeys:{}},n=1,o=2,p=3,q=4,r=5,s=6,t=7,u=b.mergeOptions||b.util.mergeOptions;c=u(m,c||{});var v=c.volumeStep,w=c.seekStep,x=c.enableMute,y=c.enableVolumeScroll,z=c.enableFullscreen,A=c.enableNumbers,B=c.enableJogStyle,C=c.alwaysCaptureHotkeys;l.hasAttribute("tabIndex")||l.setAttribute("tabIndex","-1"),C&&k.one("play",function(){l.focus()}),k.on("play",function(){var a=l.querySelector(".iframeblocker");a&&""===a.style.display&&(a.style.display="block",a.style.bottom="39px")});var D=function(a){var b,d=a.which,e=a.preventDefault;if(k.controls()){var f=document.activeElement;if(C||f==l||f==l.querySelector(".vjs-tech")||f==l.querySelector(".vjs-control-bar")||f==l.querySelector(".iframeblocker"))switch(G(a,k)){case n:e(),C&&a.stopPropagation(),k.paused()?k.play():k.pause();break;case o:e(),b=k.currentTime()-w,k.currentTime()<=w&&(b=0),k.currentTime(b);break;case p:e(),k.currentTime(k.currentTime()+w);break;case r:e(),B?(b=k.currentTime()-1,k.currentTime()<=1&&(b=0),k.currentTime(b)):k.volume(k.volume()-v);break;case q:e(),B?k.currentTime(k.currentTime()+1):k.volume(k.volume()+v);break;case s:x&&k.muted(!k.muted());break;case t:z&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen());break;default:if((d>47&&59>d||d>95&&106>d)&&A){var g=48;d>95&&(g=96);var h=d-g;e(),k.currentTime(k.duration()*h*.1)}for(var i in c.customKeys){var j=c.customKeys[i];j&&j.key&&j.handler&&j.key(a)&&(e(),j.handler(k,c))}}}},E=function(a){if(k.controls()){var b=a.relatedTarget||a.toElement||document.activeElement;(b==l||b==l.querySelector(".vjs-tech")||b==l.querySelector(".iframeblocker"))&&z&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen())}},F=function(b){if(k.controls()){var c=b.relatedTarget||b.toElement||document.activeElement;if((C||c==l||c==l.querySelector(".vjs-tech")||c==l.querySelector(".iframeblocker")||c==l.querySelector(".vjs-control-bar"))&&y){b=a.event||b;var d=Math.max(-1,Math.min(1,b.wheelDelta||-b.detail));b.preventDefault(),1==d?k.volume(k.volume()+v):-1==d&&k.volume(k.volume()-v)}}},G=function(a,b){return c.playPauseKey(a,b)?n:c.rewindKey(a,b)?o:c.forwardKey(a,b)?p:c.volumeUpKey(a,b)?q:c.volumeDownKey(a,b)?r:c.muteKey(a,b)?s:c.fullscreenKey(a,b)?t:void 0};return k.on("keydown",D),k.on("dblclick",E),k.on("mousewheel",F),k.on("DOMMouseScroll",F),this};b.plugin("hotkeys",c)}); | ||
/* videojs-hotkeys v0.2.13 - https://github.com/ctd1500/videojs-hotkeys */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b.bind(this,a,a.videojs)):"undefined"!=typeof module&&module.exports?module.exports=b(a,a.videojs):b(a,a.videojs)}(window,function(a,b){"use strict";a.videojs_hotkeys={version:"0.2.13"};var c=function(c){function d(a){return 32===a.which}function e(a){return 37===a.which}function f(a){return 39===a.which}function g(a){return 38===a.which}function h(a){return 40===a.which}function i(a){return 77===a.which}function j(a){return 70===a.which}var k=this,l=k.el(),m=document,n={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,playPauseKey:d,rewindKey:e,forwardKey:f,volumeUpKey:g,volumeDownKey:h,muteKey:i,fullscreenKey:j,customKeys:{}},o=1,p=2,q=3,r=4,s=5,t=6,u=7,v=b.mergeOptions||b.util.mergeOptions;c=v(n,c||{});var w=c.volumeStep,x=c.seekStep,y=c.enableMute,z=c.enableVolumeScroll,A=c.enableFullscreen,B=c.enableNumbers,C=c.enableJogStyle,D=c.alwaysCaptureHotkeys;l.hasAttribute("tabIndex")||l.setAttribute("tabIndex","-1"),D&&k.one("play",function(){l.focus()}),k.on("userinactive",function(){var a=function(){clearTimeout(b)},b=setTimeout(function(){k.off("useractive",a),m.activeElement.parentElement==l.querySelector(".vjs-control-bar")&&l.focus()},10);k.one("useractive",a)}),k.on("play",function(){var a=l.querySelector(".iframeblocker");a&&""===a.style.display&&(a.style.display="block",a.style.bottom="39px")});var E=function(a){var b,d=a.which,e=a.preventDefault;if(k.controls()){var f=m.activeElement;if(D||f==l||f==l.querySelector(".vjs-tech")||f==l.querySelector(".vjs-control-bar")||f==l.querySelector(".iframeblocker"))switch(H(a,k)){case o:e(),D&&a.stopPropagation(),k.paused()?k.play():k.pause();break;case p:e(),b=k.currentTime()-x,k.currentTime()<=x&&(b=0),k.currentTime(b);break;case q:e(),k.currentTime(k.currentTime()+x);break;case s:e(),C?(b=k.currentTime()-1,k.currentTime()<=1&&(b=0),k.currentTime(b)):k.volume(k.volume()-w);break;case r:e(),C?k.currentTime(k.currentTime()+1):k.volume(k.volume()+w);break;case t:y&&k.muted(!k.muted());break;case u:A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen());break;default:if((d>47&&59>d||d>95&&106>d)&&B){var g=48;d>95&&(g=96);var h=d-g;e(),k.currentTime(k.duration()*h*.1)}for(var i in c.customKeys){var j=c.customKeys[i];j&&j.key&&j.handler&&j.key(a)&&(e(),j.handler(k,c))}}}},F=function(a){if(k.controls()){var b=a.relatedTarget||a.toElement||m.activeElement;(b==l||b==l.querySelector(".vjs-tech")||b==l.querySelector(".iframeblocker"))&&A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen())}},G=function(b){if(k.controls()){var c=b.relatedTarget||b.toElement||m.activeElement;if((D||c==l||c==l.querySelector(".vjs-tech")||c==l.querySelector(".iframeblocker")||c==l.querySelector(".vjs-control-bar"))&&z){b=a.event||b;var d=Math.max(-1,Math.min(1,b.wheelDelta||-b.detail));b.preventDefault(),1==d?k.volume(k.volume()+w):-1==d&&k.volume(k.volume()-w)}}},H=function(a,b){return c.playPauseKey(a,b)?o:c.rewindKey(a,b)?p:c.forwardKey(a,b)?q:c.volumeUpKey(a,b)?r:c.volumeDownKey(a,b)?s:c.muteKey(a,b)?t:c.fullscreenKey(a,b)?u:void 0};return k.on("keydown",E),k.on("dblclick",F),k.on("mousewheel",G),k.on("DOMMouseScroll",G),this};b.plugin("hotkeys",c)}); | ||
//# sourceMappingURL=videojs.hotkeys.min.js.map |
{ | ||
"name": "videojs-hotkeys", | ||
"version": "0.2.12", | ||
"version": "0.2.13", | ||
"description": "Adds more hotkey support to video.js", | ||
@@ -18,7 +18,7 @@ "main": "videojs.hotkeys.min.js", | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-clean": "^0.6.0", | ||
"grunt-contrib-copy": "^0.6.0", | ||
"grunt-contrib-uglify": "^0.9.1", | ||
"grunt-zip": "^0.16.0" | ||
"grunt-contrib-clean": "^0.7.0", | ||
"grunt-contrib-copy": "^0.8.0", | ||
"grunt-contrib-uglify": "^0.11.0", | ||
"grunt-zip": "^0.17.0" | ||
} | ||
} |
@@ -114,3 +114,3 @@ videojs-hotkeys | ||
// override fullscreen to trigger when pressing the F key or Ctrl+Enter | ||
return ((e.which === 70) || (e.ctrlKey && e.which === 13)); | ||
return ((event.which === 70) || (event.ctrlKey && event.which === 13)); | ||
} | ||
@@ -117,0 +117,0 @@ }); |
@@ -20,3 +20,3 @@ /* | ||
"use strict"; | ||
window['videojs_hotkeys'] = { version: "0.2.12" }; | ||
window['videojs_hotkeys'] = { version: "0.2.13" }; | ||
@@ -26,2 +26,3 @@ var hotkeys = function(options) { | ||
var pEl = player.el(); | ||
var doc = document; | ||
var def_options = { | ||
@@ -78,2 +79,17 @@ volumeStep: 0.1, | ||
player.on('userinactive', function() { | ||
// When the control bar fades, re-apply focus to the player if last focus was a control button | ||
var cancelFocusingPlayer = function() { | ||
clearTimeout(focusingPlayerTimeout); | ||
}; | ||
var focusingPlayerTimeout = setTimeout(function() { | ||
player.off('useractive', cancelFocusingPlayer); | ||
if (doc.activeElement.parentElement == pEl.querySelector('.vjs-control-bar')) { | ||
pEl.focus(); | ||
} | ||
}, 10); | ||
player.one('useractive', cancelFocusingPlayer); | ||
}); | ||
player.on('play', function() { | ||
@@ -95,3 +111,3 @@ // Fix allowing the YouTube plugin to have hotkey support. | ||
// Don't catch keys if any control buttons are focused, unless alwaysCaptureHotkeys is true | ||
var activeEl = document.activeElement; | ||
var activeEl = doc.activeElement; | ||
if (alwaysCaptureHotkeys || | ||
@@ -212,3 +228,3 @@ activeEl == pEl || | ||
// Don't catch clicks if any control buttons are focused | ||
var activeEl = event.relatedTarget || event.toElement || document.activeElement; | ||
var activeEl = event.relatedTarget || event.toElement || doc.activeElement; | ||
if (activeEl == pEl || | ||
@@ -232,3 +248,3 @@ activeEl == pEl.querySelector('.vjs-tech') || | ||
if (player.controls()) { | ||
var activeEl = event.relatedTarget || event.toElement || document.activeElement; | ||
var activeEl = event.relatedTarget || event.toElement || doc.activeElement; | ||
if (alwaysCaptureHotkeys || | ||
@@ -235,0 +251,0 @@ activeEl == pEl || |
@@ -1,2 +0,2 @@ | ||
/* videojs-hotkeys v0.2.12 - https://github.com/ctd1500/videojs-hotkeys */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b.bind(this,a,a.videojs)):"undefined"!=typeof module&&module.exports?module.exports=b(a,a.videojs):b(a,a.videojs)}(window,function(a,b){"use strict";a.videojs_hotkeys={version:"0.2.12"};var c=function(c){function d(a){return 32===a.which}function e(a){return 37===a.which}function f(a){return 39===a.which}function g(a){return 38===a.which}function h(a){return 40===a.which}function i(a){return 77===a.which}function j(a){return 70===a.which}var k=this,l=k.el(),m={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,playPauseKey:d,rewindKey:e,forwardKey:f,volumeUpKey:g,volumeDownKey:h,muteKey:i,fullscreenKey:j,customKeys:{}},n=1,o=2,p=3,q=4,r=5,s=6,t=7,u=b.mergeOptions||b.util.mergeOptions;c=u(m,c||{});var v=c.volumeStep,w=c.seekStep,x=c.enableMute,y=c.enableVolumeScroll,z=c.enableFullscreen,A=c.enableNumbers,B=c.enableJogStyle,C=c.alwaysCaptureHotkeys;l.hasAttribute("tabIndex")||l.setAttribute("tabIndex","-1"),C&&k.one("play",function(){l.focus()}),k.on("play",function(){var a=l.querySelector(".iframeblocker");a&&""===a.style.display&&(a.style.display="block",a.style.bottom="39px")});var D=function(a){var b,d=a.which,e=a.preventDefault;if(k.controls()){var f=document.activeElement;if(C||f==l||f==l.querySelector(".vjs-tech")||f==l.querySelector(".vjs-control-bar")||f==l.querySelector(".iframeblocker"))switch(G(a,k)){case n:e(),C&&a.stopPropagation(),k.paused()?k.play():k.pause();break;case o:e(),b=k.currentTime()-w,k.currentTime()<=w&&(b=0),k.currentTime(b);break;case p:e(),k.currentTime(k.currentTime()+w);break;case r:e(),B?(b=k.currentTime()-1,k.currentTime()<=1&&(b=0),k.currentTime(b)):k.volume(k.volume()-v);break;case q:e(),B?k.currentTime(k.currentTime()+1):k.volume(k.volume()+v);break;case s:x&&k.muted(!k.muted());break;case t:z&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen());break;default:if((d>47&&59>d||d>95&&106>d)&&A){var g=48;d>95&&(g=96);var h=d-g;e(),k.currentTime(k.duration()*h*.1)}for(var i in c.customKeys){var j=c.customKeys[i];j&&j.key&&j.handler&&j.key(a)&&(e(),j.handler(k,c))}}}},E=function(a){if(k.controls()){var b=a.relatedTarget||a.toElement||document.activeElement;(b==l||b==l.querySelector(".vjs-tech")||b==l.querySelector(".iframeblocker"))&&z&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen())}},F=function(b){if(k.controls()){var c=b.relatedTarget||b.toElement||document.activeElement;if((C||c==l||c==l.querySelector(".vjs-tech")||c==l.querySelector(".iframeblocker")||c==l.querySelector(".vjs-control-bar"))&&y){b=a.event||b;var d=Math.max(-1,Math.min(1,b.wheelDelta||-b.detail));b.preventDefault(),1==d?k.volume(k.volume()+v):-1==d&&k.volume(k.volume()-v)}}},G=function(a,b){return c.playPauseKey(a,b)?n:c.rewindKey(a,b)?o:c.forwardKey(a,b)?p:c.volumeUpKey(a,b)?q:c.volumeDownKey(a,b)?r:c.muteKey(a,b)?s:c.fullscreenKey(a,b)?t:void 0};return k.on("keydown",D),k.on("dblclick",E),k.on("mousewheel",F),k.on("DOMMouseScroll",F),this};b.plugin("hotkeys",c)}); | ||
/* videojs-hotkeys v0.2.13 - https://github.com/ctd1500/videojs-hotkeys */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b.bind(this,a,a.videojs)):"undefined"!=typeof module&&module.exports?module.exports=b(a,a.videojs):b(a,a.videojs)}(window,function(a,b){"use strict";a.videojs_hotkeys={version:"0.2.13"};var c=function(c){function d(a){return 32===a.which}function e(a){return 37===a.which}function f(a){return 39===a.which}function g(a){return 38===a.which}function h(a){return 40===a.which}function i(a){return 77===a.which}function j(a){return 70===a.which}var k=this,l=k.el(),m=document,n={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,playPauseKey:d,rewindKey:e,forwardKey:f,volumeUpKey:g,volumeDownKey:h,muteKey:i,fullscreenKey:j,customKeys:{}},o=1,p=2,q=3,r=4,s=5,t=6,u=7,v=b.mergeOptions||b.util.mergeOptions;c=v(n,c||{});var w=c.volumeStep,x=c.seekStep,y=c.enableMute,z=c.enableVolumeScroll,A=c.enableFullscreen,B=c.enableNumbers,C=c.enableJogStyle,D=c.alwaysCaptureHotkeys;l.hasAttribute("tabIndex")||l.setAttribute("tabIndex","-1"),D&&k.one("play",function(){l.focus()}),k.on("userinactive",function(){var a=function(){clearTimeout(b)},b=setTimeout(function(){k.off("useractive",a),m.activeElement.parentElement==l.querySelector(".vjs-control-bar")&&l.focus()},10);k.one("useractive",a)}),k.on("play",function(){var a=l.querySelector(".iframeblocker");a&&""===a.style.display&&(a.style.display="block",a.style.bottom="39px")});var E=function(a){var b,d=a.which,e=a.preventDefault;if(k.controls()){var f=m.activeElement;if(D||f==l||f==l.querySelector(".vjs-tech")||f==l.querySelector(".vjs-control-bar")||f==l.querySelector(".iframeblocker"))switch(H(a,k)){case o:e(),D&&a.stopPropagation(),k.paused()?k.play():k.pause();break;case p:e(),b=k.currentTime()-x,k.currentTime()<=x&&(b=0),k.currentTime(b);break;case q:e(),k.currentTime(k.currentTime()+x);break;case s:e(),C?(b=k.currentTime()-1,k.currentTime()<=1&&(b=0),k.currentTime(b)):k.volume(k.volume()-w);break;case r:e(),C?k.currentTime(k.currentTime()+1):k.volume(k.volume()+w);break;case t:y&&k.muted(!k.muted());break;case u:A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen());break;default:if((d>47&&59>d||d>95&&106>d)&&B){var g=48;d>95&&(g=96);var h=d-g;e(),k.currentTime(k.duration()*h*.1)}for(var i in c.customKeys){var j=c.customKeys[i];j&&j.key&&j.handler&&j.key(a)&&(e(),j.handler(k,c))}}}},F=function(a){if(k.controls()){var b=a.relatedTarget||a.toElement||m.activeElement;(b==l||b==l.querySelector(".vjs-tech")||b==l.querySelector(".iframeblocker"))&&A&&(k.isFullscreen()?k.exitFullscreen():k.requestFullscreen())}},G=function(b){if(k.controls()){var c=b.relatedTarget||b.toElement||m.activeElement;if((D||c==l||c==l.querySelector(".vjs-tech")||c==l.querySelector(".iframeblocker")||c==l.querySelector(".vjs-control-bar"))&&z){b=a.event||b;var d=Math.max(-1,Math.min(1,b.wheelDelta||-b.detail));b.preventDefault(),1==d?k.volume(k.volume()+w):-1==d&&k.volume(k.volume()-w)}}},H=function(a,b){return c.playPauseKey(a,b)?o:c.rewindKey(a,b)?p:c.forwardKey(a,b)?q:c.volumeUpKey(a,b)?r:c.volumeDownKey(a,b)?s:c.muteKey(a,b)?t:c.fullscreenKey(a,b)?u:void 0};return k.on("keydown",E),k.on("dblclick",F),k.on("mousewheel",G),k.on("DOMMouseScroll",G),this};b.plugin("hotkeys",c)}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42979
431