Skip to content

Instantly share code, notes, and snippets.

@mplacona
Last active August 29, 2015 14:19
Show Gist options
  • Save mplacona/6756660daaf33a71d87f to your computer and use it in GitHub Desktop.
Save mplacona/6756660daaf33a71d87f to your computer and use it in GitHub Desktop.
Hack for /video page replay
function heartbeat(){
if(document.querySelector('.demo--completed') != null){
eventFire(document.querySelector('.demo__restart'),'click');
}
setTimeout(heartbeat,1000);
}
function eventFire(el, etype){
if (el.fireEvent) {
(el.fireEvent('on' + etype));
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
}
}
heartbeat();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment