Guest User

http://tutorialzine.com/2014/05/javascript-challenge-make-me

a guest
May 24th, 2016
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*2*/
  2. $('.wants-to-be-blue').blue()
  3.  
  4. /*3*/
  5. var findComments = function(el) {
  6.         var arr = [];
  7.         for(var i = 0; i < el.childNodes.length; i++) {
  8.           var node = el.childNodes[i];
  9.           if(node.nodeType === 8) {
  10.             arr.push(node);
  11.           } else {
  12.             arr.push.apply(arr, findComments(node));
  13.           }
  14.         }
  15.         return arr;
  16.       };
  17.      
  18.       var comments = findComments(document);
  19.      
  20.       for(var x = 0; x < comments.length; x++) {
  21.         $(comments[x].parentElement).blue();
  22.       }
  23.  
  24. /*4*/
  25.  var findComments = function(el) {
  26.         var arr = [];
  27.         for(var i = 0; i < el.childNodes.length; i++) {
  28.           var node = el.childNodes[i];
  29.           if(node.nodeType === 8) {
  30.             arr.push(node);
  31.           } else {
  32.             arr.push.apply(arr, findComments(node));
  33.           }
  34.         }
  35.         return arr;
  36.       };
  37.      
  38.       var comments = findComments(document);
  39.      
  40.       for(var x = 0; x < comments.length; x++) {
  41.         $(comments[x].parentElement).blue();
  42.       }
  43.  
  44. /*5*/
  45. // Write your JS here
  46. var allDivs = $('div');
  47.  
  48. allDivs.each(function(index) {
  49.     $('div:contains('+ (index + 1) +')').blue()
  50. });
  51.  
  52. /*6*/
  53. $('div:not(.bomb)').blue()
  54.  
  55. /*7*/
  56. setTimeout(function(){
  57.     $('div').blue()
  58. }, 1001);
  59.  
  60. /*8*/
  61. $('button').click();
  62. $('div').blue()
  63.  
  64. /*9*/
  65. var ids = $('#map').text().split(' ');
  66.  
  67. for(var x = 0; x < ids.length; x++) {
  68.     $('div#'+ids[x]).blue()
  69. }
  70.  
  71. /*10*/
  72. setTimeout(function() {
  73.   $('div:not(.bomb)').blue()
  74. },100)
Add Comment
Please, Sign In to add comment