()
| 37 | } |
| 38 | |
| 39 | function randomSelect() { |
| 40 | const times = 30; |
| 41 | |
| 42 | const interval = setInterval(() => { |
| 43 | const randomTag = pickRandomTag(); |
| 44 | |
| 45 | highlightTag(randomTag); |
| 46 | |
| 47 | // remove the highlight after a while |
| 48 | setTimeout(() => { |
| 49 | unhighlightTag(randomTag); |
| 50 | }, 100); |
| 51 | }, 100); |
| 52 | |
| 53 | // allow times * 100 ms for the tags to randomly "highlight" themselves |
| 54 | // then pick another tag |
| 55 | setTimeout(() => { |
| 56 | clearInterval(interval); |
| 57 | |
| 58 | setTimeout(() => { |
| 59 | const randomTag = pickRandomTag(); |
| 60 | |
| 61 | highlightTag(randomTag) |
| 62 | }, 100); |
| 63 | }, times * 100); |
| 64 | } |
| 65 | |
| 66 | function pickRandomTag() { |
| 67 | const tags = document.querySelectorAll('.tag'); |
no test coverage detected