Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //NOT WORKING - not sure why
- (function() { //stop with clearInterval(egger)
- var time = $('#egg-clock-text')
- var actions = $('.egg-action')
- function vote() {
- console.log((parseInt(time.text())))
- if (parseInt(time.text()) > 2)
- return
- console.log('Voting...')
- var votes = [], buttons = []
- actions.each(function() {
- var t = $(this), v = t.find('.egg-action-tally').attr('title')
- votes.push(v[0] == 'o' ? 1 : (parseInt(v) | 0))
- buttons.push(t.find('button'))
- })
- var maxIndex = 0
- for(var i = 0; i < votes.length; i++) {
- if (votes[i] > votes[maxIndex])
- maxIndex = i
- }
- var btn = buttons[maxIndex].text()
- if (btn != 'Restart') {
- console.log('Voted for ' + btn)
- buttons[maxIndex].click()
- } else
- console.log('Did not vote for Restart.')
- }
- vote()
- egger = setInterval(vote, 500)
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement