Created
November 30, 2012 10:15
-
-
Save uhtred/4174955 to your computer and use it in GitHub Desktop.
AutoBets: bomdelance.com.br
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
// bomdelance.com.br | |
// @example TrackBomDeLance.start({ max_price: 'R$ 30,00', auction_id: '', seconds_limit: '01', bets_limit: 20, debug: true }); | |
var TrackBomDeLance = (function(){ | |
var auction_id = '', | |
tmpTrack, | |
betData = {}, | |
trackOptions = {}, | |
bets = 0, | |
user = 'drfranca'; | |
function getPrice(){ | |
if( !$price ) { | |
var $price = document.querySelector('#auction_'+ trackOptions.auction_id +' .price'); | |
} | |
return $price.innerHTML; | |
} | |
function getSec(){ | |
if( !$sec ) { | |
var $sec = document.querySelector('#auction_'+ trackOptions.auction_id +' .sec'); | |
} | |
if( !$sec ) { | |
stop(); | |
} | |
return $sec.innerHTML; | |
} | |
function getLast(){ | |
if( !$last ) { | |
var $last = document.querySelector('#auction_'+ trackOptions.auction_id +' .last'); | |
} | |
return ( $last ? $last.innerHTML : 'nobody' ); | |
} | |
function pressBetBtn(){ | |
if( !$betBtn ){ | |
var $betBtn = document.querySelector('#auction_'+ trackOptions.auction_id +' .post'); | |
} | |
$betBtn.click(); | |
} | |
function bet(){ | |
bets++; | |
console.log('Bet!', { sec: getSec(), price: getPrice(), bets: bets }); | |
if( !trackOptions.debug ) { | |
console.log('Real Bet!'); | |
pressBetBtn(); | |
} | |
} | |
function start( options ) { | |
trackOptions = options; | |
reset(); | |
tmpTrack = window.setInterval(function(){ | |
console.log('Bets: '+ bets); | |
if( bets <= trackOptions.bets_limit && getSec() == trackOptions.seconds_limit && getPrice() != trackOptions.max_price && getLast() != user ) { | |
bet(); | |
} | |
}, 1000); | |
} | |
function reset(){ | |
$sec = $price = $btnBet = null; | |
stop(); | |
} | |
function stop(){ | |
if( tmpTrack ) { | |
clearInterval(tmpTrack); | |
} | |
} | |
return { getPrice: getPrice, getSec: getSec, bet: bet, start: start, stop: stop, getLast: getLast }; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment