Skip to content

Instantly share code, notes, and snippets.

@jcmoore
Last active August 29, 2015 14:04
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 jcmoore/eb59ad20a9937d59bcf1 to your computer and use it in GitHub Desktop.
Save jcmoore/eb59ad20a9937d59bcf1 to your computer and use it in GitHub Desktop.
Auto-replay video
//
window.replay = (function (initial) {
var interval = null;
return (function repeat (setting) {
if (setting && !interval) {
interval = setInterval(function () {
var button = document.querySelector('[role="button"][aria-label="Replay"]');
event;
if (button) {
event = document.createEvent("HTMLEvents");
event.initEvent("click", true, true);
button.dispatchEvent(event);
}
}, 500);
} else if (!setting && interval) {
clearInterval(interval);
interval = null;
}
return repeat;
}) (initial);
}) (true); //replay(false)
//
//
window.replay=function(a){var b=null;return function c(a){return a&&!b?b=setInterval(function(){var a=document.querySelector('[role="button"][aria-label="Replay"]');a&&(event=document.createEvent("HTMLEvents"),event.initEvent("click",!0,!0),a.dispatchEvent(event))},500):!a&&b&&(clearInterval(b),b=null),c}(a)}(!0); //replay(0)
//
//
javascript:window.replay=function(a){var b=null;return function c(a){return a&&!b?b=setInterval(function(){var a=document.querySelector('[role="button"][aria-label="Replay"]');a&&(event=document.createEvent("HTMLEvents"),event.initEvent("click",!0,!0),a.dispatchEvent(event))},500):!a&&b&&(clearInterval(b),b=null),c}(a)}(!0); //replay(0)
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment