Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Update 1.4 branch with latest commits #156

Open
wants to merge 100 commits into
base: 1.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
6ba2cf6
Add basic support for inline javascript
smathot Feb 12, 2019
c1ada31
Add basic support for inline javascript
smathot Feb 12, 2019
fc8878e
Merge branch 'inline_javascript' of github.com:smathot/osweb into inl…
smathot Feb 25, 2019
001afec
JavaScript workspace: add proxy for var_store
smathot Mar 1, 2019
bcc1700
VarStore: improvements for inline_javascript
smathot Mar 3, 2019
8c8666f
JavaScript workspace: various improvements
smathot Mar 3, 2019
404dd65
Add Attentional Capture example
smathot Mar 5, 2019
c2dbd1a
Fixes #127
dschreij Mar 10, 2019
e5845aa
Fixes 128
dschreij Mar 10, 2019
c9cb568
Reverse trim and slashstrip ops
dschreij Mar 10, 2019
86d4c50
Add more checks and balances
dschreij Mar 10, 2019
932a98c
The fix that should have been...
dschreij Mar 10, 2019
cd50b39
Merge remote-tracking branch 'upstream/fix/127' into tmp
smathot Mar 12, 2019
224f31a
Add variable font size to attentional-capture experiment
smathot Mar 12, 2019
3f74bef
Merge remote-tracking branch 'dschreij/fix/128' into tmp
smathot Mar 12, 2019
d36891b
Update attentional-capture experiment to use variably defined allowed…
smathot Mar 12, 2019
c159253
Bump to 1.3.1
smathot Apr 5, 2019
b712a90
fix advanced_delay
smathot Apr 5, 2019
7bff8a9
Remove extraneous console.log() statements
smathot Apr 5, 2019
9d82591
Bump to 1.3.1
smathot Apr 5, 2019
776d22e
fix advanced_delay
smathot Apr 5, 2019
78fbafd
Remove extraneous console.log() statements
smathot Apr 5, 2019
625160c
Fixes #139
dschreij Apr 16, 2019
a10d055
Fixes #138
dschreij Apr 16, 2019
97fd60e
Fix typo in debugger
smathot Apr 17, 2019
ef6d138
Merge branch '1.3' of github.com:shyras/osweb into 1.3
smathot Apr 17, 2019
085ed86
Merge remote-tracking branch 'dschreij/fix/139' into fix139
smathot Apr 17, 2019
5629a4a
Merge remote-tracking branch 'dschreij/fix/138' into fix138
smathot Apr 17, 2019
bea2c92
touch_response: clean up
smathot Apr 17, 2019
3e4e617
Fixes #134
dschreij Apr 16, 2019
47f109b
Move break_if evaluation to run phase
dschreij Apr 23, 2019
cba4718
Memory loss for the log
dschreij Apr 23, 2019
0b63904
Refactoring of logger and var_store
smathot Apr 25, 2019
75ccbe0
Fix sloppiness in var_store
smathot Apr 25, 2019
f8ef70f
Unicode decoding of .osexp done properly
dschreij Apr 25, 2019
8373cfb
Fix unit tests
dschreij Apr 25, 2019
964245c
Decode filenames back to unicode
dschreij Apr 26, 2019
580f4f6
Fix repeat_cycle functionality
dschreij Apr 25, 2019
f890de9
Removes superfluous repeat_cycle var setting
dschreij Apr 25, 2019
85163f6
Some comments cleanup
dschreij Apr 25, 2019
1797f4b
Fix repeat_cycle behavior
dschreij Apr 25, 2019
1cc03be
Merge remote-tracking branch 'dschreij/fix/137' into 1.3
smathot Apr 26, 2019
aae650a
Update readme
smathot Apr 26, 2019
5dcee57
config updates
dschreij Jun 14, 2019
1020b1b
Some more cleanup
dschreij Jun 14, 2019
8eff229
Fix handling of variably defined correct responses
smathot Jun 15, 2019
3525cff
Remove unsupported items from capybara example
smathot Jun 15, 2019
e597fb7
Fix syntax unit test such that numbers are numbers
smathot Jun 15, 2019
b6a8ada
Bump to 1.3.22
dschreij Jun 20, 2019
0a428c2
Updated pixi to v5
dschreij Jun 20, 2019
70a792c
Fixed unit tests
dschreij Jun 20, 2019
39660cb
Importing modules the way one should.
dschreij Jun 25, 2019
67e6895
Small fix for PIXI text
dschreij Jun 25, 2019
c319767
Fixed #151
dschreij Jun 27, 2019
d824257
1.4.0
dschreij Jun 27, 2019
2f90cdf
Fixed ended callback not being called
dschreij Jun 28, 2019
2860f66
Fixed invalid handling of sampler sound duration
dschreij Jun 28, 2019
7a10e71
Match bg color body to canvas
dschreij Jun 28, 2019
6345c6c
v1.3.3
dschreij Jun 28, 2019
1275ee2
Tweaked sampler error message
dschreij Jun 28, 2019
7f3fb11
Update capybara exp
smathot Jun 28, 2019
d4c7450
Starting wit coroutines implementation
dschreij Dec 29, 2018
575de61
Fix jest tests on Windows
dschreij Mar 1, 2019
8f30e51
Fixed the fixes...
dschreij Mar 1, 2019
b0085bd
Progress with coroutines
dschreij Mar 2, 2019
6b1dc6d
Added Task class
dschreij Mar 4, 2019
c2b0b8e
Progress...
dschreij Mar 5, 2019
ee19a5f
Coroutines operational
dschreij Mar 5, 2019
64c9563
Update dependency packages
dschreij Mar 6, 2019
af17bbe
Fixed keyboard leaking
dschreij Mar 8, 2019
738774e
Coroutines finished
dschreij Mar 8, 2019
52dee48
Add acc after every trial (for testing purposes)
dschreij Mar 10, 2019
1e4d9ba
Added browserslist integration
dschreij Mar 11, 2019
686c0c8
Fix unit tests babel cfg
dschreij Mar 11, 2019
fcb96b9
Replace Pixi Textinput
dschreij Jun 28, 2019
d7286c8
1.4.0
dschreij Jun 28, 2019
ae06c03
Make Canvas vailable in js workspace
dschreij Jun 29, 2019
df27449
Javascript canvas
dschreij Jul 2, 2019
2df33cb
Bump to 1.3.4
smathot Jul 3, 2019
91e3811
Don't turn empty string into the number 0
smathot Jul 3, 2019
8306eda
Update example experiments
smathot Sep 12, 2019
2eb3f0a
Update copyright in readme
smathot Mar 14, 2020
6c3da9d
Fix coordinates in mouse_response and touch_response
smathot Mar 14, 2020
8b4c42b
Bump to 1.3.5
smathot Mar 14, 2020
bcfb092
Update packages
smathot Mar 17, 2020
30cdffb
generic_response: set_mouse_coordinates() takes X and Y instead of re…
smathot Mar 18, 2020
bd7da36
Updated canvas & eslint libs
dschreij Mar 18, 2020
048cb3b
Npm update of deps (security fixes)
dschreij Mar 18, 2020
cd45cb0
Forgot updated package-lock.json
dschreij Mar 18, 2020
90e4ecf
Linted matrix.test.js
dschreij Mar 18, 2020
5776264
security updates
dschreij Apr 10, 2020
3ffd25b
Fixed logger, package.json and webpack updates
dschreij Apr 10, 2020
916a356
1.3.6
dschreij Apr 10, 2020
1470f9f
Fixed webpack config
dschreij Apr 10, 2020
46ea17c
Fixed uglification process
dschreij Apr 10, 2020
63a6869
Update readme.md
smathot Apr 13, 2020
1bc553f
Merge branch '1.3' into 1.4
dschreij Apr 21, 2020
55f720f
Updated package-lock
dschreij Apr 21, 2020
fed6ff1
Improved babel polyfilling + updated deps
dschreij Apr 21, 2020
a28e341
Update jest jsdom to fix canvas unit test
dschreij Apr 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = function babelConfig (api) {
api.cache(true)
return {
plugins: [
'lodash',
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-class-properties'
],
presets: [
['@babel/preset-env', {
useBuiltIns: 'usage',
corejs: 3,
modules: false
}]
],
env: {
test: {
presets: [
'@babel/preset-env'
]
}
}
}
}
326 changes: 326 additions & 0 deletions example-experiments/attentional-capture.osexp
Original file line number Diff line number Diff line change
@@ -0,0 +1,326 @@
---
API: 2.1
OpenSesame: 3.2.7a2
Platform: posix
---
set width 1024
set uniform_coordinates yes
set title "Attentional Capture"
set subject_parity even
set subject_nr 0
set start experiment
set sound_sample_size -16
set sound_freq 48000
set sound_channels 2
set sound_buf_size 1024
set sampler_backend legacy
set round_decimals 2
set mouse_backend legacy
set keyboard_backend legacy
set height 768
set fullscreen no
set form_clicks no
set foreground white
set font_underline no
set font_size 18
set font_italic no
set font_family mono
set font_bold no
set experiment_path "/home/sebastiaan/git/osweb/example-experiments"
set disable_garbage_collection yes
set description "The main experiment item"
set coordinates uniform
set compensation 0
set color_backend legacy
set clock_backend legacy
set canvas_backend legacy
set background "#37474F"

