Skip to content

Instantly share code, notes, and snippets.

@ibolmo
Created October 28, 2015 12:49
Show Gist options
  • Select an option

  • Save ibolmo/45f2987e88e7d4906802 to your computer and use it in GitHub Desktop.

Select an option

Save ibolmo/45f2987e88e7d4906802 to your computer and use it in GitHub Desktop.
var last = $('.CardsList-progress span:last-child').text() * 1;
var getNext = function(){ return Math.floor(Math.random() * last) + 1; };
var current = $('.CardsList-progress span:first-child').text() * 1;
var next = getNext();
while (current == next) next = getNext();
console.log('current: ', current, ' next: ', next, ' of: ', last);
var times = Math.abs(current - next);
while (times--){
$((current < next) ? '.nextButton' : '.previousButton').click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment