define(['managerAPI'], function(Manager){
// This code is responsible for styling the piQuest tasks as panels (like piMessage)
// Don't touch unless you know what you're doing
var css = '[pi-quest]{background-color: #fff;border: 1px solid transparent;border-radius: 4px;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);margin-bottom: 20px;border-color: #bce8f1;padding:15px;}';
window.angular.element(document).find('head').prepend('');
var API = new Manager();
API.addSettings('skin', 'demo');
API.addSettings('skip',true); // TODO: false for study?
API.addSettings('logger', {
pulse: 400
});
API.setName('mgr');
var global = API.getGlobal();
var colorSet1 = ['red', 'green'];
var colorSet2 = ['yellow', 'purple'];
var colorSet3 = ['blue', 'orange'];
var colorArtSet1 = ['a red', 'a green'];
var colorArtSet2 = ['a yellow', 'a purple'];
var colorArtSet3 = ['a blue', 'an orange'];
var colorLabelSet1 = ['Red', 'Green'];
var colorLabelSet2 = ['Yellow', 'Purple'];
var colorLabelSet3 = ['Blue', 'Orange'];
var nums1 = [0, 1];
var nums2 = [0, 1];
var nums3 = [0, 1];
nums1 = API.shuffle(nums1);
nums2 = API.shuffle(nums2);
nums3 = API.shuffle(nums3);
colorSet1 = nums1.map(function(i){return colorSet1[i];});
colorArtSet1 = nums1.map(function(i){return colorArtSet1[i];});
colorLabelSet1 = nums1.map(function(i){return colorLabelSet1[i];});
colorSet2 = nums2.map(function(i){return colorSet2[i];});
colorArtSet2 = nums2.map(function(i){return colorArtSet2[i];});
colorLabelSet2 = nums2.map(function(i){return colorLabelSet2[i];});
colorSet3 = nums3.map(function(i){return colorSet3[i];});
colorArtSet3 = nums3.map(function(i){return colorArtSet3[i];});
colorLabelSet3 = nums3.map(function(i){return colorLabelSet3[i];});
var nums = [0, 1, 2];
nums = API.shuffle(nums);
var colors = [colorSet1, colorSet2, colorSet3];
var colorArticles = [colorArtSet1, colorArtSet2, colorArtSet3];
var colorLabels = [colorLabelSet1, colorLabelSet2, colorLabelSet3];
colors = nums.map(function(i){return colors[i];});
colorArticles = nums.map(function(i){return colorArticles[i];});
colorLabels = nums.map(function(i){return colorLabels[i];});
var foods = API.shuffle(['apple', 'banana', 'cake', 'salad', 'sandwich']);
var drinks = API.shuffle(['bottle', 'lemonade', 'milk', 'tea', 'water']);
var nums4 = [0, 1];
nums4 = API.shuffle(nums4);
var rewards = [foods, drinks];
var rewardLabels = ['Food', 'Drink'];
var rewardLabels2 = ['food', 'water'];
var rewardLabels3 = ['Food', 'Water'];
var machineNames = ['food machine', 'drink machine'];
var negState = ['hungry', 'dehydrated'];
var posState = ['overhydrated', 'overfed'];
rewards = nums4.map(function(i){return rewards[i];});
rewardLabels = nums4.map(function(i){return rewardLabels[i];});
rewardLabels2 = nums4.map(function(i){return rewardLabels2[i];});
rewardLabels3 = nums4.map(function(i){return rewardLabels3[i];});
machineNames = nums4.map(function(i){return machineNames[i];});
negState = nums4.map(function(i){return negState[i];});
posState = nums4.map(function(i){return posState[i];});
API.save({colors:colors}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({colors:colors}); //adds to global
API.save({colorLabels:colorLabels}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({colorLabels:colorLabels}); //adds to global
API.save({colorArticles:colorArticles}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({colorArticles:colorArticles}); //adds to global
API.save({rewards:rewards}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({rewards:rewards}); //adds to global
API.save({rewardLabels:rewardLabels}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({rewardLabels:rewardLabels}); //adds to global
API.save({rewardLabels2:rewardLabels2}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({rewardLabels2:rewardLabels2}); //adds to global
API.save({rewardLabels3:rewardLabels3}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({rewardLabels3:rewardLabels3}); //adds to global
API.save({machineNames:machineNames}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({machineNames:machineNames}); //adds to global
API.save({negState:negState}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({negState:negState}); //adds to global
API.save({posState:posState}); //saves to the data (YBYB: there is a better method in Minno's next version)
API.addGlobal({posState:posState}); //adds to global
//Define all the tasks.
API.addTasksSet(
{
instructions :
[{
type:'message',
buttonText:'Continue',
piTemplate:true
}],
consent : [{
type: 'quest',
name: 'consent',
scriptUrl: 'consent.js',
header: 'Consent',
title: 'Consent Agreement'
}],
warning: [{
type: 'message',
buttonText: 'Continue',
name:'warning',
templateUrl: 'warning.jst',
title:'Warning',
piTemplate:true,
header:'Warning'
}],
commit: [{
type: 'quest',
name: 'realstart',
scriptUrl: 'commit.js'
}],
redirectpage : [{
type: 'message',
name: 'redirectpage',
templateUrl: 'redirectpage.jst',
piTemplate: true,
buttonText: 'Continue'
}],
//this redirects participants back into the pool.
redirect: [{
type:'redirect',
url: '/implicit/Assign'
}],
game1inst1 : [{
type: 'quest',
name: 'game1inst1',
scriptUrl: 'game1inst1.js'
}],
game1inst2 : [{
type: 'quest',
name: 'game1inst2',
scriptUrl: 'game1inst2.js'
}],
game1inst3 : [{
type: 'quest',
name: 'game1inst3',
scriptUrl: 'game1inst3.js'
}],
game1inst4a : [{
type: 'quest',
name: 'game1inst4a',
scriptUrl: 'game1inst4a.js'
}],
game1inst4b : [{
type: 'quest',
name: 'game1inst4b',
scriptUrl: 'game1inst4b.js'
}],
game1inst4c : [{
type: 'quest',
name: 'game1inst4c',
scriptUrl: 'game1inst4c.js'
}],
game1inst5 : [{
type: 'quest',
name: 'game1inst5',
scriptUrl: 'game1inst5.js'
}],
game2inst1 : [{
type: 'quest',
name: 'game2inst1',
scriptUrl: 'game2inst1.js'
}],
game2inst2a_motreval : [{
type: 'quest',
name: 'game2inst2a_motreval',
scriptUrl: 'game2inst2a_motreval.js'
}],
game2inst2a_transreval : [{
type: 'quest',
name: 'game2inst2a_transreval',
scriptUrl: 'game2inst2a_transreval.js'
}],
game2inst2b_motreval : [{
type: 'quest',
name: 'game2inst2b_motreval',
scriptUrl: 'game2inst2b_motreval.js'
}],
game2inst2b_transreval : [{
type: 'quest',
name: 'game2inst2b_transreval',
scriptUrl: 'game2inst2b_transreval.js'
}],
game2inst2_baseline : [{
type: 'quest',
name: 'game2inst2_baseline',
scriptUrl: 'game2inst2_baseline.js'
}],
game2inst3_motreval : [{
type: 'quest',
name: 'game2inst3_motreval',
scriptUrl: 'game2inst3_motreval.js'
}],
game2inst3_transreval : [{
type: 'quest',
name: 'game2inst3_transreval',
scriptUrl: 'game2inst3_transreval.js'
}],
game2inst3_baseline : [{
type: 'quest',
name: 'game2inst3_baseline',
scriptUrl: 'game2inst3_baseline.js'
}],
check : [{
type: 'quest',
name: 'check',
scriptUrl: 'check.js'
}],
preview: [{
type: 'pip',
name: 'preview',
version: '0.3.35',
scriptUrl: 'preview.js',
title: 'Preview'
}],
game1: [{
type: 'pip',
name: 'game1',
version: '0.3.35',
scriptUrl: 'game1.js',
title: 'Game'
}],
game2_motreval: [{
type: 'pip',
name: 'game2_motreval',
version: '0.3.35',
scriptUrl: 'game2_motreval.js',
title: 'Preview'
}],
game2_transreval: [{
type: 'pip',
name: 'game2_transreval',
version: '0.3.35',
scriptUrl: 'game2_transreval.js',
title: 'Preview'
}],
instiat : [{
type: 'quest',
name: 'instiat',
scriptUrl: 'instiat.js'
}],
iat: [{
type: 'pip',
name: 'iat',
version: '0.3.35',
scriptUrl: 'iat.js'
}],
exp : [{
type: 'quest',
name: 'Survey',
scriptUrl: 'exp.js'
}],
lastpage : [{
inherit:'instructions',
name:'lastpage',
templateUrl: 'lastpage.jst',
title:'Thank you!',
header:'Thank you!'
}],
debrief: [{
type: 'message',
name: 'debrief',
templateUrl: 'debrief.jst',
piTemplate: 'debrief',
title: 'Debriefing',
last: true
}]
});
API.addSequence([
{inherit:'warning'},
{inherit:'consent'},
{
mixer: 'branch',// if participants choose "I decline", they are taken to a transition page telling them they are being redirected
conditions: [
function(){ return piGlobal.consent.questions.userconsent.response === true;}
],
data: [
{inherit: 'commit'}
],
elseData: [// if participants does not agree to participate, they are redirected.
{inherit: 'redirectpage'},
{inherit: 'redirect'}
]
},
{inherit:'game1inst1'},
{inherit:'game1inst2'},
{inherit:'game1inst3'},
{inherit:'game1inst4a'},
{inherit:'preview'},
{inherit:'game1inst4b'},
{inherit:'game1inst4c'},
{inherit:'game1inst5'},
{inherit:'game1'},
{mixer: 'choose',
n: 1,
data: [
// Baseline condition
{mixer: 'wrapper',
data: [
{inherit:'game2inst1'},
{inherit:'game2inst2_baseline'},
{inherit:'check'},
{inherit:'game2inst3_baseline'}
]
},
// Motivational revaluation condition
{mixer: 'wrapper',
data: [
{inherit:'game2inst1'},
{inherit:'game2inst2a_motreval'},
{inherit:'game2inst2b_motreval'},
{inherit:'game2_motreval'},
{inherit:'check'},
{inherit:'game2inst3_motreval'}
]
},
// Transition revaluation condition
{mixer: 'wrapper',
data: [
{inherit:'game2inst1'},
{inherit:'game2inst2a_transreval'},
{inherit:'game2inst2b_transreval'},
{inherit:'game2_transreval'},
{inherit:'check'},
{inherit:'game2inst3_transreval'}
]
}
]
},
{inherit:'instiat'},
{inherit:'iat'},
{inherit:'exp'},
{inherit:'lastpage'},
{inherit:'debrief'}
]);
return API.script;
});