define feedback block_feedback
set reset_variables yes
set duration keypress
set description "Provides feedback to the participant"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=32 html=yes show_if=always text="Break!" x=0 y=-320 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Press any key to continue" x=0 y=320 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Your average response time was [avg_rt] ms<br />Your accuracy was [acc] %" x=0 y=0 z_index=0

define loop block_loop
set source_file ""
set source table
set repeat 2
set order random
set description "Repeatedly runs another item"
set cycles 4
set continuous no
set break_if_on_first yes
set break_if never
setcycle 0 distractor present
setcycle 0 target_color "[COLOR1]"
setcycle 0 dist_color "[COLOR2]"
setcycle 1 distractor absent
setcycle 1 target_color "[COLOR1]"
setcycle 1 dist_color "[COLOR2]"
setcycle 2 distractor present
setcycle 2 target_color "[COLOR2]"
setcycle 2 dist_color "[COLOR1]"
setcycle 3 distractor absent
setcycle 3 target_color "[COLOR2]"
setcycle 3 dist_color "[COLOR1]"
run trial_sequence

define sequence block_sequence
set flush_keyboard yes
set description "Runs a number of items in sequence"
run reset_feedback always
run block_loop always
run block_feedback always

define sequence experiment
set flush_keyboard yes
set description "Runs a number of items in sequence"
run init always
run instructions always
run experimental_loop always
run finished always

