babe-project
Advanced tools
Comparing version 0.0.9 to 0.0.10
{ | ||
"name": "babe-project", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Basic Architecture for Browser-based experiments (https://github.com/babe-project)", | ||
@@ -9,6 +9,9 @@ "main": "babe-main.js", | ||
"jquery": "^3.3.1", | ||
"mustache": "^3.0.0", | ||
"mustache": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.6.1", | ||
"prettier": "^1.14.3", | ||
"uglify-es": "^3.3.9" | ||
}, | ||
"devDependencies": {}, | ||
"scripts": { | ||
@@ -18,3 +21,3 @@ "test": "echo \"Error: no test specified\" && exit 1" | ||
"author": "", | ||
"license": "ISC" | ||
"license": "MIT" | ||
} |
137
README.md
# \_babe project | ||
basic architecture for browser-based experiments | ||
## Creating a \_babe experiment with \_babe | ||
**Table of contents** | ||
### Option 1: Download the \_babe project package | ||
- [Create an experiment with \_babe](#create-an-experiment-with-_babe) | ||
- [Install \_babe](#install-_babe) | ||
- [How to use \_babe](#usage) | ||
- [Experiment Initialisation](#experiment-initialisation-with-_babeInit) | ||
- [Views](#views-in-_babe) | ||
- [Deploy configuraton](#deploy-configuration) | ||
- [Progress bar](#progress-bar) | ||
- [Sample experiment](#sample-experiment) | ||
1. Download the [\_babe .zip](https://github.com/babe-project/babe-base) | ||
2. Unzip and place the folder (babe-base-master) in the `libraries/` folder of your experiment. | ||
## Creating an experiment with \_babe | ||
Your experiment's structure should look something like this: | ||
### Install \_babe | ||
experiment/ | ||
+ libraries/ | ||
+ babe-babe-master | ||
+ \_babe.full.min.js | ||
+ \_babe.min.js | ||
+ ... | ||
+ ... | ||
#### Option 1: Download the babe-project | ||
1. Download the .zip from this repository | ||
2. Unzip and move `_babe.full.min.js`, `_babe.min.js` and `_babe-styles.css` in the `libraries/` folder of your experiment. | ||
Your experiment's structure should look like this: | ||
- experiment/ | ||
-libraries/ | ||
- `_babe.full.min.js` | ||
- `_babe-styles.css` | ||
- `_babe.min.js` | ||
`_babe.full.min.js` includes the dependencies that \_babe uses (jQuery, Mustache and csv-js). There is no need to install and import jQuery, Mustache and csv-js. | ||
@@ -26,46 +40,40 @@ | ||
`_babe-styles.css` includes styles for \_babe experiments. | ||
3. Import \_babe in your `index.html` | ||
the full version: | ||
`<script src="libraries/babe-base-master/_babe.full.min.js></script>` | ||
the full version or no-dependencies version: | ||
no-dependencies version: | ||
`<script src="libraries/babe-base-master/_babe.min.js></script>` | ||
`<script src="libraries/_babe.full.min.js></script>` or `<script src="libraries/_babe.min.js></script>` | ||
4. Use \_babe styles: | ||
and \_babe-styles: | ||
import \_babe-styles in your `index.html`: | ||
`<link rel="stylesheet" type="text/css" href="libraries/_babe-styles.css">` | ||
`<link rel="stylesheet" type="text/css" href="libraries/babe-base-master/_babe-styles.css">` | ||
### Option 2: Install with npm | ||
#### Option 2: Install with npm | ||
You need npm installed on your machine. Here is more information on how to [install npm](https://www.npmjs.com/get-npm) | ||
You need npm installed on your machine. Here is more information on how to [install npm](https://www.npmjs.com/get-npm). If you have npm installed, run the following command from your experiment's directory: | ||
If you have npm installed, run the following command from your experiment's directory | ||
`npm install babe-project --save` | ||
Dependencies: | ||
\_babe dependencies: | ||
+ jQuery | ||
+ Mustache | ||
+ csv-js | ||
- jQuery | ||
- Mustache | ||
- csv-js | ||
Include \_babe in your main `.html` file: | ||
``` | ||
<link rel="stylesheet" type="text/css" href="node_modules/babe-project/_babe-styles.css"> | ||
## Usage | ||
<script src="node_modules/mustache/mustache.min.js"></script> | ||
<script src="node_modules/jquery/dist/jquery.min.js"></script> | ||
<script src="node_modules/csv-js/csv.js"></script> | ||
<script src="node_modules/babe-project/_babe.min.js></script> | ||
``` | ||
Once you have installed \_babe, you can start using \_babe funcitons to create your experiment. | ||
You can use: | ||
## Usage | ||
* \_babeInit({..}) - to initialize the experiment | ||
* \_babeViews._view_ - to create an instance of a \_babe view | ||
### \_babe Initialisation | ||
### Experiment initialisation with \_babeInit | ||
Use `_babeInit()` to create a \_babe experiment. | ||
Use `_babeInit({..})` to create a \_babe experiment. | ||
@@ -112,3 +120,3 @@ `_babeInit` takes an object as a parameter with the following properties: | ||
\_babe views get inserted in an html element with id `main`, you need to have an html tag (preferrably `div` or `main`) | ||
\_babe views get inserted in a html element with id `main`, you need to have an html tag (preferrably `div` or `main`) | ||
with `id="main"` | ||
@@ -143,3 +151,3 @@ | ||
#### \_babe views | ||
#### Included views | ||
@@ -168,14 +176,15 @@ \_babe provides several ready-made views which you can access form the `_babeViews` object. | ||
* `trials` - the number of trials this view will appear | ||
* `trials: int` - the number of trials this view will appear | ||
* `name: string` | ||
* trial type views also have: | ||
* `trial_type` - the name of the trial type that will be in the final data (for example 'main binary choice'); | ||
* `data` - a list of trials | ||
* `trial_type: string` - the name of the trial type that will be in the final data (for example 'main binary choice'); | ||
* `data: array` - an array of trial objects | ||
* other views also have: | ||
* `title` - the title in the view | ||
* `text` - the text in the view | ||
* `buttonText` - the text on the button that takes the user to the newxt view | ||
* `title: string` - the title in the view | ||
* `text: string` - the text in the view | ||
* `buttonText: string` - the text on the button that takes the user to the newxt view | ||
@@ -240,3 +249,3 @@ Sample use of \_babe views: | ||
#### Creating your own views | ||
#### Custom views | ||
@@ -370,10 +379,13 @@ You can also create your own views. | ||
The deploy config has the following properties: | ||
The deploy config expects the following properties: | ||
* `experimentID` - the experimentID is needed to recover data from the babe server app. You receive the experimentID when you create the experiment using the babe server app | ||
* `serverAppURL` - if you use the _babe server app, specify its URL here | ||
* `deployMethod` - use one of 'debug', 'localServer', 'MTurk', 'MTurkSandbox', 'Prolific', 'directLink' | ||
* `contact_email` - who to contact in case of trouble | ||
* `prolificURL` - the prolific completion URL if the deploy method is "Prolific" | ||
* `experimentID: string` - the experimentID is needed to recover data from the babe server app. You receive the experimentID when you create the experiment using the babe server app | ||
* `serverAppURL: string` - if you use the _babe server app, specify its URL here | ||
* `deployMethod: string` - use one of 'debug', 'localServer', 'MTurk', 'MTurkSandbox', 'Prolific', 'directLink' | ||
* `contact_email: string` - who to contact in case of trouble | ||
* `prolificURL: string` - the prolific completion URL if the deploy method is "Prolific" | ||
prolificURL is only needed if the experiment runs on Prolific. | ||
### Progress Bar | ||
@@ -385,5 +397,5 @@ | ||
* `separate` - have separate progress bars in each views declared in `progress_bar.in` | ||
* `separate` - have separate progress bars in each type of views declared in `progress_bar.in` | ||
* `default` - have one progress bar throughout the whole experiment | ||
* `chunks` - have a separate progress chunk for each view in `progress_bar.in` | ||
* `chunks` - have a separate progress chunk for each type of view in `progress_bar.in` | ||
@@ -408,2 +420,15 @@ Use `progress_bar.width` to set the width (in pixels) of the progress bar or chunk | ||
}); | ||
``` | ||
``` | ||
## Sample experiment | ||
[Here](https://github.com/babe-project/MinimalTemplate/tree/modularized) you can find a sample forced-choice experiment created with \_babe. | ||
## Development | ||
ˇ | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
507448
3
0
427
3
- Removeduglify-es@^3.3.9
- Removedcommander@2.14.1(transitive)
- Removedsource-map@0.6.1(transitive)
- Removeduglify-es@3.3.10(transitive)