Skip to content

Instantly share code, notes, and snippets.

@dobakay
Last active September 4, 2016 02:10
Show Gist options
  • Save dobakay/8104101 to your computer and use it in GitHub Desktop.
Save dobakay/8104101 to your computer and use it in GitHub Desktop.
youtube replay-song button functionality
/*
Open your favourite music video, open chrome dev tools console (f12 and after that Esc).
Copy/Paste the following code.
Enjoy Replay self-clickable button! :)
*/
var playButton = $('.html5-player-chrome').children[1];
setInterval(function() {
if(playButton.classList.contains('ytp-button-replay')) {
playButton.click();
}
}, 1000);
@quc
Copy link

quc commented Aug 28, 2015

Not working for me.
Chrome 42.0.2311.135 (64-bit);

Maybe new classes on youtube...

But following code should work.
Thank you!

var replayAction = $('.ytp-play-button');

setInterval(function(){
if(replayAction.getAttribute('aria-label') === null){
replayAction.click();
}
}, 1000);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment