Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. var colors = [ "#ededed", "rgb(172, 213, 242)", "rgb(127, 168, 201)", "rgb(82, 123, 160)", "rgb(37, 78, 119)" ];
  2. var currentColor = colors[0];
  3.  
  4. window.onkeydown = (ev) => { window.currentColor = (colors[parseInt(ev.key) - 1]); console.log(window.currentColor); };
  5.  
  6. var calendar = $(".contrib-calendar").first();
  7. var rawColls = calendar.children();
  8. for(let rawColl of rawColls) {
  9. let coll = $(rawColl);
  10. let rawRows = coll.children();
  11. for(let rawRow of rawRows) {
  12. let row = $(rawRow);
  13. if(!row.hasClass("user-contrib-cell")) continue;
  14.  
  15. row.on("click", function() {
  16. this.setAttribute("fill", currentColor);
  17. });
  18.  
  19. rawRow.setAttribute("fill", currentColor);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement