Skip to content

Instantly share code, notes, and snippets.

@typeetfunc
Created June 10, 2016 20:55
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 typeetfunc/e3e251c468f5f2b7dbfeb43f7f36e3fa to your computer and use it in GitHub Desktop.
Save typeetfunc/e3e251c468f5f2b7dbfeb43f7f36e3fa to your computer and use it in GitHub Desktop.
var ids = ['26052399', '26035461', '26035459', '26035454', '26035467']
var links = Array.prototype.slice.call(document.getElementsByClassName('song_button'), 0).filter(a => ids.find(id => id === a.dataset.playSong))
var current = 0;
setInterval(
() => {
var hasPlaying = links.map(a => a.classList.contains('playing')).filter(a => a).length;
if (hasPlaying) {
console.log('skip')
return;
} else {
console.log('next')
current = current > links.length - 1 ? 0 : current;
links[current].click();
current++;
return;
}
},
1000
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment