-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.html
66 lines (46 loc) · 2.41 KB
/
Main.html
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
<!DOCTYPE html>
<html>
<head>
<script src="js_use/jspsych.js"></script>
<script src="js_use/plugin-html-button-response.js"></script>
<script src="js_use/jspsych-psychophysics.js"></script>
<script src="js_use/plugin-fullscreen.js"></script>
<script src="js_use/seedrandom.js"></script>
<script src="js_use/shuffle-seed.js"></script>
<script src="https://pixijs.download/release/pixi.js"></script>
<link rel="stylesheet" href="js_use/jspsych.css">
<script src="js_use/pre_const.js"></script>
</link>
</head>
<body></body>
<script>
// This file is the formal file for PID-decision.
//block = 4 * 7
//define in js_use/pre_const.js
//var block_num = 1 //see pre_const.js file
//var trial_num = 2 //see pre_const.js file
const jsPsych = initJsPsych({
on_finish: function () {
jsPsych.data.displayData();
jsPsych.data.get().localSave("csv", "Day1_formal_" + localStorage.subj_name + ".csv");
document.getElementById("jspsych-content").innerHTML = "<div><p style = 'color:white; font-size = 26px'>实验结束,非常感谢您的参与!</p >" +
"<p style = 'color:white; font-size : 26px'>only a demo; if find bug</p >" +
"<p style = 'color:white; font-size : 26px'>plz emaill me [email protected] </p ></div>";
}
})
console.log(`jsPsych Version ${jsPsych.version()}`)
//const pixi_flag = jsPsych.data.getURLVariable('pixi_flag') === '1' ? true : false;
const formal_exp_name = ['Condition_1', 'Condition_2', 'Condition_3', 'Condition_4']
const name_index = shuffleSeed.shuffle(Array(block_num).fill([0, 1, 2, 3]).flat(), localStorage.subj_name)
var timeline_all = [start_screen, detect_no_sign, fullscreen_trial, block_instruc_exam, viz_trial, block_instruc_formal];
for (let i = 0; i < name_index.length; i++) {
timeline_all = timeline_all.concat(eval("eval(formal_exp_name[name_index[i]])")['timeline'][0]);
timeline_all = timeline_all.concat(eval("eval(formal_exp_name[name_index[i]])")['timeline'][1])
timeline_all = timeline_all.concat(block_relax);
}
timeline_all = timeline_all.concat(fullscreen_trial_exit)
timeline_all = timeline_all.concat(EXP_end)
jsPsych.run(timeline_all)
localStorage.removeItem(localStorage.subj_name)
</script>
</html>