diff --git a/jspsych-animation.js b/jspsych-animation.js
index 526356e4..187c6ea0 100644
--- a/jspsych-animation.js
+++ b/jspsych-animation.js
@@ -41,7 +41,7 @@
reps++;
if(reps >= trial.repetitions)
{
- animation_trial($this, block, trial, part + 1);
+ plugin.trial($this, block, trial, part + 1);
clearInterval(animate_interval);
showImage = false;
}
diff --git a/jspsych-samedifferent.js b/jspsych-samedifferent.js
old mode 100755
new mode 100644
index d77015c4..131dc936
--- a/jspsych-samedifferent.js
+++ b/jspsych-samedifferent.js
@@ -1,97 +1,97 @@
-(function( $ ) {
- jsPsych.samedifferent = (function(){
-
- var plugin = {};
-
- plugin.create = function(params) {
- sd_stims = params["stimuli"];
- trials = new Array(sd_stims.length);
- for(var i = 0; i < trials.length; i++)
- {
- trials[i] = {};
- trials[i]["type"] = "samedifferent";
- trials[i]["a_path"] = sd_stims[i][0];
- trials[i]["b_path"] = sd_stims[i][1];
- trials[i]["timing"] = params["timing"];
- trials[i]["answer"] = params["answer"][i];
- if(params["prompt"] != undefined){
- trials[i]["prompt"] = params["prompt"];
- }
- if(params["data"]!=undefined){
- trials[i]["data"] = params["data"][i];
- }
- }
- return trials;
- }
-
- plugin.trial = function($this, block, trial, part)
- {
- switch(part){
- case 1:
- p1_time = (new Date()).getTime();
- $this.append($('', {
- "src": trial.a_path,
- "class": 'sd'
- }));
- setTimeout(function(){sd_trial($this, block, trial, part + 1);}, trial.timing[0]);
- break;
- case 2:
- p2_time = (new Date()).getTime();
- $('.sd').remove();
- setTimeout(function(){sd_trial($this, block, trial, part + 1);}, trial.timing[1]);
- break;
- case 3:
- p3_time = (new Date()).getTime();
- $this.append($('
', {
- "src": trial.b_path,
- "class": 'sd'
- }));
- if(trial.timing[3]!=undefined){
- setTimeout(function(){sd_trial($this, block, trial, part + 1);}, trial.timing[3]);
- } else {
- sd_trial($this, block, trial, part + 1);
- }
- break;
- case 4:
- p4_time = (new Date()).getTime();
- if(trial.timing[3]!=undefined){
- $('.sd').remove();
- $this.html(trial.prompt);
- }
- startTime = (new Date()).getTime();
- var resp_func = function(e) {
- var flag = false;
- var correct = false;
- if(e.which=='80') // 'p' key -- same
- {
- flag = true;
- if(trial.answer == "same") { correct = true; }
- } else if(e.which=='81') // 'q' key -- different
- {
- flag = true;
- if(trial.answer == "different"){ correct = true; }
- }
- if(flag)
- {
- endTime = (new Date()).getTime();
- rt = (endTime-startTime);
- stim1_time = (p2_time-p1_time);
- isi_time = (p3_time-p2_time);
- stim2_time = (p4_time-p3_time);
- var trial_data = {"rt": rt, "correct": correct, "a_path": trial.a_path, "b_path": trial.b_path, "key_press": e.which, "stim1_time": stim1_time, "stim2_time":stim2_time, "isi_time":isi_time}
- block.data[block.trial_idx] = $.extend({},trial_data,trial.data);
- $(document).unbind('keyup',resp_func);
- $('.sd').remove();
- $this.html('');
- setTimeout(function(){block.next();}, trial.timing[2]);
- }
- }
- $(document).keyup(resp_func);
- break;
- }
- }
-
- return plugin;
- })();
-}) (jQuery);
+(function( $ ) {
+ jsPsych.samedifferent = (function(){
+
+ var plugin = {};
+
+ plugin.create = function(params) {
+ sd_stims = params["stimuli"];
+ trials = new Array(sd_stims.length);
+ for(var i = 0; i < trials.length; i++)
+ {
+ trials[i] = {};
+ trials[i]["type"] = "samedifferent";
+ trials[i]["a_path"] = sd_stims[i][0];
+ trials[i]["b_path"] = sd_stims[i][1];
+ trials[i]["timing"] = params["timing"];
+ trials[i]["answer"] = params["answer"][i];
+ if(params["prompt"] != undefined){
+ trials[i]["prompt"] = params["prompt"];
+ }
+ if(params["data"]!=undefined){
+ trials[i]["data"] = params["data"][i];
+ }
+ }
+ return trials;
+ }
+
+ plugin.trial = function($this, block, trial, part)
+ {
+ switch(part){
+ case 1:
+ p1_time = (new Date()).getTime();
+ $this.append($('
', {
+ "src": trial.a_path,
+ "class": 'sd'
+ }));
+ setTimeout(function(){plugin.trial($this, block, trial, part + 1);}, trial.timing[0]);
+ break;
+ case 2:
+ p2_time = (new Date()).getTime();
+ $('.sd').remove();
+ setTimeout(function(){plugin.trial($this, block, trial, part + 1);}, trial.timing[1]);
+ break;
+ case 3:
+ p3_time = (new Date()).getTime();
+ $this.append($('
', {
+ "src": trial.b_path,
+ "class": 'sd'
+ }));
+ if(trial.timing[3]!=undefined){
+ setTimeout(function(){plugin.trial($this, block, trial, part + 1);}, trial.timing[3]);
+ } else {
+ plugin.trial($this, block, trial, part + 1);
+ }
+ break;
+ case 4:
+ p4_time = (new Date()).getTime();
+ if(trial.timing[3]!=undefined){
+ $('.sd').remove();
+ $this.html(trial.prompt);
+ }
+ startTime = (new Date()).getTime();
+ var resp_func = function(e) {
+ var flag = false;
+ var correct = false;
+ if(e.which=='80') // 'p' key -- same
+ {
+ flag = true;
+ if(trial.answer == "same") { correct = true; }
+ } else if(e.which=='81') // 'q' key -- different
+ {
+ flag = true;
+ if(trial.answer == "different"){ correct = true; }
+ }
+ if(flag)
+ {
+ endTime = (new Date()).getTime();
+ rt = (endTime-startTime);
+ stim1_time = (p2_time-p1_time);
+ isi_time = (p3_time-p2_time);
+ stim2_time = (p4_time-p3_time);
+ var trial_data = {"rt": rt, "correct": correct, "a_path": trial.a_path, "b_path": trial.b_path, "key_press": e.which, "stim1_time": stim1_time, "stim2_time":stim2_time, "isi_time":isi_time}
+ block.data[block.trial_idx] = $.extend({},trial_data,trial.data);
+ $(document).unbind('keyup',resp_func);
+ $('.sd').remove();
+ $this.html('');
+ setTimeout(function(){block.next();}, trial.timing[2]);
+ }
+ }
+ $(document).keyup(resp_func);
+ break;
+ }
+ }
+
+ return plugin;
+ })();
+}) (jQuery);
\ No newline at end of file
diff --git a/jspsych-similarity.js b/jspsych-similarity.js
old mode 100755
new mode 100644
index 2174de47..ce109871
--- a/jspsych-similarity.js
+++ b/jspsych-similarity.js
@@ -1,68 +1,68 @@
-(function( $ ) {
- jsPsych.similarity = (function(){
-
- var plugin = {};
-
- plugin.create = function(params) {
- sim_stims = params["stimuli"];
- trials = new Array(sim_stims.length);
- for(var i = 0; i < trials.length; i++)
- {
- trials[i] = {};
- trials[i]["type"] = "similarity";
- trials[i]["a_path"] = sim_stims[i][0];
- trials[i]["b_path"] = sim_stims[i][1];
- trials[i]["timing"] = params["timing"];
- }
- return trials;
- }
-
- plugin.trial = function($this, block, trial, part)
- {
- switch(part){
- case 1:
- images = [trial.a_path, trial.b_path];
- if(Math.floor(Math.random()*2)==0){
- images = [trial.b_path, trial.a_path];
- }
- // show the images
- $this.append($('
', {
- "src": images[0],
- "class": 'sim'
- }));
- $this.append($('
', {
- "src": images[1],
- "class": 'sim'
- }));
-
- // create slider
- $this.append($('