Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
B
Brookes Template 2020
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wakefield Morys-Carter
Brookes Template 2020
Commits
ec31e578
Commit
ec31e578
authored
4 years ago
by
Wakefield Morys-Carter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keyboard counter
parent
1714e57d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
68 deletions
+66
-68
html/template-legacy-browsers.js
html/template-legacy-browsers.js
+32
-32
html/template.js
html/template.js
+32
-32
html/typing.html
html/typing.html
+1
-3
html/typing.html.$$$
html/typing.html.$$$
+1
-1
No files found.
html/template-legacy-browsers.js
View file @
ec31e578
...
...
@@ -123,7 +123,8 @@ var firstLetter;
var
text_3
;
var
free_typingClock
;
var
iframe_loading_3
;
var
key_resp_2
;
var
keysPressed
;
var
text_4
;
var
random_seedClock
;
var
seedString
;
var
randomnum1
;
...
...
@@ -227,7 +228,18 @@ function experimentInit() {
depth
:
0.0
});
key_resp_2
=
new
core
.
Keyboard
({
psychoJS
:
psychoJS
,
clock
:
new
util
.
Clock
(),
waitForStart
:
true
});
keysPressed
=
0
;
text_4
=
new
visual
.
TextStim
({
win
:
psychoJS
.
window
,
name
:
'
text_4
'
,
text
:
''
,
font
:
'
Arial
'
,
units
:
undefined
,
pos
:
[
0.45
,
0.45
],
height
:
0.1
,
wrapWidth
:
undefined
,
ori
:
0
,
color
:
new
util
.
Color
(
'
white
'
),
opacity
:
1
,
depth
:
-
3.0
});
// Initialize components for Routine "random_seed"
random_seedClock
=
new
util
.
Clock
();
...
...
@@ -770,7 +782,6 @@ function first_letterRoutineEnd(trials) {
}
var
_key_resp_2_allKeys
;
var
free_typingComponents
;
function
free_typingRoutineBegin
(
trials
)
{
return
function
()
{
...
...
@@ -811,13 +822,10 @@ function free_typingRoutineBegin(trials) {
});
});
//$('#iframe').attr( 'src', function(i,val){ return val;} );
key_resp_2
.
keys
=
undefined
;
key_resp_2
.
rt
=
undefined
;
_key_resp_2_allKeys
=
[];
// keep track of which components have finished
free_typingComponents
=
[];
free_typingComponents
.
push
(
iframe_loading_3
);
free_typingComponents
.
push
(
key_resp_2
);
free_typingComponents
.
push
(
text_4
);
free_typingComponents
.
forEach
(
function
(
thisComponent
)
{
if
(
'
status
'
in
thisComponent
)
...
...
@@ -829,6 +837,7 @@ function free_typingRoutineBegin(trials) {
}
var
frameRemains
;
function
free_typingRoutineEachFrame
(
trials
)
{
return
function
()
{
//------Loop for each frame of Routine 'free_typing'-------
...
...
@@ -848,30 +857,26 @@ function free_typingRoutineEachFrame(trials) {
}
continueRoutine
=
continue_routine
;
keys
=
event
.
getKey
();
if
(
keys
.
length
)
{
keysPressed
+=
1
;
text_4
.
text
=
keysPressed
.
toString
();
}
// *
key_resp_2
* updates
if
(
t
>=
0.0
&&
key_resp_2
.
status
===
PsychoJS
.
Status
.
NOT_STARTED
)
{
// *
text_4
* updates
if
(
t
>=
0.0
&&
text_4
.
status
===
PsychoJS
.
Status
.
NOT_STARTED
)
{
// keep track of start time/frame for later
key_resp_2
.
tStart
=
t
;
// (not accounting for frame time here)
key_resp_2
.
frameNStart
=
frameN
;
// exact frame index
text_4
.
tStart
=
t
;
// (not accounting for frame time here)
text_4
.
frameNStart
=
frameN
;
// exact frame index
// keyboard checking is just starting
psychoJS
.
window
.
callOnFlip
(
function
()
{
key_resp_2
.
clock
.
reset
();
});
// t=0 on next screen flip
psychoJS
.
window
.
callOnFlip
(
function
()
{
key_resp_2
.
start
();
});
// start on screen flip
psychoJS
.
window
.
callOnFlip
(
function
()
{
key_resp_2
.
clearEvents
();
});
text_4
.
setAutoDraw
(
true
);
}
if
(
key_resp_2
.
status
===
PsychoJS
.
Status
.
STARTED
)
{
let
theseKeys
=
key_resp_2
.
getKeys
({
keyList
:
[
'
y
'
,
'
n
'
],
waitRelease
:
false
});
_key_resp_2_allKeys
=
_key_resp_2_allKeys
.
concat
(
theseKeys
);
if
(
_key_resp_2_allKeys
.
length
>
0
)
{
key_resp_2
.
keys
=
_key_resp_2_allKeys
[
_key_resp_2_allKeys
.
length
-
1
].
name
;
// just the last key pressed
key_resp_2
.
rt
=
_key_resp_2_allKeys
[
_key_resp_2_allKeys
.
length
-
1
].
rt
;
// a response ends the routine
continueRoutine
=
false
;
}
frameRemains
=
0.0
+
1.0
-
psychoJS
.
window
.
monitorFramePeriod
*
0.75
;
// most of one frame period left
if
(
text_4
.
status
===
PsychoJS
.
Status
.
STARTED
&&
t
>=
frameRemains
)
{
text_4
.
setAutoDraw
(
false
);
}
// check for quit (typically the Esc key)
if
(
psychoJS
.
experiment
.
experimentEnded
||
psychoJS
.
eventManager
.
getKeys
({
keyList
:[
'
escape
'
]}).
length
>
0
)
{
return
quitPsychoJS
(
'
The [Escape] key was pressed. Goodbye!
'
,
false
);
...
...
@@ -917,13 +922,6 @@ function free_typingRoutineEnd(trials) {
showVideo
=
psychoJS
.
experiment
.
_currentTrialData
[
'
showVideo
'
];
showSeed
=
psychoJS
.
experiment
.
_currentTrialData
[
'
showSeed
'
];
psychoJS
.
experiment
.
addData
(
'
key_resp_2.keys
'
,
key_resp_2
.
keys
);
if
(
typeof
key_resp_2
.
keys
!==
'
undefined
'
)
{
// we had a response
psychoJS
.
experiment
.
addData
(
'
key_resp_2.rt
'
,
key_resp_2
.
rt
);
routineTimer
.
reset
();
}
key_resp_2
.
stop
();
// the Routine "free_typing" was not non-slip safe, so reset the non-slip timer
routineTimer
.
reset
();
...
...
@@ -2092,6 +2090,8 @@ function quitPsychoJS(message, isCompleted) {
...
...
This diff is collapsed.
Click to expand it.
html/template.js
View file @
ec31e578
...
...
@@ -131,7 +131,8 @@ var firstLetter;
var
text_3
;
var
free_typingClock
;
var
iframe_loading_3
;
var
key_resp_2
;
var
keysPressed
;
var
text_4
;
var
random_seedClock
;
var
seedString
;
var
randomnum1
;
...
...
@@ -235,7 +236,18 @@ function experimentInit() {
depth
:
0.0
});
key_resp_2
=
new
core
.
Keyboard
({
psychoJS
:
psychoJS
,
clock
:
new
util
.
Clock
(),
waitForStart
:
true
});
keysPressed
=
0
;
text_4
=
new
visual
.
TextStim
({
win
:
psychoJS
.
window
,
name
:
'
text_4
'
,
text
:
''
,
font
:
'
Arial
'
,
units
:
undefined
,
pos
:
[
0.45
,
0.45
],
height
:
0.1
,
wrapWidth
:
undefined
,
ori
:
0
,
color
:
new
util
.
Color
(
'
white
'
),
opacity
:
1
,
depth
:
-
3.0
});
// Initialize components for Routine "random_seed"
random_seedClock
=
new
util
.
Clock
();
...
...
@@ -775,7 +787,6 @@ function first_letterRoutineEnd(trials) {
}
var
_key_resp_2_allKeys
;
var
free_typingComponents
;
function
free_typingRoutineBegin
(
trials
)
{
return
function
()
{
...
...
@@ -816,13 +827,10 @@ function free_typingRoutineBegin(trials) {
});
});
//$('#iframe').attr( 'src', function(i,val){ return val;} );
key_resp_2
.
keys
=
undefined
;
key_resp_2
.
rt
=
undefined
;
_key_resp_2_allKeys
=
[];
// keep track of which components have finished
free_typingComponents
=
[];
free_typingComponents
.
push
(
iframe_loading_3
);
free_typingComponents
.
push
(
key_resp_2
);
free_typingComponents
.
push
(
text_4
);
for
(
const
thisComponent
of
free_typingComponents
)
if
(
'
status
'
in
thisComponent
)
...
...
@@ -833,6 +841,7 @@ function free_typingRoutineBegin(trials) {
}
var
frameRemains
;
function
free_typingRoutineEachFrame
(
trials
)
{
return
function
()
{
//------Loop for each frame of Routine 'free_typing'-------
...
...
@@ -852,30 +861,26 @@ function free_typingRoutineEachFrame(trials) {
}
continueRoutine
=
continue_routine
;
keys
=
event
.
getKey
();
if
(
keys
.
length
)
{
keysPressed
+=
1
;
text_4
.
text
=
keysPressed
.
toString
();
}
// *
key_resp_2
* updates
if
(
t
>=
0.0
&&
key_resp_2
.
status
===
PsychoJS
.
Status
.
NOT_STARTED
)
{
// *
text_4
* updates
if
(
t
>=
0.0
&&
text_4
.
status
===
PsychoJS
.
Status
.
NOT_STARTED
)
{
// keep track of start time/frame for later
key_resp_2
.
tStart
=
t
;
// (not accounting for frame time here)
key_resp_2
.
frameNStart
=
frameN
;
// exact frame index
text_4
.
tStart
=
t
;
// (not accounting for frame time here)
text_4
.
frameNStart
=
frameN
;
// exact frame index
// keyboard checking is just starting
psychoJS
.
window
.
callOnFlip
(
function
()
{
key_resp_2
.
clock
.
reset
();
});
// t=0 on next screen flip
psychoJS
.
window
.
callOnFlip
(
function
()
{
key_resp_2
.
start
();
});
// start on screen flip
psychoJS
.
window
.
callOnFlip
(
function
()
{
key_resp_2
.
clearEvents
();
});
text_4
.
setAutoDraw
(
true
);
}
if
(
key_resp_2
.
status
===
PsychoJS
.
Status
.
STARTED
)
{
let
theseKeys
=
key_resp_2
.
getKeys
({
keyList
:
[
'
y
'
,
'
n
'
],
waitRelease
:
false
});
_key_resp_2_allKeys
=
_key_resp_2_allKeys
.
concat
(
theseKeys
);
if
(
_key_resp_2_allKeys
.
length
>
0
)
{
key_resp_2
.
keys
=
_key_resp_2_allKeys
[
_key_resp_2_allKeys
.
length
-
1
].
name
;
// just the last key pressed
key_resp_2
.
rt
=
_key_resp_2_allKeys
[
_key_resp_2_allKeys
.
length
-
1
].
rt
;
// a response ends the routine
continueRoutine
=
false
;
}
frameRemains
=
0.0
+
1.0
-
psychoJS
.
window
.
monitorFramePeriod
*
0.75
;
// most of one frame period left
if
(
text_4
.
status
===
PsychoJS
.
Status
.
STARTED
&&
t
>=
frameRemains
)
{
text_4
.
setAutoDraw
(
false
);
}
// check for quit (typically the Esc key)
if
(
psychoJS
.
experiment
.
experimentEnded
||
psychoJS
.
eventManager
.
getKeys
({
keyList
:[
'
escape
'
]}).
length
>
0
)
{
return
quitPsychoJS
(
'
The [Escape] key was pressed. Goodbye!
'
,
false
);
...
...
@@ -921,13 +926,6 @@ function free_typingRoutineEnd(trials) {
showVideo
=
psychoJS
.
experiment
.
_currentTrialData
[
'
showVideo
'
];
showSeed
=
psychoJS
.
experiment
.
_currentTrialData
[
'
showSeed
'
];
psychoJS
.
experiment
.
addData
(
'
key_resp_2.keys
'
,
key_resp_2
.
keys
);
if
(
typeof
key_resp_2
.
keys
!==
'
undefined
'
)
{
// we had a response
psychoJS
.
experiment
.
addData
(
'
key_resp_2.rt
'
,
key_resp_2
.
rt
);
routineTimer
.
reset
();
}
key_resp_2
.
stop
();
// the Routine "free_typing" was not non-slip safe, so reset the non-slip timer
routineTimer
.
reset
();
...
...
@@ -2086,6 +2084,8 @@ function quitPsychoJS(message, isCompleted) {
...
...
This diff is collapsed.
Click to expand it.
html/typing.html
View file @
ec31e578
...
...
@@ -40,9 +40,7 @@ var firstLetter = getUrlParam('firstLetter','Empty');
<p>
<textarea
name=
typedText
rows=
"10"
cols=
"50"
>
<script
type=
"text/javascript"
>
document
.
write
(
firstLetter
);
</script></textarea>
</textarea>
<span
class=
"style1"
>
<input
type=
"submit"
name=
"Submit"
value=
"Submit"
>
</span>
</p>
...
...
This diff is collapsed.
Click to expand it.
html/typing.html.$$$
View file @
ec31e578
...
...
@@ -33,7 +33,7 @@ var firstLetter = getUrlParam('firstLetter','Empty');
</style>
</head>
<body
style=
"width: 640px; background-color: grey; color: white; font-size: 24px"
>
<body
style=
"width: 640px; background-color: grey; color: white; font-size: 24px"
OnLoad=
"document.form1.typedText.focus();"
>
<center>
<form
name=
"form1"
method=
"post"
action=
""
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment