Guest User

Untitled

a guest
May 28th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. var doc = $( 'iframe[id="/embed/colors-game"]' ).contentDocument;
  2.  
  3. var i = 200;
  4. clickOnColoredBox();
  5.  
  6. function clickOnColoredBox() {
  7. var prevColors = null;
  8.  
  9. for ( var div of doc.getElementsByTagName( 'div' ) ) {
  10. var color = div.style.backgroundColor;
  11. if ( !color ) {
  12. continue; /* Not a cell */
  13. }
  14.  
  15. if ( prevColors === null ) {
  16. prevColors = {};
  17. }
  18. else if ( prevColors[color] === undefined ) {
  19. console.log( "Found unknown color: " + color );
  20.  
  21. div.click();
  22. break;
  23. }
  24.  
  25. prevColors[color] = 1;
  26. }
  27.  
  28. if ( -- i >= 0 ) {
  29. setTimeout( clickOnColoredBox, 100 );
  30. }
  31. }
Add Comment
Please, Sign In to add comment