define loop experimental_loop
set source_file ""
set source table
set repeat 2
set order random
set description "Repeatedly runs another item"
set cycles 1
set continuous no
set break_if_on_first yes
set break_if never
setcycle 0 empty_column ""
run block_sequence

define sketchpad finished
set duration keypress
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=32 html=yes show_if=always text="Finished!" x=0 y=-320 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Press any key to exit" x=0 y=320 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="The experiment is finished<br />Thank you for your participation!" x=0 y=0 z_index=0

define sketchpad fixation_dot
set start_response_interval no
set reset_variables no
set duration 495
set description "Displays stimuli"
draw fixdot color=white show_if=always style=default x=0 y=0 z_index=0

define sketchpad green_dot
set duration 495
set description "Displays stimuli"
draw textline center=1 color="#8BC34A" font_bold=no font_family=mono font_italic=no font_size=32 html=yes show_if=always text="&#x1F603;" x=0 y=0 z_index=0

define inline_javascript init
set description "Executes JavaScript code (ECMA 5.1)"
set _run ""
___prepare__
vars.LEFT = '&#9680;'
vars.RIGHT = '&#9681;'
vars.BOTTOM= '&#9682;'
vars.TOP = '&#9683;'
vars.RESP_LEFT = 'c'
vars.RESP_RIGHT = 'm'
vars.COLOR1 = '#E91E63'
vars.COLOR2 = '#2196F3'
vars.FONT_SIZE = 128
__end__

