Skip to content

Commit

Permalink
Merge pull request #21 from jodeleeuw/rt-key-down
Browse files Browse the repository at this point in the history
changing keyup to keydown
  • Loading branch information
jodeleeuw committed Jan 28, 2014
2 parents f68b475 + 9558914 commit 02229c8
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions plugins/jspsych-categorize-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@
"key_press": e.which
};
block.writeData($.extend({}, trial_data, trial.data));
$(document).unbind('keyup', resp_func);
$(document).unbind('keydown', resp_func);
}
};
$(document).keyup(resp_func);
$(document).keydown(resp_func);

function endTrial() {
clearInterval(animate_interval); // stop animation!
Expand Down
4 changes: 2 additions & 2 deletions plugins/jspsych-categorize.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@
block.writeData($.extend({}, trial_data, trial.data));

// clear function
$(document).unbind('keyup', resp_func);
$(document).unbind('keydown', resp_func);
display_element.html('');
plugin.trial(display_element, block, trial, part + 1);
}
};

// add event listener
$(document).keyup(resp_func);
$(document).keydown(resp_func);
break;

case 2:
Expand Down
4 changes: 2 additions & 2 deletions plugins/jspsych-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Example Usage:
var t0 = (new Date()).getTime();
var finish = function() {
if (trial.check_fn && !trial.check_fn(display_element)) return;
if (trial.cont_key) $(document).unbind('keyup', key_listener);
if (trial.cont_key) $(document).unbind('keydown', key_listener);
block.writeData({
trial_type: "html",
trial_index: block.trial_idx,
Expand All @@ -88,7 +88,7 @@ Example Usage:
var key_listener = function(e) {
if (e.which == trial.cont_key) finish();
};
$(document).keyup(key_listener);
$(document).keydown(key_listener);
}
});
};
Expand Down
4 changes: 2 additions & 2 deletions plugins/jspsych-same-different.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"key_press": e.which
};
block.data[block.trial_idx] = $.extend({}, trial_data, trial.data);
$(document).unbind('keyup', resp_func);
$(document).unbind('keydown', resp_func);

display_element.html('');
if(trial.timing_post_trial > 0) {
Expand All @@ -149,7 +149,7 @@
}
}
};
$(document).keyup(resp_func);
$(document).keydown(resp_func);
break;
}
};
Expand Down
4 changes: 2 additions & 2 deletions plugins/jspsych-single-stim.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
};

block.writeData($.extend({}, trial_data, trial.data));
$(document).unbind('keyup', resp_func);
$(document).unbind('keydown', resp_func);
display_element.html('');
if (trial.timing_post_trial > 0) {
setTimeout(function() {
Expand Down Expand Up @@ -133,7 +133,7 @@
}
};

$(document).keyup(resp_func);
$(document).keydown(resp_func);

// hide image if timing is set
if (trial.timing_stim > 0) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/jspsych-xab.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"key_press": e.which
};
block.writeData($.extend({}, trial_data, trial.data));
$(document).unbind('keyup', resp_func); // remove response function from keys
$(document).unbind('keydown', resp_func); // remove response function from keys
display_element.html(''); // remove all
xab_trial_complete = true;
// move on to the next trial after timing_post_trial milliseconds
Expand All @@ -201,7 +201,7 @@
}
}
};
$(document).keyup(resp_func);
$(document).keydown(resp_func);
break;
}
};
Expand Down

0 comments on commit 02229c8

Please sign in to comment.