Advertisement
Guest User

bad bot

a guest
Mar 31st, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. //NOT WORKING - not sure why
  2. (function() { //stop with clearInterval(egger)
  3. var time = $('#egg-clock-text')
  4. var actions = $('.egg-action')
  5. function vote() {
  6. console.log((parseInt(time.text())))
  7. if (parseInt(time.text()) > 2)
  8. return
  9. console.log('Voting...')
  10. var votes = [], buttons = []
  11. actions.each(function() {
  12. var t = $(this), v = t.find('.egg-action-tally').attr('title')
  13. votes.push(v[0] == 'o' ? 1 : (parseInt(v) | 0))
  14. buttons.push(t.find('button'))
  15. })
  16. var maxIndex = 0
  17. for(var i = 0; i < votes.length; i++) {
  18. if (votes[i] > votes[maxIndex])
  19. maxIndex = i
  20. }
  21. var btn = buttons[maxIndex].text()
  22. if (btn != 'Restart') {
  23. console.log('Voted for ' + btn)
  24. buttons[maxIndex].click()
  25. } else
  26. console.log('Did not vote for Restart.')
  27. }
  28. vote()
  29. egger = setInterval(vote, 500)
  30. })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement