I am making an extension for a site called csgo500.com . In my script there is a function that starts if I win or lose. The function works when I put it directly into the console, BUT when I make it as a extension it only tells me:
Uncaught ReferenceError: winner is not defined
My code looks like this:
var winlose = function() {
if (winner.choice === 0) {
document.getElementById('bet-btn-min').click();
document.getElementById('bet-btn-10').click();
}
else {
document.getElementById('bet-btn-double').click();
}
}
I have checked the other explanations for "is not defined" on this site, but none has the same type of problem as I have. Any suggestions or soultions?
Edit: The winner is being declared in the sites js as: '
function generateRound(data) {
lastRound = round;
round = data.round;
winner = data.winner;
numberBets = 0;
$wheelTimer.show();