From 30df65e95bcd8954efd1a1d6c5544e50efd361b0 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Mon, 3 Mar 2014 11:47:16 -0500 Subject: [PATCH] First pass at allowing functions as variables --- plugins/jspsych-similarity.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/jspsych-similarity.js b/plugins/jspsych-similarity.js index 98bc1b6c..128009f5 100644 --- a/plugins/jspsych-similarity.js +++ b/plugins/jspsych-similarity.js @@ -55,13 +55,19 @@ var sim_trial_complete = false; plugin.trial = function(display_element, block, trial, part) { + + // if any trial variables are functions + // this evaluates the function and replaces + // it with the output of the function + trial = jsPsych.normalizeTrialVariables(trial); + switch (part) { case 1: sim_trial_complete = false; // show the images if (!trial.is_html) { display_element.append($('', { - "src": trial.a_path, + "src": normed_trial.a_path, "id": 'jspsych_sim_stim' })); } @@ -231,4 +237,4 @@ return plugin; })(); -})(jQuery); \ No newline at end of file +})(jQuery);