Last active
November 10, 2016 10:54
-
-
Save Carlovan/fd87039b265dc30f52ee820ef7264830 to your computer and use it in GitHub Desktop.
Cookie clicker
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
function calcRatio(){ | |
document.querySelectorAll('.product.unlocked').forEach((n, i) => { | |
var s = n.querySelector('.ratio'); | |
n.setAttribute('onclick', 'calcRatio()'); | |
if (!s) { | |
s = document.createElement('span'); | |
s.setAttribute("class", "ratio"); | |
n.querySelector('.price').appendChild(s); | |
} | |
var g = Game.ObjectsById[i]; | |
s.innerHTML = ' (' + (g.price / g.storedCps).toFixed(2) + ')'; | |
}) | |
}; | |
setInterval(calcRatio, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment