Commit a8548d22 authored by Julian Kirkeby Lysvik's avatar Julian Kirkeby Lysvik

First commit

parent 565afea7
......@@ -301,8 +301,8 @@
</TextComponent>
<CodeComponent name="textinput">
<Param name="Begin Experiment" updates="constant" val="inputText = &quot;&quot;" valType="extendedCode"/>
<Param name="Begin JS Experiment" updates="constant" val="function inputText() {&amp;#10; var x = document.createElement(&quot;INPUT&quot;);&amp;#10; x.setAttribute(&quot;type&quot;, &quot;text&quot;);&amp;#10; x.setAttribute(&quot;value&quot;, &quot;&quot;);&amp;#10; document.body.appendChild(x);&amp;#10;}" valType="extendedCode"/>
<Param name="Begin JS Routine" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin JS Experiment" updates="constant" val="inputText = '';" valType="extendedCode"/>
<Param name="Begin JS Routine" updates="constant" val="function inputText() {&amp;#10; var x = document.createElement(&quot;INPUT&quot;);&amp;#10; x.setAttribute(&quot;type&quot;, &quot;text&quot;);&amp;#10; x.setAttribute(&quot;value&quot;, &quot;&quot;);&amp;#10; document.body.appendChild(x);&amp;#10;}" valType="extendedCode"/>
<Param name="Begin Routine" updates="constant" val="theseKeys=&quot;&quot;&amp;#10;shift_flag = False&amp;#10;txtinp.alignHoriz ='center'" valType="extendedCode"/>
<Param name="Code Type" updates="None" val="Both" valType="str"/>
<Param name="Each Frame" updates="constant" val="n= len(theseKeys)&amp;#10;i = 0&amp;#10;while i &lt; n:&amp;#10;&amp;#10; if theseKeys[i] == 'return' and len(inputText) &gt;1:&amp;#10; # pressing RETURN means time to stop&amp;#10; continueRoutine = False&amp;#10; break&amp;#10;&amp;#10; elif theseKeys[i] == 'backspace':&amp;#10; inputText = inputText[:-1] # lose the final character&amp;#10; i = i + 1&amp;#10;&amp;#10; elif theseKeys[i] == 'space':&amp;#10; inputText += ' '&amp;#10; i = i + 1&amp;#10;&amp;#10; elif theseKeys[i] in ['lshift', 'rshift']:&amp;#10; shift_flag = True&amp;#10; i = i + 1&amp;#10;&amp;#10; else:&amp;#10; if len(theseKeys[i]) == 1:&amp;#10; # we only have 1 char so should be a normal key, &amp;#10; # otherwise it might be 'ctrl' or similar so ignore it&amp;#10; if shift_flag:&amp;#10; inputText += chr( ord(theseKeys[i]) - ord(' '))&amp;#10; shift_flag = False&amp;#10; else:&amp;#10; inputText += theseKeys[i]&amp;#10;&amp;#10; i = i + 1&amp;#10;" valType="extendedCode"/>
......
......@@ -116,6 +116,7 @@ var Target_ins1;
var Trigger_img1;
var Target_img1;
var Trigger_txt1;
var inputText;
var txtinp;
var Instruction_FCClock;
var image_6;
......@@ -267,12 +268,7 @@ function experimentInit() {
depth: -3.0
});
function inputText() {
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
x.setAttribute("value", "");
document.body.appendChild(x);
}
inputText = '';
txtinp = new visual.TextStim({
win: psychoJS.window,
name: 'txtinp',
......@@ -1047,7 +1043,12 @@ function Test_ProdRoutineBegin() {
Trigger_img1.setImage(trig_img);
Target_img1.setImage(targ_img);
Trigger_txt1.setText(trig);
function inputText() {
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
x.setAttribute("value", "");
document.body.appendChild(x);
}
text_resp = new core.BuilderKeyResponse(psychoJS);
// keep track of which components have finished
Test_ProdComponents = [];
......
......@@ -108,6 +108,7 @@ var Target_ins1;
var Trigger_img1;
var Target_img1;
var Trigger_txt1;
var inputText;
var txtinp;
var Instruction_FCClock;
var image_6;
......@@ -259,12 +260,7 @@ function experimentInit() {
depth: -3.0
});
function inputText() {
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
x.setAttribute("value", "");
document.body.appendChild(x);
}
inputText = '';
txtinp = new visual.TextStim({
win: psychoJS.window,
name: 'txtinp',
......@@ -1039,7 +1035,12 @@ function Test_ProdRoutineBegin() {
Trigger_img1.setImage(trig_img);
Target_img1.setImage(targ_img);
Trigger_txt1.setText(trig);
function inputText() {
var x = document.createElement("INPUT");
x.setAttribute("type", "text");
x.setAttribute("value", "");
document.body.appendChild(x);
}
text_resp = new core.BuilderKeyResponse(psychoJS);
// keep track of which components have finished
Test_ProdComponents = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment