1. Getting started - fildpauz/jespr GitHub Wiki
The quickest way to get started with JESPR may be to download the jespr-quickstart.zip archive, unzip it and check out the README.txt file. For a more detailed explanation, continue reading here.
In order to use JESPR, there are four files you will need to be aware of.
-
jespr-lib.js
-- This is the main library file. If you just want to run experiments, then you should never even have to open this file; just make the appropriate references to it in thehtml
file. -
jespr-experiment.html
-- This is the file that would be loaded into the browser and contains the appropriate references to the JESPR library, stylesheet, and design file, and also contains the code to launch the experiment. The body of this file may be edited to add some pre-experiment or post-experiment content, as desired; say, a consent form, or a post-experiment debriefing text. -
jespr.css
-- This is the stylesheet for the design and layout of various elements in the operation of JESPR. This should probably not be edited unless you know what you're doing. -
jespr-sample1.js
-- This is the core of the experiment and the most important file for the experimenter. This file sets the global parameters of the experiment as well as lists all of the experimental stimuli.
In jespr-experiment.html
, the other three files are referenced in the <HEAD>
section as follows.
<script src="jespr-sample1.js"></script>
<script src="jespr-lib.js"></script>
<link href="jespr.css" rel="stylesheet" type="text/css"/>
When running an experiment locally, the four files could be placed in the same directory and the jespr-experiment.html
file could be opened in a browser and run without any Internet connection. However, for a remote administration, some changes may be necessary depending on the situation. Following are a couple of likely scenarios.
- Host all the files on a web server. Actually, this is pretty easy -- Put all the files in the same directory on the web server and then leave the references as above.
-
Conduct an experiment via Mechanical Turk. MT does not allow the uploading of additional files, so they would have to be hosted on a separate server. In this case, the
<HEAD>
references above would need to be updated to give the full URI path to where the files are located. An alternative solution would be to copy the contents of the three files into the sourcehtml
of the MT HIT. This should be attempted only by those who know what they are doing.
Inside of the jespr-experiment.html
file, the following code is needed to get the experiment started.
<form id="jesprForm" name="jesprForm" method="POST"></form>
<script>
var form = document.getElementById("jesprForm");
var experiment = new Experiment(jesprExperimentDesign, form);
if (experiment.validateDesign()){
experiment.loadDesign();
experiment.startExperiment();
}
</script>
The form name here is arbitrary and can be named as desired. However, if using the Amazon Mechanical Turk system, then the form name is already defined (usually as mturk_form
). This, then should be the name used to determine the form
variable.
The jesprExperimentDesign
variable is defined in the design file which is loaded in the <HEAD>
element as noted above. The structure of that file is defined below.
Finally, it is necessary to run validateDesign()
on the Experiment
object before loading and then starting the experiment. This will check that the design object contains all necessary settings and parameter options. This is a useful way to check your design file for any problems. Of course, it does not check the theoretical design of the experiment! That responsibility is still left to the user.