cree.js
function(user){
		
		// First time nextStage() is called set the stage to zero. Otherwise keep track when continuing to the next stage
		user.data._stage = (typeof user.data._stage === 'undefined') ? 0 : user.data._stage+1;
		
		// Next stage is which type?
		var type = (typeof experiment.stages[user.data._stage].type === 'undefined') ? null : experiment.stages[user.data._stage].type; // 'undefined' set to null.
		switch (type) {
			
			// Static page. User does not have to wait but can continue to next stage on his/her own.
			case null:
			case 'static':
				var stage = experiment.stages[user.data._stage]; // stage in json file
				load(user, stage.url);
				break;
			
			// Syncronise users. Such that they proceed, as a group, to the next stage.
			case 'sync':
				load(user, experiment.stages[user.data._stage].url); // load waiting stage
				syncStage(user, user.data._stage, experiment.stages[user.data._stage].method); // syncronise users (wait for others)
				break;
			
			case 'randomise':
				// We only want to randomise once. So we do it when the first user enters the stage.
				if(stageCount(user.data._stage) == 1) {
					randomRooms(experiment.stages[user.data._stage].method);
				}
				nextStage(user);
				break;
		}
		
	}
function(user){
		
		// First time nextStage() is called set the stage to zero. Otherwise keep track when continuing to the next stage
		user.data._stage = (typeof user.data._stage === 'undefined') ? 0 : user.data._stage+1;
		
		// Next stage is which type?
		var type = (typeof experiment.stages[user.data._stage].type === 'undefined') ? null : experiment.stages[user.data._stage].type; // 'undefined' set to null.
		switch (type) {
			
			// Static page. User does not have to wait but can continue to next stage on his/her own.
			case null:
			case 'static':
				var stage = experiment.stages[user.data._stage]; // stage in json file
				load(user, stage.url);
				break;
			
			// Syncronise users. Such that they proceed, as a group, to the next stage.
			case 'sync':
				load(user, experiment.stages[user.data._stage].url); // load waiting stage
				syncStage(user, user.data._stage, experiment.stages[user.data._stage].method); // syncronise users (wait for others)
				break;
			
			case 'randomise':
				// We only want to randomise once. So we do it when the first user enters the stage.
				if(stageCount(user.data._stage) == 1) {
					randomRooms(experiment.stages[user.data._stage].method);
				}
				nextStage(user);
				break;
		}
		
	}
function ( user ) { // First time nextStage() is called set the stage to zero. Otherwise keep track when continuing to the next stage user . data . _stage = ( typeof user . data . _stage === 'undefined' ) ? 0 : user . data . _stage + 1 ; // Next stage is which type? var type = ( typeof experiment . stages [ user . data . _stage ] . type === 'undefined' ) ? null : experiment . stages [ user . data . _stage ] . type ; // 'undefined' set to null. switch ( type ) { // Static page. User does not have to wait but can continue to next stage on his/her own. case null : case 'static' : var stage = experiment . stages [ user . data . _stage ] ; // stage in json file load ( user , stage . url ) ; break ; // Syncronise users. Such that they proceed, as a group, to the next stage. case 'sync' : load ( user , experiment . stages [ user . data . _stage ] . url ) ; // load waiting stage syncStage ( user , user . data . _stage , experiment . stages [ user . data . _stage ] . method ) ; // syncronise users (wait for others) break ; case 'randomise' : // We only want to randomise once. So we do it when the first user enters the stage. if ( stageCount ( user . data . _stage ) == 1 ) { randomRooms ( experiment . stages [ user . data . _stage ] . method ) ; } nextStage ( user ) ; break ; } }
Push the user to the next stage
Push the user to the next stage