Fixing some bugs due to change in the plugin structure.

This commit is contained in:
Josh de Leeuw 2012-05-23 12:18:57 -04:00
parent befdcfc1cd
commit 94610dbccc
3 changed files with 12 additions and 12 deletions

View File

@ -6,7 +6,7 @@
// way to provide corrective feedback // way to provide corrective feedback
(function( $ ) { (function( $ ) {
jsPsych.categorize-feedback = (function(){ jsPsych.categorize_feedback = (function(){
var plugin = {}; var plugin = {};
@ -16,7 +16,7 @@
for(var i = 0; i < trials.length; i++) for(var i = 0; i < trials.length; i++)
{ {
trials[i] = {}; trials[i] = {};
trials[i]["type"] = "categorize-feedback"; trials[i]["type"] = "categorize_feedback";
trials[i]["a_path"] = cf_stims[i]; trials[i]["a_path"] = cf_stims[i];
trials[i]["timing"] = params["timing"]; trials[i]["timing"] = params["timing"];
trials[i]["key_answer"] = params["key_answer"][i]; trials[i]["key_answer"] = params["key_answer"][i];
@ -45,11 +45,11 @@
"class": 'cf' "class": 'cf'
})); }));
if(trial.timing[2]!=undefined){ if(trial.timing[2]!=undefined){
setTimeout(function(){cf_trial($this, block, trial, part + 1);}, trial.timing[2]); setTimeout(function(){plugin.trial($this, block, trial, part + 1);}, trial.timing[2]);
} else { } else {
//show prompt here //show prompt here
$this.append(trial.prompt); $this.append(trial.prompt);
cf_trial($this, block, trial, part + 1); plugin.trial($this, block, trial, part + 1);
} }
break; break;
case 2: case 2:
@ -88,7 +88,7 @@
block.data[block.trial_idx] = $.extend({},trial_data,trial.data); block.data[block.trial_idx] = $.extend({},trial_data,trial.data);
$(document).unbind('keyup',resp_func); $(document).unbind('keyup',resp_func);
$this.html(''); $this.html('');
cf_trial($this, block, trial, part + 1); plugin.trial($this, block, trial, part + 1);
} }
} }
$(document).keyup(resp_func); $(document).keyup(resp_func);
@ -110,7 +110,7 @@
atext = trial.incorrect_text.replace("&ANS&", trial.text_answer); atext = trial.incorrect_text.replace("&ANS&", trial.text_answer);
} }
$this.append(atext); $this.append(atext);
setTimeout(function(){cf_trial($this, block, trial, part + 1);}, trial.timing[0]); setTimeout(function(){plugin.trial($this, block, trial, part + 1);}, trial.timing[0]);
break; break;
case 4: case 4:
$this.html(""); $this.html("");

View File

@ -2,7 +2,7 @@
// if optional length to display target is missing, then target is displayed until subject responds. // if optional length to display target is missing, then target is displayed until subject responds.
(function( $ ) { (function( $ ) {
jsPsych.categorize-unknown = (function(){ jsPsych.categorize_unknown = (function(){
var plugin = {}; var plugin = {};
@ -12,7 +12,7 @@
for(var i = 0; i < trials.length; i++) for(var i = 0; i < trials.length; i++)
{ {
trials[i] = {}; trials[i] = {};
trials[i]["type"] = "categorize-unknown"; trials[i]["type"] = "categorize_unknown";
trials[i]["a_path"] = cu_stims[i]; trials[i]["a_path"] = cu_stims[i];
trials[i]["timing"] = params["timing"]; trials[i]["timing"] = params["timing"];
trials[i]["choices"] = params["choices"]; trials[i]["choices"] = params["choices"];
@ -36,11 +36,11 @@
"class": 'cu' "class": 'cu'
})); }));
if(trial.timing[1]!=undefined){ if(trial.timing[1]!=undefined){
setTimeout(function(){cu_trial($this, block, trial, part + 1);}, trial.timing[1]); setTimeout(function(){plugin.trial($this, block, trial, part + 1);}, trial.timing[1]);
} else { } else {
//show prompt here //show prompt here
$this.append(trial.prompt); $this.append(trial.prompt);
cu_trial($this, block, trial, part + 1); plugin.trial($this, block, trial, part + 1);
} }
break; break;
case 2: case 2:

View File

@ -32,12 +32,12 @@
"src": trial.a_path, "src": trial.a_path,
"class": 'xab' "class": 'xab'
})); }));
setTimeout(function(){xab_trial($this, block, trial, part + 1)}, trial.timing[0]); setTimeout(function(){plugin.trial($this, block, trial, part + 1)}, trial.timing[0]);
break; break;
case 2: case 2:
p2_time = (new Date()).getTime(); p2_time = (new Date()).getTime();
$('.xab').remove(); $('.xab').remove();
setTimeout(function(){xab_trial($this, block, trial, part + 1)}, trial.timing[1]); setTimeout(function(){plugin.trial($this, block, trial, part + 1)}, trial.timing[1]);
break; break;
case 3: case 3:
p3_time = (new Date()).getTime(); p3_time = (new Date()).getTime();