Created
April 7, 2016 16:23
-
-
Save oscarmcm/ac6508ec30b6496cde9e0465d6ac4176 to your computer and use it in GitHub Desktop.
foo
This file contains hidden or 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
var nodes = document.querySelectorAll('.day'); | |
var items = ['#d6e685', '#8cc665', '#44a340', '#1e6823'] | |
Array.prototype.randomElement = function () { | |
return this[Math.floor(Math.random() * this.length)] | |
} | |
for (var i = 0; i < nodes.length; i++) { | |
if (nodes[i].getAttribute('fill') == '#eeeeee') { | |
nodes[i].setAttribute('fill', items.randomElement()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment