|
// stop previous hack if present |
|
if(typeof hack != 'undefined'){hack.stop();} |
|
|
|
// define our hack "class" |
|
var hack = { |
|
/** |
|
* start all "non-breaking" hacks |
|
*/ |
|
start: function() { |
|
this.startCookie(); |
|
this.startShimmer(); |
|
this.startFortune(); |
|
// this.startCheating(); |
|
}, |
|
|
|
/** |
|
* stop all hacks |
|
*/ |
|
stop: function() { |
|
this.stopCookie(); |
|
this.stopShimmer(); |
|
this.stopCheating(); |
|
this.stopFortune(); |
|
}, |
|
|
|
/** |
|
* golden cookies / reindeer click hack |
|
*/ |
|
startShimmer: function() { |
|
this.stopShimmer(); |
|
this.shimmersInterval = setInterval(function(){ |
|
var shimmers = document.getElementsByClassName('shimmer'); |
|
for(var shimmer of shimmers){ |
|
shimmer.click(); |
|
} |
|
}, 1000); |
|
}, |
|
stopShimmer: function() { |
|
if(this.shimmersInterval){ |
|
clearInterval(this.shimmersInterval); |
|
} |
|
}, |
|
|
|
/** |
|
* green fortune cookies in news ticker |
|
*/ |
|
startFortune: function() { |
|
this.stopFortune(); |
|
this.fortuneInterval = setInterval(function(){ |
|
var fortunes = document.getElementsByClassName('fortune'); |
|
for(var fortune of fortunes){ |
|
fortune.click(); |
|
} |
|
}, 1000); |
|
}, |
|
stopFortune: function() { |
|
if(this.fortuneInterval){ |
|
clearInterval(this.fortuneInterval); |
|
} |
|
}, |
|
|
|
/** |
|
* cookie click hack |
|
*/ |
|
startCookie: function() { |
|
this.stopCookie(); |
|
this.cookieInterval = setInterval(function(){ |
|
document.getElementById('bigCookie').click() |
|
}, 0.05); |
|
}, |
|
stopCookie: function() { |
|
if(this.cookieInterval){ |
|
clearInterval(this.cookieInterval); |
|
} |
|
}, |
|
|
|
/** |
|
* WARNING : This one will break the fun of the game by spawning a lot of golden cookies and reindeers... |
|
* Use at your own risk ! |
|
*/ |
|
startCheating: function() { |
|
this.stopCheating(); |
|
this.dontCareInterval = setInterval(function(){ |
|
if(typeof Game != 'undefined'){ |
|
new Game.shimmer('reindeer'); |
|
new Game.shimmer('golden'); |
|
} |
|
}, 1000); |
|
}, |
|
stopCheating: function() { |
|
if(this.dontCareInterval){ |
|
clearInterval(this.dontCareInterval); |
|
} |
|
}, |
|
}; |
|
|
|
// auto start all hacks |
|
hack.start(); |