mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
more jquery removal
This commit is contained in:
parent
3010623880
commit
590f5880fe
@ -166,7 +166,6 @@ var after_block = {
|
||||
}
|
||||
|
||||
jsPsych.init({
|
||||
display_element: $('#jspsych-target'),
|
||||
timeline: [block, after_block],
|
||||
on_finish: function() {
|
||||
jsPsych.data.displayData();
|
||||
@ -264,7 +263,7 @@ None.
|
||||
|
||||
### 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
|
||||
|
||||
@ -276,7 +275,7 @@ Get the DOM element that displays the experiment.
|
||||
var el = jsPsych.getDisplayElement();
|
||||
|
||||
// hide the jsPsych display
|
||||
el.hide();
|
||||
el.style.visibility = 'hidden';
|
||||
```
|
||||
---
|
||||
## jsPsych.init
|
||||
@ -296,7 +295,7 @@ The settings object can contain several parameters. The only *required* paramete
|
||||
Parameter | Type | Description
|
||||
--------- | ---- | -----------
|
||||
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_trial_start | function | Function to execute when a new trial begins.
|
||||
on_trial_finish | function | Function to execute when a trial ends.
|
||||
|
@ -283,7 +283,6 @@ var after_if_trial = {
|
||||
}
|
||||
|
||||
jsPsych.init({
|
||||
display_element: $('#jspsych-target'),
|
||||
timeline: [pre_if_trial, if_node, after_if_trial],
|
||||
on_finish: function(){jsPsych.data.displayData(); }
|
||||
});
|
||||
|
@ -81,14 +81,14 @@ jsPsych.plugins['vsl-grid-scene'] = (function() {
|
||||
display_element.innerHTML += '<div id="jspsych-vsl-grid-scene-dummy" css="display: none;"></div>';
|
||||
|
||||
// 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>';
|
||||
|
||||
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++) {
|
||||
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;">'+
|
||||
'<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 col = 0; col < ncols; col++) {
|
||||
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>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var html_out = display_element.getElementById('jspsych-vsl-grid-scene-dummy').innerHTML;
|
||||
display_element.getElementById('jspsych-vsl-grid-scene-dummy').outerHTML = '';
|
||||
var html_out = display_element.querySelector('#jspsych-vsl-grid-scene-dummy').innerHTML;
|
||||
display_element.querySelector('#jspsych-vsl-grid-scene-dummy').outerHTML = '';
|
||||
|
||||
return html_out;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user