Advertisement
Guest User

Tutorialzine JavaScript Challenge: Make Me Blue!

a guest
May 30th, 2014
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // #1
  2. $(document.getElementById("me")).blue();
  3.  
  4. // #2
  5. $(document.querySelector(".wants-to-be-blue")).blue();
  6.  
  7. // #3
  8. $(document.createTreeWalker(document, NodeFilter.SHOW_COMMENT, null, null).nextNode().parentNode).blue();
  9.  
  10. // #4
  11. var tw = document.createTreeWalker(document, NodeFilter.SHOW_COMMENT, null, null), comment;
  12. while (comment = tw.nextNode())
  13.     $(comment.parentNode).blue();
  14.  
  15. // #5
  16. [].slice.call(document.getElementsByTagName("div")).sort(function(a, b) {
  17.     return a.textContent - b.textContent;
  18. }).forEach(function(div) {$(div).blue();});
  19.  
  20. // #6
  21. [].forEach.call(document.querySelectorAll("div:not(.bomb)"), function(div) {$(div).blue();});
  22.  
  23. // #7
  24. setTimeout(function(){
  25.     $(document.querySelector("div")).blue();
  26. }, 1010);
  27.  
  28. // #8
  29. document.querySelector("button").click();
  30. $(document.querySelector("div")).blue();
  31.  
  32. // #9
  33. document.getElementById("map").textContent.split(" ").forEach(function(div) {
  34.     $(document.getElementById(div)).blue();
  35. });
  36.  
  37. // #10
  38. setInterval(function() {
  39.     [].forEach.call(document.querySelectorAll("div:not(.bomb)"), function(div) {
  40.         $(div).blue();
  41.     });
  42. }, 100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement