1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
const dom_query = document.getElementById("query");
const dom_sect = document.getElementById("sect");
const dom_man = document.getElementById("man");
const query = dom_query.value;
dom_query.value = "";
let i = 0, j = 0;
let elapsed = 0;
let actions =
[
[250, () => { dom_query.focus(); }, 1],
[150, () => { dom_query.value += query[j++]; }, query.length],
[250, () => { dom_man.focus(); }, 1],
[250, () => { dom_man.click(); }, 1],
];
function do_stuff()
{
elapsed += 50;
if((elapsed % actions[i][0]) == 0)
{
actions[i][1]();
actions[i][2]--;
if(actions[i][2] <= 0) i++;
}
setTimeout(do_stuff, 50);
}
do_stuff();
|