Created
April 2, 2016 04:30
-
-
Save anonymous/1d931a3f02394b23b9dd19f6b4bd2593 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Autogrow = function(){ | |
var self = { | |
interval: 30000, | |
running: undefined, | |
growTarget: 'button[value="INCREASE"]', | |
stayTarget: 'button[value="CONTINUE"]', | |
action: 'grow', | |
trigger: function(){ | |
if (self.action == 'grow') | |
$(self.growTarget).trigger('click'); | |
if (self.action == 'stay') | |
$(self.stayTarget).trigger('click'); | |
console.log('Auto Growing!'); | |
}, | |
start: function(){ | |
clearInterval(self.running); | |
self.running = setInterval(self.trigger, 30000); | |
console.log('starting to auto grow'); | |
}, | |
stop: function(){ | |
clearInterval(self.running); | |
console.log('stopping auto grow'); | |
} | |
}; | |
return self; | |
}; | |
var autogrow = new Autogrow(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment