Created
February 2, 2017 06:51
-
-
Save jccovey/29335455d3311443736e285920142d8c to your computer and use it in GitHub Desktop.
General purpose JavaScript snippets that fit in 2048 characters or less.
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
// Arrow key nav for videos | |
// - Left: -5s | |
// - Right: +5s | |
// - Up: +30s | |
// - Down: -30s | |
javascript:var timeAdj = {'37': -5, '39': 5, '38': 30, '40': -30 }; document.addEventListener("keyup", function(e) { if (e.which > 36 || e.which < 41) { e.preventDefault(); document.querySelectorAll("video").forEach(function(vid) { vid.currentTime += timeAdj[e.which]; vid.play();});}}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment