mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
added demos
This commit is contained in:
parent
f21ad81d1e
commit
c3d616283f
43
examples/demos/demo_2.html
Normal file
43
examples/demos/demo_2.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="../jspsych.js"></script>
|
||||||
|
<script src="../plugins/jspsych-image-keyboard-response.js"></script>
|
||||||
|
<link rel="stylesheet" href="../css/jspsych.css"></link>
|
||||||
|
<style>
|
||||||
|
img {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
var trial_1 = {
|
||||||
|
type: "image-keyboard-response",
|
||||||
|
stimulus: 'img/happy_face_1.jpg',
|
||||||
|
choices: [89, 78],
|
||||||
|
prompt: '<p class="center-content">Is this face happy? Y or N.</p>'
|
||||||
|
}
|
||||||
|
|
||||||
|
var trial_2 = {
|
||||||
|
type: 'image-keyboard-response',
|
||||||
|
stimulus: 'img/sad_face_2.jpg',
|
||||||
|
choices: [89, 78], // Y or N
|
||||||
|
prompt: '<p class="center-content">Is this face happy? Y or N.</p>'
|
||||||
|
}
|
||||||
|
|
||||||
|
var trial_3 = {
|
||||||
|
type: 'image-keyboard-response',
|
||||||
|
stimulus: 'img/happy_face_2.jpg',
|
||||||
|
choices: [89, 78], // Y or N
|
||||||
|
prompt: '<p class="center-content">Is this face happy? Y or N.</p>',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
jsPsych.init({
|
||||||
|
timeline: [trial_1, trial_2, trial_3],
|
||||||
|
default_iti: 250
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</html>
|
@ -21,20 +21,11 @@ jsPsych.plugins['call-function'] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
// a rare case where we override the default experiment level
|
|
||||||
// value of this parameter, since this plugin should be invisible
|
|
||||||
// to the subject of the experiment
|
|
||||||
post_trial_gap: {
|
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
|
||||||
default: 0,
|
|
||||||
no_function: false,
|
|
||||||
description: ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.trial = function(display_element, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
trial.post_trial_gap = 0;
|
||||||
var return_val = trial.func();
|
var return_val = trial.func();
|
||||||
|
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
|
@ -34,7 +34,7 @@ jsPsych.plugins['external-html'] = (function() {
|
|||||||
},
|
},
|
||||||
check_fn: {
|
check_fn: {
|
||||||
type: jsPsych.plugins.parameterType.FUNCTION,
|
type: jsPsych.plugins.parameterType.FUNCTION,
|
||||||
default: 'function() { return true; }',
|
default: function() { return true; },
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user