updating examples

This commit is contained in:
Josh de Leeuw 2016-08-16 11:19:37 -04:00
parent a2e9f8674c
commit 5ec3d6a95d
15 changed files with 35 additions and 70 deletions

View File

@ -6,16 +6,13 @@
<script src="../plugins/jspsych-reconstruction.js"></script> <script src="../plugins/jspsych-reconstruction.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var sample_function = function(param){ var sample_function = function(param){
var size = 50 + Math.floor(param*250); var size = 50 + Math.floor(param*250);
var html = '<div style="display: block; margin: auto; height: 300px;">'+ var html = '<div style="display: block; margin: auto; height: 300px;">'+
'<div style="display: block; margin: auto; background-color: #000000; '+ '<div style="display: block; margin: auto; background-color: #000000; '+
'width: '+size+'px; height: '+size+'px;"></div></div>'; 'width: '+size+'px; height: '+size+'px;"></div></div><p>Press H or G.</p>';
return html; return html;
} }
@ -26,7 +23,6 @@
} }
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [block_1], timeline: [block_1],
on_finish: function() { jsPsych.data.displayData(); } on_finish: function() { jsPsych.data.displayData(); }
}); });

View File

@ -13,9 +13,6 @@
</style> </style>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var block = { var block = {
type: 'same-different', type: 'same-different',
@ -27,7 +24,6 @@
} }
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [block], timeline: [block],
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();

View File

@ -15,9 +15,6 @@
</style> </style>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var block_1 = { var block_1 = {
type: 'similarity', type: 'similarity',
@ -26,7 +23,6 @@
} }
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [block_1], timeline: [block_1],
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();

View File

