Skip to content

Instantly share code, notes, and snippets.

@kimuchi1203
Created June 16, 2012 16:05
Show Gist options
  • Select an option

  • Save kimuchi1203/2941790 to your computer and use it in GitHub Desktop.

Select an option

Save kimuchi1203/2941790 to your computer and use it in GitHub Desktop.
(bookmarklet) play YouTube related video automatically
javascript:(function(p,r){p=yt.getConfig('PLAYER_REFERENCE');var i=-1;r=function(s){if(s==0){p.loadVideoById((function(){var b=document.getElementById('watch-related').getElementsByTagName('button');if(++i>0){b[i-1].parentNode.parentNode.style.backgroundColor='transparent';}i=i%b.length;b[i].parentNode.parentNode.style.backgroundColor='#ffff00';return b[i%b.length].getAttribute('data-video-ids');})());}};p.addEventListener('onStateChange',r);try{document.getElementById('watch-headline-user-info').innerHTML+='[play_related]'}catch(e){}})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment