Skip to content

Instantly share code, notes, and snippets.

@jccovey
Created February 2, 2017 06:51
Show Gist options
  • Save jccovey/29335455d3311443736e285920142d8c to your computer and use it in GitHub Desktop.
Save jccovey/29335455d3311443736e285920142d8c to your computer and use it in GitHub Desktop.
General purpose JavaScript snippets that fit in 2048 characters or less.
// 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