define sequence instructions
set flush_keyboard yes
set description "Runs a number of items in sequence"
run instructions1 always
run instructions2 always
run wait_left always
run instructions3 always
run wait_right always
run instructions4 always
run logger always

define sketchpad instructions1
set duration keypress
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=32 html=yes show_if=always text=Instructions x=0 y=-320 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="You will see several shapes<br />Ignore the colors<br /><br />One shape is filled on the left or the right. This is the target!<br />Indicate which side of the target is filled<br />" x=0 y=-160 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[LEFT]" x=-224 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Press '[RESP_LEFT]' to indicate 'left'" x=-224 y=96 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[RIGHT]" x=224 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Press '[RESP_RIGHT]' to indicate right" x=224 y=96 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Press any key to see an example" x=0 y=320 z_index=0

define sketchpad instructions2
set duration 0
set description "Displays stimuli"
draw fixdot color=white show_if=always style=default x=0 y=0 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[LEFT]" x=200 y=0 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[TOP]" x=100.00000000000003 y=173.20508075688772 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[BOTTOM]" x=-99.99999999999996 y=173.20508075688775 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[BOTTOM]" x=-200 y=2.4492935982947064e-14 z_index=0
draw textline center=1 color="[COLOR2]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[TOP]" x=-100.00000000000009 y=-173.20508075688767 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[TOP]" x=100.00000000000003 y=-173.20508075688772 z_index=0
draw arrow arrow_body_length=0.8 arrow_body_width=0.5 arrow_head_width=30 color=white fill=1 penwidth=1 show_if=always x1=320 x2=224 y1=-128 y2=-32 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text=Target x=320 y=-160 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Here the target is filled on the left<br />So press '[RESP_LEFT]' to continue" x=0 y=320 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=32 html=yes show_if=always text=Instructions x=0 y=-320 z_index=0

define sketchpad instructions3
set duration 0
set description "Displays stimuli"
draw fixdot color=white show_if=always style=default x=0 y=0 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[TOP]" x=200 y=0 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[TOP]" x=100.00000000000003 y=173.20508075688772 z_index=0
draw textline center=1 color="[COLOR2]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[BOTTOM]" x=-99.99999999999996 y=173.20508075688775 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[BOTTOM]" x=-200 y=2.4492935982947064e-14 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[RIGHT]" x=-100.00000000000009 y=-173.20508075688767 z_index=0
draw textline center=1 color="[COLOR1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[TOP]" x=100.00000000000003 y=-173.20508075688772 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text=Target x=-352 y=-288 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Here the target is filled on the right<br />So press '[RESP_RIGHT]' to continue" x=0 y=320 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=32 html=yes show_if=always text=Instructions x=0 y=-320 z_index=0
draw arrow arrow_body_length=0.8 arrow_body_width=0.5 arrow_head_width=30 color=white fill=1 penwidth=1 show_if=always x1=-320 x2=-160 y1=-256 y2=-192 z_index=0

define sketchpad instructions4
set duration keypress
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Ready?" x=0 y=-96 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="Press any key to start" x=0 y=96 z_index=0
draw fixdot color=white show_if=always style=default x=0 y=0 z_index=0

define keyboard_response keyboard_response
set timeout infinite
set flush yes
set event_type keypress
set duration keypress
set description "Collects keyboard responses"
set allowed_responses "[RESP_LEFT];[RESP_RIGHT]"

define logger logger
set description "Logs experimental data"
set auto_log yes

