Created
May 19, 2018 03:05
-
-
Save efossas/ee69cd21c74affab99a69acf94e184c9 to your computer and use it in GitHub Desktop.
tampermonkey-hulu-play-pause
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hulu Play/Pause | |
// @namespace http://abaganon.com/ | |
// @version 0.1 | |
// @description Add play/pause shorcut to Hulu | |
// @author Eric Fossas | |
// @match https://www.hulu.com/watch/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Your code here... | |
document.body.onkeyup = function(e) { | |
var k = Number(e.keyCode); | |
if(k === 93 || (k >= 37 && k <= 40)) { | |
var hulu = document.getElementById('content-video-player'); | |
if (hulu) { | |
switch(k) { | |
// right command key | |
case 93: | |
hulu.paused ? hulu.play() : hulu.pause(); | |
break; | |
// right arrow | |
case 39: | |
hulu.currentTime += 5; | |
break; | |
// left arrow | |
case 37: | |
hulu.currentTime -= 5; | |
break; | |
default: | |
return; | |
} | |
} | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment