mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-11 16:18:11 +00:00
fix attachEventListener -> addEventListener
This commit is contained in:
parent
b9a5ffde2f
commit
00ff20b50c
@ -75,12 +75,12 @@ jsPsych.plugins.html = (function() {
|
|||||||
display_element.innerHTML = '';
|
display_element.innerHTML = '';
|
||||||
jsPsych.finishTrial(trial_data);
|
jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
if (trial.cont_btn) { display_element.querySelector('#'+trial.cont_btn).attachEventListener('click', finish); }
|
if (trial.cont_btn) { display_element.querySelector('#'+trial.cont_btn).addEventListener('click', finish); }
|
||||||
if (trial.cont_key) {
|
if (trial.cont_key) {
|
||||||
var key_listener = function(e) {
|
var key_listener = function(e) {
|
||||||
if (e.which == trial.cont_key) finish();
|
if (e.which == trial.cont_key) finish();
|
||||||
};
|
};
|
||||||
display_element.attachEventListener('keydown', key_listener);
|
display_element.addEventListener('keydown', key_listener);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -247,7 +247,7 @@ jsPsych.plugins.palmer = (function() {
|
|||||||
var startTime = (new Date()).getTime();
|
var startTime = (new Date()).getTime();
|
||||||
|
|
||||||
display_element.innerHTML += '<p><button id="jspsych-palmer-submitButton" class="jspsych-btn" type="button">Submit Answer</button></p>';
|
display_element.innerHTML += '<p><button id="jspsych-palmer-submitButton" class="jspsych-btn" type="button">Submit Answer</button></p>';
|
||||||
display_element.querySelector('#jspsych-palmer-submitButton').attachEventListener('click', function() {
|
display_element.querySelector('#jspsych-palmer-submitButton').addEventListener('click', function() {
|
||||||
save_data();
|
save_data();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ jsPsych.plugins['reconstruction'] = (function() {
|
|||||||
// add submit button
|
// add submit button
|
||||||
display_element.innerHTML += '<button id="jspsych-reconstruction-next" class="jspsych-btn jspsych-reconstruction">Submit Answers</button>';
|
display_element.innerHTML += '<button id="jspsych-reconstruction-next" class="jspsych-btn jspsych-reconstruction">Submit Answers</button>';
|
||||||
|
|
||||||
display_element.querySelector('#jspsych-reconstruction-next').attachEventListener('click', endTrial);
|
display_element.querySelector('#jspsych-reconstruction-next').addEventListener('click', endTrial);
|
||||||
}
|
}
|
||||||
|
|
||||||
function endTrial() {
|
function endTrial() {
|
||||||
|
@ -239,7 +239,7 @@ jsPsych.plugins.similarity = (function() {
|
|||||||
display_element.append(trial.prompt);
|
display_element.append(trial.prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
display_element.querySelector("#next").attachEventListener('click', function() {
|
display_element.querySelector("#next").addEventListener('click', function() {
|
||||||
var endTime = (new Date()).getTime();
|
var endTime = (new Date()).getTime();
|
||||||
var response_time = endTime - startTime;
|
var response_time = endTime - startTime;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ jsPsych.plugins['survey-likert'] = (function() {
|
|||||||
// add submit button
|
// add submit button
|
||||||
display_element.innerHTML += '<button id="jspsych-survey-likert" class="jspsych-survey-likert jspsych-btn">Submit Answers</button>';
|
display_element.innerHTML += '<button id="jspsych-survey-likert" class="jspsych-survey-likert jspsych-btn">Submit Answers</button>';
|
||||||
|
|
||||||
display_element.querySelector('#jspsych-survey-likert-next').attachEventListener('click', function(){
|
display_element.querySelector('#jspsych-survey-likert-next').addEventListener('click', function(){
|
||||||
// measure response time
|
// measure response time
|
||||||
var endTime = (new Date()).getTime();
|
var endTime = (new Date()).getTime();
|
||||||
var response_time = endTime - startTime;
|
var response_time = endTime - startTime;
|
||||||
|
@ -82,7 +82,7 @@ jsPsych.plugins['survey-text'] = (function() {
|
|||||||
// add submit button
|
// add submit button
|
||||||
display_element.innerHTML += '<button id="jspsych-survey-text-next" class="jspsych-btn jspsych-survey-text">Submit Answers</button>';
|
display_element.innerHTML += '<button id="jspsych-survey-text-next" class="jspsych-btn jspsych-survey-text">Submit Answers</button>';
|
||||||
|
|
||||||
display_element.querySelector('#jspsych-survey-text-next').attachEventListener('click', function() {
|
display_element.querySelector('#jspsych-survey-text-next').addEventListener('click', function() {
|
||||||
// measure response time
|
// measure response time
|
||||||
var endTime = (new Date()).getTime();
|
var endTime = (new Date()).getTime();
|
||||||
var response_time = endTime - startTime;
|
var response_time = endTime - startTime;
|
||||||
|
@ -74,7 +74,7 @@ jsPsych.plugins.text = (function() {
|
|||||||
|
|
||||||
// check if key is 'mouse'
|
// check if key is 'mouse'
|
||||||
if (trial.choices == 'mouse') {
|
if (trial.choices == 'mouse') {
|
||||||
display_element.attachEventListener(mouse_listener);
|
display_element.addEventListener(mouse_listener);
|
||||||
var start_time = (new Date()).getTime();
|
var start_time = (new Date()).getTime();
|
||||||
} else {
|
} else {
|
||||||
jsPsych.pluginAPI.getKeyboardResponse({
|
jsPsych.pluginAPI.getKeyboardResponse({
|
||||||
|
Loading…
Reference in New Issue
Block a user