forked from emmeryn/autocompaste-html
-
Notifications
You must be signed in to change notification settings - Fork 0
/
experiment.html
169 lines (153 loc) · 8.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!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 - AutoComPaste vs Ctrl-C Ctrl-V</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/normalize.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>Knowledge</td>
<td><span class="js-expt-knowledge"></span></td>
</tr>
<tr>
<td>Block</td>
<td><span class="js-expt-current-block"></span> / <span class="js-expt-num-blocks"></span></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="question" class="alert alert-danger js-expt-question">This is a long question!</div>
<div id="display" class="alert alert-success"><span class="js-expt-display"></span></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 totalNumberOfBlocks = 2;
var currentBlock = 1;
var currentTrial;
var totalNumberOfTrials;
var headers = ['Participant id', 'Technique', 'Granularity', 'Knowledge',
'Trial no', 'Question', 'Answer', 'User Response', 'Trial Start Time',
'Trial End Time', 'Trial Time', 'Accuracy'];
var trialData = [];
var participantId;
var orderTrials1 = [0,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];
var orderTrials2 = [9,10,11,12,13,14,15,16,17,0,1,2,3,4,5,6,7,8,27,28,29,30,31,32,33,34,35,18,19,20,21,22,23,24,25,26];
var orderTrials3 = [18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17];
var orderTrials4 = [27,28,29,30,31,32,33,34,35,18,19,20,21,22,23,24,25,26,9,10,11,12,13,14,15,16,17,0,1,2,3,4,5,6,7,8];
var orderTrials = orderTrials2;
function next () {
if (currentTrial !== 0) {
// Save results of current trial
var trialResult = ACPToolKit.getCurrentTrialState();
var technique = trialResult.technique;
var granularity = trialResult.granularity;
var knowledge = trialResult.knowledge;
var trialNum = currentTrial;
var question = trialResult.question;
var answer = trialResult.answer;
var userResponse = trialResult.user_response;
var trialStartTime = trialResult.start_time;
var trialEndTime = trialResult.end_time;
var trialDuration = trialResult.duration;
var accuracy = answer === userResponse ? 1 : 0;
var row = [participantId, technique, granularity, knowledge, currentBlock, trialNum,
question, answer, userResponse, trialStartTime,
trialEndTime, trialDuration, accuracy];
trialData.push(row);
}
if (currentTrial < totalNumberOfTrials) {
// Show the next trial
ACPToolKit.presentTrial(trialsData[orderTrials[currentTrial]]);
currentTrial += 1;
$('.js-expt-current-trial').text(currentTrial);
$('.js-expt-current-block').text(currentBlock);
} else {
if (currentBlock < totalNumberOfBlocks) {
currentTrial = 0;
ACPToolKit.presentTrial(trialsData[orderTrials[currentTrial]]);
currentBlock += 1;
currentTrial = 1;
$('.js-expt-current-block').text(currentBlock);
$('.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) {
// Initialise experiments
trialsData = data.experiments;
currentTrial = 0;
totalNumberOfTrials = trialsData.length;
$('.js-expt-num-trials').text(totalNumberOfTrials);
$('.js-expt-num-blocks').text(totalNumberOfBlocks);
trialData.push(headers);
next();
participantId = ACPToolKit.getCurrentParticipantId();
})
});
</script>
</body>
</html>