/* jspsych-text.js
* Josh de Leeuw
*
* This plugin displays text (including HTML formatted strings) during the experiment.
* Use it to show instructions, provide performance feedback, etc...
*
* documentation: docs.jspsych.org
*
*
*/
jsPsych.plugins.instructions = (function() {
var plugin = {};
plugin.trial = function(display_element, trial) {
trial.key_forward = trial.key_forward || 'rightarrow';
trial.key_backward = trial.key_backward || 'leftarrow';
trial.allow_backward = (typeof trial.allow_backward === 'undefined') ? true : trial.allow_backward;
trial.allow_keys = (typeof trial.allow_keys === 'undefined') ? true : trial.allow_keys;
trial.show_clickable_nav = (typeof trial.show_clickable_nav === 'undefined') ? false : trial.show_clickable_nav;
// if any trial variables are functions
// this evaluates the function and replaces
// it with the output of the function
trial = jsPsych.pluginAPI.evaluateFunctionParameters(trial);
var current_page = 0;
var view_history = [];
var start_time = (new Date()).getTime();
var last_page_update_time = start_time;
function show_current_page() {
display_element.html(trial.pages[current_page]);
if (trial.show_clickable_nav) {
var nav_html = "