more jquery removal

This commit is contained in:
Josh de Leeuw 2016-11-28 14:59:32 -05:00
parent 3010623880
commit 590f5880fe
3 changed files with 9 additions and 11 deletions

View File

@ -166,7 +166,6 @@ var after_block = {
} }
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [block, after_block], timeline: [block, after_block],
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();
@ -264,7 +263,7 @@ None.
### Return value ### Return value
Returns the jQuery-object that contains the DOM element used for displaying the experiment. Returns the HTML DOM element used for displaying the experiment.
### Description ### Description
@ -276,7 +275,7 @@ Get the DOM element that displays the experiment.
var el = jsPsych.getDisplayElement(); var el = jsPsych.getDisplayElement();
// hide the jsPsych display // hide the jsPsych display
el.hide(); el.style.visibility = 'hidden';
``` ```
--- ---
## jsPsych.init ## jsPsych.init
@ -296,7 +295,7 @@ The settings object can contain several parameters. The only *required* paramete
Parameter | Type | Description Parameter | Type | Description
--------- | ---- | ----------- --------- | ---- | -----------
timeline | array | An array containing the objects that describe the experiment timeline. See [Creating an Experiment: The Timeline](../features/timeline.md). timeline | array | An array containing the objects that describe the experiment timeline. See [Creating an Experiment: The Timeline](../features/timeline.md).
display_element | jQuery object | A jQuery-selected DOM element, e.g., `$('#target')` selects the element with the `id='target'` attribute. If left blank, then jsPsych will use the `<body>` element to display content (creating it if necessary). You can override this parameter at the trial level as well by specifying a display_element property on any timeline. display_element | string | The ID of an HTML element to display the experiment in. If left blank, then jsPsych will use the `<body>` element to display content (creating it if necessary). You can override this parameter at the trial level as well by specifying a display_element property on any timeline.
on_finish | function | Function to execute when the experiment ends. on_finish | function | Function to execute when the experiment ends.
on_trial_start | function | Function to execute when a new trial begins. on_trial_start | function | Function to execute when a new trial begins.
on_trial_finish | function | Function to execute when a trial ends. on_trial_finish | function | Function to execute when a trial ends.

View File

@ -283,7 +283,6 @@ var after_if_trial = {
} }
jsPsych.init({ jsPsych.init({
display_element: $('#jspsych-target'),
timeline: [pre_if_trial, if_node, after_if_trial], timeline: [pre_if_trial, if_node, after_if_trial],
on_finish: function(){jsPsych.data.displayData(); } on_finish: function(){jsPsych.data.displayData(); }
}); });

View File

@ -81,14 +81,14 @@ jsPsych.plugins['vsl-grid-scene'] = (function() {
display_element.innerHTML += '<div id="jspsych-vsl-grid-scene-dummy" css="display: none;"></div>'; display_element.innerHTML += '<div id="jspsych-vsl-grid-scene-dummy" css="display: none;"></div>';
// create table // create table
display_element.getElementById('jspsych-vsl-grid-scene-dummy').innerHTML += '<table id="jspsych-vsl-grid-scene table" '+ display_element.querySelector('#jspsych-vsl-grid-scene-dummy').innerHTML += '<table id="jspsych-vsl-grid-scene table" '+
'style="border-collapse: collapse; margin-left: auto; margin-right: auto;"></table>'; 'style="border-collapse: collapse; margin-left: auto; margin-right: auto;"></table>';
for (var row = 0; row < nrows; row++) { for (var row = 0; row < nrows; row++) {
display_element.getElementById("jspsych-vsl-grid-scene-table").innerHTML += '<tr id="jspsych-vsl-grid-scene-table-row-'+row+'" css="height: '+image_size[1]+'px;">'; display_element.querySelector('#jspsych-vsl-grid-scene-table').innerHTML += '<tr id="jspsych-vsl-grid-scene-table-row-'+row+'" css="height: '+image_size[1]+'px;">';
for (var col = 0; col < ncols; col++) { for (var col = 0; col < ncols; col++) {
display_element.getElementById("jspsych-vsl-grid-scene-table-row-" + row).innerHTML += '<td id="jspsych-vsl-grid-scene-table-' + row + '-' + col +'" '+ display_element.querySelector('#jspsych-vsl-grid-scene-table-row-' + row).innerHTML += '<td id="jspsych-vsl-grid-scene-table-' + row + '-' + col +'" '+
'style="padding: '+ (image_size[1] / 10) + 'px ' + (image_size[0] / 10) + 'px; border: 1px solid #555;">'+ 'style="padding: '+ (image_size[1] / 10) + 'px ' + (image_size[0] / 10) + 'px; border: 1px solid #555;">'+
'<div id="jspsych-vsl-grid-scene-table-cell-' + row + '-' + col'" style="width: '+image_size[0]+'px; height: '+image_size[1]+'px;"></div>'; '<div id="jspsych-vsl-grid-scene-table-cell-' + row + '-' + col'" style="width: '+image_size[0]+'px; height: '+image_size[1]+'px;"></div>';
} }
@ -98,14 +98,14 @@ jsPsych.plugins['vsl-grid-scene'] = (function() {
for (var row = 0; row < nrows; row++) { for (var row = 0; row < nrows; row++) {
for (var col = 0; col < ncols; col++) { for (var col = 0; col < ncols; col++) {
if (pattern[row][col] !== 0) { if (pattern[row][col] !== 0) {
display_element.getElementById('jspsych-vsl-grid-scene-table-cell-' + row + '-' + col).innerHTML = '<img '+ display_element.querySelector('#jspsych-vsl-grid-scene-table-cell-' + row + '-' + col).innerHTML = '<img '+
'src="'+pattern[row][col]+'" style="width: '+image_size[0]+'px; height: '+image_size[1]+'"></img>'; 'src="'+pattern[row][col]+'" style="width: '+image_size[0]+'px; height: '+image_size[1]+'"></img>';
} }
} }
} }
var html_out = display_element.getElementById('jspsych-vsl-grid-scene-dummy').innerHTML; var html_out = display_element.querySelector('#jspsych-vsl-grid-scene-dummy').innerHTML;
display_element.getElementById('jspsych-vsl-grid-scene-dummy').outerHTML = ''; display_element.querySelector('#jspsych-vsl-grid-scene-dummy').outerHTML = '';
return html_out; return html_out;