Overview
The surveyman.js repository contains three modules. Together these three modules form the SurveyMan runtime system, contained in the SurveyMan namespace. This runtime system receives a JSON representation of a survey and executes that survey (with the help of a human!) in a browser. These three modules are meant to be used with the SurveyMan server and static analyzer. Currently this code expects to be executed inside https://github.com/SurveyMan/Runner/blob/master/src/main/resources/HTMLSkeleton.html.Install
npm install surveymanUsage
Warning: These instructions are deprecated
If you use these modules with the SurveyMan Java backend, everything is good to go! If you're using your own backend or otherwise modifying some part of the pipeline, you will need to ensure the following are present in your HTML for everything to work:
First, make sure you have the following in the head:
<script type="text/javascript" src="http://surveyman.github.io/surveyman.js/deprecated/survey.js"></script>
<script type="text/javascript" src="http://surveyman.github.io/surveyman.js/deprecated/interpreter.js"></script>
<script type="text/javascript" src="http://surveyman.github.io/surveyman.js/deprecated/display.js"></script>
If you are using AMT as your backend, you will also need a link to the submission script in the head, per the AMT documentations. If you are using a local backend, you will need some way to capture the assignment id, since it's used to seed the random number generator. The SurveyMan backend generates the following when it is being run locally:
<script type="text/javascript">
$.ajaxSetup({async:false});
var turkSetAssignmentID = function () {
$.get("assignmentId", function(_aid) {
console.log("Just pulled assignment Id : " + _aid);
document.getElementById("assignmentId").value = _aid.trim();
aid = _aid;
});
};
</script>
turkSetAssignmentId is an AMT-defined function. Since SurveyMan.display.ready expects it, we define a local version here. AMT also injects an `assignmentId` element, so when we run locally, we add an element with this id to our form.
SurveyMan generates a form to be sent with a POST; although a user-defined version could simply collect data in a Javascript object and POST this back to a local server, we wanted to be able to write one version to work with both AMT and a local server.
At the end of the body, SurveyMan adds the following snippet:
<script type='text/javascript'> turkSetAssignmentID(); var loadPreview=function(){- Source: