-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exp 1 Practice.html
215 lines (188 loc) · 6.73 KB
/
Exp 1 Practice.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html>
<head>
<title>Exp 1 P</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/FileSaver.min.js"></script>
<style>
#imageContainer {
width: 600px;
height: 500px;
margin: 0 auto;
text-align: center;
}
#image {
max-width: 90%;
}
#hiddenImageContainer {
display: flex;
justify-content: center; /* Center horizontally */
align-items: center; /* Center vertically */
height: 100%; /* Make it fill the container's height */
}
#hiddenImage {
max-width: 57%;
display: none; /* Initially hidden */
}
.buttons {
display: flex;
width: 100%;
min-height: 10vh;
background: #0b0423;
align-items: center;
justify-content: center;
margin-bottom: 20px;
border: .5px solid #2d9ece;
}
button {
position: relative;
display: inline-block;
margin: 10px;
padding: 10px 20px;
text-align: center;
font-size: 13px;
letter-spacing: 1px;
text-decoration: none;
color: #725AC1;
background: transparent;
cursor: pointer;
transition: ease-out 0.5s;
border: 2px solid #725AC1;
border-radius: 15px;
box-shadow: inset 0 0 0 0 #725AC1;
}
button:hover {
color: white;
box-shadow: inset 0 -100px 0 0 #725AC1;
}
button:active {
transform: scale(0.9);
}
.input {
border: none;
outline: none;
border-radius: 15px;
padding: 1em;
background-color: #ccc;
box-shadow: inset 2px 5px 10px rgba(0,0,0,0.3);
transition: 300ms ease-in-out;
}
.input:focus {
background-color: #dfede9;
transform: scale(1.04);
box-shadow: 13px 13px 100px #969696,
-13px -13px 100px #0b0423;
}
.label {
font-size: 16px;
letter-spacing: 1px;
text-decoration: none;
color: #725AC1;
background: transparent;
}
.slider-container {
display: none;
margin-top: 20px;
position: relative;
}
.slider-label {
display: block;
text-align: center;
}
.slider-numbers {
display: flex;
justify-content: space-between;
margin-top: 10px;
}
.slider-number {
width: 20px;
text-align: center;
}
/* Customize the slider's appearance */
#response-slider {
width: 100%; /* Adjust the width as desired */
height: 30px; /* Adjust the height as desired */
margin: 0 auto; /* Center the slider horizontally */
}
</style>
</head>
<body>
<div class="buttons">
<label for="case-number" class="label">কোড:</label>
<input type="text" autocomplete="off" name="text" class="input" placeholder="insert Code" id="case-number">
<button id="start-button" onclick="start()">Start</button>
<button onclick="download()">Download Results</button>
</div>
<div id="imageContainer">
<img id="image" src="Image/0.0.png">
<div class="slider-container">
<label class="slider-label">Drag to rate your response:</label>
<input type="range" id="response-slider" min="1" max="5" step="1" value="3">
<div class="slider-numbers">
<div class="slider-number">1</div>
<div class="slider-number">2</div>
<div class="slider-number">3</div>
<div class="slider-number">4</div>
<div class="slider-number">5</div>
</div>
</div>
</div>
<div id="hiddenImageContainer"> <!-- New container for the hidden image -->
<img id="hiddenImage" src="Image/line.PNG">
</div>
<script>
var imageIndex = 1;
var images = ['Image/0.0.png', 'Image/0.0.png', 'Image/0.0.png', 'Image/1.1.png','Image/1.jpg','Image/2.1.png', 'Image/2.jpg', 'Image/3.1.png', 'Image/3.jpg', 'Image/4.1.png', 'Image/4.jpg', 'Image/5.1.png', 'Image/5.jpg', 'Image/31.png'];
var startTime;
var results = "";
var caseNumber;
var startButton = document.getElementById("start-button");
var sliderContainer = document.querySelector(".slider-container");
var responseSlider = document.getElementById("response-slider");
responseSlider.addEventListener("mouseup", function() {
if ((imageIndex % 2) === 0 ) {
recordResponse();
imageIndex++;
nextImage();
}
});
function start() {
caseNumber = document.getElementById("case-number").value;
startButton.disabled = true; // Disable the start button once it's clicked
showImage(images[imageIndex]);
}
function showImage(image) {
document.getElementById("image").src = image;
document.getElementById("hiddenImage").style.display = "none"; // Hide the hidden image by default
if (imageIndex === 13) {
sliderContainer.style.display = "none";
download();
} else if ((imageIndex % 2) === 1 || imageIndex === 1 || imageIndex === 2 ) {
// For the first two images, set a timeout of 4 seconds before proceeding to the next image
setTimeout(function() {
imageIndex++;
nextImage();
}, 1000);
sliderContainer.style.display = "none";
} else if ((imageIndex % 2) === 0) {
startTime = Date.now(); // Record the start time of the third slide
document.getElementById("hiddenImage").style.display = "block"; // Show the hidden image
sliderContainer.style.display = "block";
} else {
sliderContainer.style.display = "none"; // Hide the slider for other slides
}
}
function nextImage() {
showImage(images[imageIndex]);
}
function recordResponse() {
var responseValue = responseSlider.value;
var responseTime = Date.now() - startTime;
results += "RT for image " + imageIndex + " is: " + responseTime + " ms" + " & Response rating: " + responseValue + "\n";
}
function download() {
var blob = new Blob([results], {type: "text/plain;charset=utf-8"});
saveAs(blob, "Rating Results - " + caseNumber + "_P.txt");
}
</script>
</body>
</html>