define sketchpad red_dot
set duration 495
set description "Displays stimuli"
draw textline center=1 color="#f44336" font_bold=no font_family=mono font_italic=no font_size=32 html=yes show_if=always text="&#x1F611;" x=0 y=0 z_index=0

define reset_feedback reset_feedback
set description "Resets the feedback variables, such as 'avg_rt' and 'acc'"

define sketchpad search_display
set duration 0
set description "Displays stimuli"
draw fixdot color=white show_if=always style=default x=0 y=0 z_index=0
draw textline center=1 color="[c1]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[s1]" x=200 y=0 z_index=0
draw textline center=1 color="[c2]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[s2]" x=100.00000000000003 y=173.20508075688772 z_index=0
draw textline center=1 color="[c3]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[s3]" x=-99.99999999999996 y=173.20508075688775 z_index=0
draw textline center=1 color="[c4]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[s4]" x=-200 y=2.4492935982947064e-14 z_index=0
draw textline center=1 color="[c5]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[s5]" x=-100.00000000000009 y=-173.20508075688767 z_index=0
draw textline center=1 color="[c6]" font_bold=no font_family=mono font_italic=no font_size="[FONT_SIZE]" html=yes show_if=always text="[s6]" x=100.00000000000003 y=-173.20508075688772 z_index=0

define inline_javascript trial_script
set description "Executes JavaScript code (ECMA 5.1)"
set _run ""
___prepare__
function shuffle(array) {
let counter = array.length;
while (counter > 0) {
let index = Math.floor(Math.random() * counter);
counter--;
let temp = array[counter];
array[counter] = array[index];
array[index] = temp;
}
return array
}

function random_pos(exclude) {
let pos = [1, 2, 3, 4, 5, 6]
if (typeof exclude != 'undefined') {
pos.splice(exclude - 1, 1)
}
pos = shuffle(pos)
return pos[0]
}

function target_symbol() {
return shuffle([vars.LEFT, vars.RIGHT])[0]
}

function dist_symbol() {
return shuffle([vars.TOP, vars.BOTTOM])[0]
}

let symbols = [
dist_symbol(),
dist_symbol(),
dist_symbol(),
dist_symbol(),
dist_symbol(),
dist_symbol()
]

let colors = [
vars.target_color,
vars.target_color,
vars.target_color,
vars.target_color,
vars.target_color,
vars.target_color
]


vars.dist_pos = (vars.distractor == 'present')
? random_pos()
: undefined
vars.target_pos = random_pos(vars.dist_pos)
vars.target_symbol = target_symbol()
vars.correct_response = (vars.target_symbol == vars.LEFT)
? vars.RESP_LEFT
: vars.RESP_RIGHT
colors[vars.dist_pos - 1] = vars.dist_color
symbols[vars.target_pos - 1] = vars.target_symbol

vars.s1 = symbols[0]
vars.s2 = symbols[1]
vars.s3 = symbols[2]
vars.s4 = symbols[3]
vars.s5 = symbols[4]
vars.s6 = symbols[5]

vars.c1 = colors[0]
vars.c2 = colors[1]
vars.c3 = colors[2]
vars.c4 = colors[3]
vars.c5 = colors[4]
vars.c6 = colors[5]
__end__

define sequence trial_sequence
set flush_keyboard yes
set description "Runs a number of items in sequence"
run trial_script always
run fixation_dot always
run search_display always
run keyboard_response always
run green_dot "[correct] = 1"
run red_dot "[correct] = 0"

define keyboard_response wait_left
set timeout infinite
set flush yes
set event_type keypress
set duration keypress
set description "Collects keyboard responses"
set allowed_responses "[RESP_LEFT]"

define keyboard_response wait_right
set timeout infinite
set flush yes
set event_type keypress
set duration keypress
set description "Collects keyboard responses"
set allowed_responses "[RESP_RIGHT]"

Binary file modified example-experiments/capybara.osexp
Binary file not shown.
Binary file added example-experiments/coroutines.osexp
Binary file not shown.
Loading