MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / randomSelect

Function randomSelect

assets/js/Random_Picker.js:39–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39function 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
66function pickRandomTag() {
67 const tags = document.querySelectorAll('.tag');

Callers 1

Random_Picker.jsFile · 0.70

Calls 3

unhighlightTagFunction · 0.85
pickRandomTagFunction · 0.70
highlightTagFunction · 0.70

Tested by

no test coverage detected