-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.js
More file actions
91 lines (78 loc) · 2.56 KB
/
common.js
File metadata and controls
91 lines (78 loc) · 2.56 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
export function hi() {
console.log("hi");
}
const blank = ``;
const intro_para = `
<p>
On the next page you will see a series of videos simulating conversations between you and a robot.<br>
Instead of talking to the robot, simply press spacebar whenever you would naturally respond to the robot.<br>
Please do not hold the spacebar, or spam it. Only press it once when you think it is your turn to speak.<br>
Please do not refresh the page.<br>
When you are ready, click Begin.
</p>
<button id="begin" class="btn begin">Begin</button>
`;
const interaction1_para = `
<p>
Click to start the first interaction.
</p>
<button id="begin" class="btn begin">Start</button>
`;
const interaction2_para = `
<p>
Thank you for completing the first interaction.<br>
When you are ready, click to start the second interaction.
</p>
<button id="begin" class="btn begin">Start</button>
`;
const interaction3_para = `
<p>
Thank you for completing the second interaction.<br>
When you are ready, click to start the third interaction.
</p>
<button id="begin" class="btn begin">Start</button>
`;
const goodbye_para = `
<p>
Thank you for completing these interactions!<br>
Results copied to clipboard. Please return to the form and paste these in the provided text box.<br>
You may now close this page.
</p>
<button id="begin" class="btn begin">Close</button>
`;
export function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
};
function waitForClick() {
return new Promise((resolve) => {
const button = document.getElementById("begin");
button.addEventListener('click', start);
function start(e) {
button.removeEventListener('click', start);
resolve();
document.getElementById("main").innerHTML = blank;
}
});
}
export async function intro() {
document.getElementById("main").innerHTML = intro_para;
await waitForClick();
}
export async function startInteractionOne() {
document.getElementById("main").innerHTML = interaction1_para;
await waitForClick();
}
export async function startInteractionTwo() {
document.getElementById("main").innerHTML = interaction2_para;
await waitForClick();
}
export async function startInteractionThree() {
document.getElementById("main").innerHTML = interaction3_para;
await waitForClick();
}
export async function sayGoodbye() {
document.getElementById("main").innerHTML = goodbye_para;
await waitForClick();
}