-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathexperiment.html
134 lines (125 loc) · 6.11 KB
/
experiment.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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>CS4249 Assignment 1</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/style.css">
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body class="experiment-page">
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<nav class="navbar navbar-default">
<div class="container">
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Welcome</a></li>
<li><a href="questionnaire-pre.html">Pre Questionnaire</a></li>
<li><a href="instructions.html">Instructions</a></li>
<li class="active"><a href="experiment.html">Experiment</a></li>
<li><a href="questionnaire-post.html">Post Questionnaire</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<h1>Copy-Paste Experiment</h1>
<hr>
<table class="table table-bordered">
<tbody>
<tr>
<td>Technique</td>
<td><span class="js-expt-technique">ACP</span></td>
</tr>
<tr>
<td>Granularity</td>
<td><span class="js-expt-granularity">Phrase</span></td>
</tr>
<tr>
<td>Independent Variable 3</td>
<td>???</td>
</tr>
<tr>
<td>Trial</td>
<td><span class="js-expt-current-trial"></span> / <span class="js-expt-num-trials"></span></td>
</tr>
</tbody>
</table>
<p>Please copy-paste the following <span class="js-expt-granularity">phrase</span> using the <span class="js-expt-technique">AUTOCOMPASTE</span> technique from one of the open windows.</p>
<div id="stimuli" class="alert alert-danger js-expt-stimuli">This is a long stimuli!</div>
<button class="btn btn-primary btn-lg" onclick="next()">Next Task</button>
</div>
<div id="autocompaste" class="col-sm-9">
<div id="autocompaste-display"></div>
</div>
</div>
</div>
<script src="js/vendor/jquery-1.11.2.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<script src="js/WindowManager.js"></script>
<script src="js/autocompaste/engine.js"></script>
<script src="js/autocompaste/interface.js"></script>
<script src="js/autocompaste/editor.js"></script>
<script src="js/autocompaste/autocompaste.js"></script>
<script src="js/DataStorage.js"></script>
<script src="js/ACPToolKit.js"></script>
<script>
var trialsData;
var currentTrial;
var totalNumberOfTrials;
var headers = ['Participant id', 'Technique', 'Granularity',
'Trial no', 'Stimuli', 'User Response', 'Trial Start Time',
'Trial End Time', 'Trial Time', 'Accuracy'];
var trialData = [];
var pid;
function next () {
if (currentTrial !== 0) {
var trialResult = ACPToolKit.getCurrentTrialState();
var technique = trialResult.technique;
var granularity = trialResult.granularity;
var trialNum = currentTrial;
var stimuli = trialResult.stimuli;
var userResponse = trialResult.user_response;
var trialStartTime = trialResult.start_time;
var trialEndTime = trialResult.end_time;
var trialDuration = trialResult.duration;
var accuracy = stimuli === userResponse ? 1 : 0;
var row = [pid, technique, granularity, trialNum,
stimuli, userResponse, trialStartTime,
trialEndTime, trialDuration, accuracy];
trialData.push(row);
}
if (currentTrial < totalNumberOfTrials) {
ACPToolKit.presentTrial(trialsData[currentTrial]);
currentTrial += 1;
$('.js-expt-current-trial').text(currentTrial);
} else {
// Last trial completed
ACPToolKit.downloadTrialResults(trialData);
window.location = 'questionnaire-post.html';
}
}
$(document).ready(function () {
$.get('data/experiments.json', function (data) {
trialsData = data.experiments;
currentTrial = 0;
totalNumberOfTrials = trialsData.length;
$('.js-expt-num-trials').text(totalNumberOfTrials);
trialData.push(headers);
next();
pid = ACPToolKit.getCurrentParticipantId();
})
});
</script>
</body>
</html>