Skip to content

Instantly share code, notes, and snippets.

@drewsberry
Last active September 7, 2016 19:25
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 drewsberry/5b1129255dd0bb57c026ef4656ca0056 to your computer and use it in GitHub Desktop.
Save drewsberry/5b1129255dd0bb57c026ef4656ca0056 to your computer and use it in GitHub Desktop.
setTimeout(function() {
var $textInput = $('input[name="ctl00$cphBody$txtEmailAddressEnter"]');
var $submitButton = $('input[name="ctl00$cphBody$btnNext"]');
var $wheel = $('#wheel');
if ($textInput.length !== 0) {
var currentEmail = $textInput.val();
var currentNumber = Number(currentEmail.match(/[\d]+/)[0]);
var nextNumber = currentNumber + 1;
var nextEmail = currentEmail.replace(currentNumber, nextNumber);
console.log("Current email:", currentEmail);
console.log("Current number:", currentNumber);
console.log("Next email:", nextEmail);
$textInput.val(nextEmail);
$submitButton.trigger('click');
} else if ($wheel.length !== 0) {
setTimeout(function() {
var $wheelSrc = $wheel.attr('src');
console.log('Image source:', $wheelSrc);
if ($wheelSrc == '/paparewards/images/reveal-0-points.gif') {
console.log('You haven\'t won now, trying again...');
history.back();
} else {
console.log('Looks like you might\'ve won something!');
}
}, 8000);
}
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment