Skip to content

Instantly share code, notes, and snippets.

@efossas
Created May 19, 2018 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efossas/ee69cd21c74affab99a69acf94e184c9 to your computer and use it in GitHub Desktop.
Save efossas/ee69cd21c74affab99a69acf94e184c9 to your computer and use it in GitHub Desktop.
tampermonkey-hulu-play-pause
// ==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