@ -6,9 +6,7 @@
<script src="../plugins/jspsych-single-audio.js"></script> <script src="../plugins/jspsych-single-audio.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
/* /*
@ -27,7 +25,6 @@
} }
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [block_1], timeline: [block_1],
on_finish: function() {jsPsych.data.displayData();} on_finish: function() {jsPsych.data.displayData();}
}); });

View File

@ -13,8 +13,6 @@
</style> </style>
</head> </head>
<body>
</body>
<script> <script>
var trial_1 = { var trial_1 = {
type: 'single-stim', type: 'single-stim',
@ -43,9 +41,6 @@
var node = { var node = {
type: 'single-stim', type: 'single-stim',
timeline: [trial_1, trial_2, trial_3], timeline: [trial_1, trial_2, trial_3],
data: {
node_data: true
}
} }

View File

@ -6,9 +6,7 @@
<script src="../plugins/jspsych-survey-likert.js"></script> <script src="../plugins/jspsych-survey-likert.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target" class="jspsych-top"></div>
</body>
<script> <script>
// defining groups of questions that will go together. // defining groups of questions that will go together.
@ -24,7 +22,6 @@
}; };
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [likert_block], timeline: [likert_block],
on_finish: function() { jsPsych.data.displayData(); } on_finish: function() { jsPsych.data.displayData(); }
}); });

View File

@ -6,13 +6,11 @@
<script src="../plugins/jspsych-survey-multi-choice.js"></script> <script src="../plugins/jspsych-survey-multi-choice.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
// defining groups of questions that will go together. // defining groups of questions that will go together.
var page_1_questions = ["I like vegetables.", "I like fruit."] var page_1_questions = ["I like vegetables.", "I like fruit."];
// definiting two different response scales that can be used. // definiting two different response scales that can be used.
var page_1_options = ["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"]; var page_1_options = ["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"];
@ -26,9 +24,16 @@
// horizontal: true // centres questions and makes options display horizontally // horizontal: true // centres questions and makes options display horizontally
}; };
var multi_choice_block_horizontal = {
type: 'survey-multi-choice',
questions: page_1_questions,
options: [page_1_options, page_2_options], // need one scale for every question on a page
required: [true, false], // set whether questions are required
horizontal: true // centres questions and makes options display horizontally
};
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'), timeline: [multi_choice_block, multi_choice_block_horizontal],
timeline: [multi_choice_block],
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();
} }

View File

@ -6,9 +6,7 @@
<script src="../plugins/jspsych-survey-text.js"></script> <script src="../plugins/jspsych-survey-text.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
// defining groups of questions that will go together. // defining groups of questions that will go together.
@ -19,9 +17,7 @@
questions: page_1_questions questions: page_1_questions
}; };
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [survey_block], timeline: [survey_block],
on_finish: function() { jsPsych.data.displayData(); } on_finish: function() { jsPsych.data.displayData(); }
}); });

View File

@ -6,9 +6,6 @@
<script src="../plugins/jspsych-text.js"></script> <script src="../plugins/jspsych-text.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var block = { var block = {
@ -16,9 +13,14 @@
text: 'Welcome to the experiment. Press any key to begin.' text: 'Welcome to the experiment. Press any key to begin.'
} }
var mouse = {
type: 'text',
choices: 'mouse',
text: 'Click the mouse to continue.'
}
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'), timeline: [block, mouse],
timeline: [block],
on_finish: function() { jsPsych.data.displayData(); } on_finish: function() { jsPsych.data.displayData(); }
}); });

View File

@ -6,9 +6,7 @@
<script src="../plugins/jspsych-video.js"></script> <script src="../plugins/jspsych-video.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var trial = { var trial = {
@ -17,7 +15,6 @@
} }
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [trial], timeline: [trial],
on_finish: function() { jsPsych.data.displayData(); } on_finish: function() { jsPsych.data.displayData(); }
}); });

View File

@ -5,15 +5,18 @@
<script src="js/jquery.min.js"></script> <script src="js/jquery.min.js"></script>
<script src="js/snap.svg-min.js"></script> <script src="js/snap.svg-min.js"></script>
<script src="../jspsych.js"></script> <script src="../jspsych.js"></script>
<script src="../plugins/jspsych-text.js"></script>
<script src="../plugins/jspsych-visual-search-circle.js"></script> <script src="../plugins/jspsych-visual-search-circle.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var intro = {
type: 'text',
text: 'Press J if there is a backwards N. If there is no backwards N press F.'
}
var trial_1 = { var trial_1 = {
target_present: true, target_present: true,
set_size: 4 set_size: 4
@ -32,15 +35,14 @@
var trials = { var trials = {
type: 'visual-search-circle', type: 'visual-search-circle',
target: 'img/normalN.gif', target: 'img/backwardN.gif',
foil: 'img/backwardN.gif', foil: 'img/normalN.gif',
fixation_image: 'img/fixation.gif', fixation_image: 'img/fixation.gif',
timeline: [trial_1, trial_2, trial_3] timeline: [trial_1, trial_2, trial_3]
}; };
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'), timeline: [intro, trials],
timeline: [trials],
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();
} }

View File

@ -9,9 +9,6 @@
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var images = ["img/1.gif", "img/2.gif", "img/3.gif", "img/4.gif", "img/5.gif", "img/6.gif", "img/7.gif", "img/8.gif", "img/9.gif", "img/10.gif"]; var images = ["img/1.gif", "img/2.gif", "img/3.gif", "img/4.gif", "img/5.gif", "img/6.gif", "img/7.gif", "img/8.gif", "img/9.gif", "img/10.gif"];
@ -22,7 +19,6 @@
}; };
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [block], timeline: [block],
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();

View File

@ -7,9 +7,7 @@
<script src="../plugins/jspsych-vsl-grid-scene.js"></script> <script src="../plugins/jspsych-vsl-grid-scene.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var images = ["img/1.gif","img/2.gif","img/3.gif","img/4.gif","img/5.gif","img/6.gif","img/7.gif","img/8.gif","img/9.gif","img/10.gif"]; var images = ["img/1.gif","img/2.gif","img/3.gif","img/4.gif","img/5.gif","img/6.gif","img/7.gif","img/8.gif","img/9.gif","img/10.gif"];
@ -31,7 +29,6 @@
}; };
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [block], timeline: [block],
on_finish: function() { jsPsych.data.displayData(); } on_finish: function() { jsPsych.data.displayData(); }
}); });

View File

@ -13,9 +13,6 @@
</style> </style>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var block_1 = { var block_1 = {
type: 'xab', type: 'xab',
@ -25,7 +22,6 @@
} }
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [block_1], timeline: [block_1],
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();

View File

@ -6,14 +6,12 @@
<script src="../plugins/jspsych-text.js"></script> <script src="../plugins/jspsych-text.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body>
<div id="jspsych-target"></div>
</body>
<script> <script>
var first = { var first = {
type: 'text', type: 'text',
text: 'first trial!', text: 'first trial! experiment will pause for 4s in between trials. press any key.',
timing_post_trial: 0, timing_post_trial: 0,
on_finish: function(){ on_finish: function(){
jsPsych.pauseExperiment(); jsPsych.pauseExperiment();
@ -27,7 +25,6 @@
} }
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [first, second], timeline: [first, second],
on_finish: function(){jsPsych.data.displayData(); } on_finish: function(){jsPsych.data.displayData(); }
}); });