Skip to content

Instantly share code, notes, and snippets.

@sfate
Created June 17, 2016 16:23
Show Gist options
  • Save sfate/bb8064f10659a386e0f29904ecc4b294 to your computer and use it in GitHub Desktop.
Save sfate/bb8064f10659a386e0f29904ecc4b294 to your computer and use it in GitHub Desktop.
(function() { 'use strict';
var currentTimeEl = document.querySelector('.ytp-time-current'),
endTimeEl = document.querySelector('.ytp-time-duration'),
replayBtnEl = document.querySelector('.ytp-play-button');
setTimeout(function replay() {
if (
(currentTimeEl.textContent == endTimeEl.textContent)
&&
(replayBtnEl.getAttribute('title') == 'Replay')
) {
replayBtnEl.click();
}
setTimeout(replay, 1000);
}, 1000)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment