n@3096: function Specification(){function t(t){this.location=void 0,this.options=[],this.parent=void 0,this.showBackButton=!0,this.specification=t,this.addOption=function(){var t=new this.OptionNode(this.specification);return this.options.push(t),t},this.OptionNode=function(t){this.type=void 0,this.schema=void 0,this.id=void 0,this.name=void 0,this.mandatory=void 0,this.statement=void 0,this.boxsize=void 0,this.options=[],this.min=void 0,this.max=void 0,this.minWait=void 0,this.step=void 0,this.conditions=[],this.decode=function(t,e){this.schema=s.querySelector("[name="+e.nodeName+"]");var i,n=this.schema.querySelectorAll("attribute");for(i in n){if(!0===isNaN(Number(i)))break;var r=n[i].getAttribute("name")||n[i].getAttribute("ref"),o=e.getAttribute(r);null!==(o=a(o,n[i]))&&(this[r]=o)}if("surveyentry"==e.nodeName){if(console.log("NOTE - Use of is now deprecated. Whilst these will still work, newer nodes and tighter error checking will not be enforced"),console.log("Please use the newer, type specifc nodes"),!this.type)throw"Type not specified"}else this.type=e.nodeName.split("survey")[1];if(this.statement=e.getElementsByTagName("statement")[0].textContent,"checkbox"==this.type||"radio"==this.type){var h=e.getElementsByTagName("option");if(null===h.length)console.log("Malformed"+e.nodeName+"entry"),this.statement="Malformed"+e.nodeName+"entry",this.type="statement";else for(this.options=[],i=0;i0&&(this.leftText=l[0].textContent),m.length>0&&(this.rightText=m[0].textContent)}var c=e.getElementsByTagName("conditional");for(i=0;i0&&e.setAttribute("name",this.name),"string"==typeof this.title){var i=t.createElement("title");i.textContent=this.title,e.appendChild(i)}if(this.options.forEach(function(i){var s=t.createElement("interfaceoption");if(s.setAttribute("type",i.type),s.setAttribute("name",i.name),"check"==i.type&&void 0!==i.errorMessage){var n=t.createElement("errormessage");n.textContent=i.errorMessage,s.appendChild(n)}e.appendChild(s)}),"string"==typeof this.image&&0!==this.image.length){var s=t.createElement("image");s.setAttribute("src",this.image),e.appendChild(s)}if(0!==this.scales.length){var n=t.createElement("scales");this.scales.forEach(function(e){var i=t.createElement("scalelabel");i.setAttribute("position",e.position),i.textContent=e.text,n.appendChild(i)}),e.appendChild(n)}return e}}function i(i){function n(t){this.id=void 0,this.name=void 0,this.type=void 0,this.statement=void 0,this.mandatory=void 0,this.schema=s.querySelector("[name=commentquestion]"),this.decode=function(t,e){switch(this.id=e.id,this.name=e.getAttribute("name"),this.mandatory="true"==e.getAttribute("mandatory"),null===this.name&&(this.name=void 0),e.nodeName){case"commentradio":this.type="radio",this.options=[];break;case"commentcheckbox":this.type="checkbox",this.options=[];break;case"commentslider":this.type="slider",this.min=void 0,this.max=void 0,this.step=void 0;break;case"commentquestion":this.type="question";break;default:throw"Unknown comment type "+e.nodeName}if(this.statement=e.getElementsByTagName("statement")[0].textContent,"radio"==this.type||"checkbox"==this.type)for(var i=e.getElementsByTagName("option"),s=0;s0?this.leftText=this.leftText[0].textContent:this.leftText="",this.rightText=e.getElementsByTagName("maxText"),this.rightText&&this.rightText.length>0?this.rightText=this.rightText[0].textContent:this.rightText="")},this.encode=function(t){var e;switch(this.type){case"radio":e=t.createElement("commentradio");break;case"checkbox":e=t.createElement("commentcheckbox");break;case"slider":e=t.createElement("commentslider");break;case"question":e=t.createElement("commentquestion");break;default:throw"Unknown type "+this.type}e.id=this.id,e.setAttribute("mandatory",this.mandatory),e.setAttribute("type",this.type),void 0!==this.name&&e.setAttribute("name",this.name);var i=t.createElement("statement");if(i.textContent=this.statement,e.appendChild(i),"radio"!=this.type&&"checkbox"!=this.type||this.options.forEach(function(i){var s=t.createElement("option");s.setAttribute("name",i.name),s.textContent=i.text,e.appendChild(s)}),"slider"==this.type){if(e.setAttribute("min",this.min),e.setAttribute("max",this.max),1!==this.step&&e.setAttribute("step",this.step),this.value!==this.min&&e.setAttribute("value",this.value),this.leftText.length>0){var s=t.createElement("minText");s.textContent=this.leftText,e.appendChild(s)}if(this.rightText.length>0){var n=t.createElement("maxText");n.textContent=this.rightText,e.appendChild(n)}}return e}}function r(t){this.url=void 0,this.id=void 0,this.name=void 0,this.parent=void 0,this.type=void 0,this.marker=void 0,this.enforce=!1,this.gain=0,this.label=void 0,this.startTime=void 0,this.stopTime=void 0,this.sampleRate=void 0,this.image=void 0,this.minNumberPlays=void 0,this.maxNumberPlays=void 0,this.alternatives=[],this.schema=s.querySelector("[name=audioelement]"),this.parent=void 0,this.decode=function(t,e){this.parent=t;for(var i=this.schema.querySelectorAll("attribute"),s=0;s0){var r=t.createElement("commentquestions");for(e=0;e0&&"string"==typeof(n=a[0].getAttribute("base"))?n.substr(3):"string"}if(null===t)return t;switch(n){case"boolean":t="true"==t;break;case"negativeInteger":case"positiveInteger":case"nonNegativeInteger":case"nonPositiveInteger":case"integer":case"decimal":case"short":t=Number(t);break;default:t=String(t)}return t};this.processSchema=function(t){if(void 0===s){n=t;var e=new DOMParser;s=e.parseFromString(n,"text/xml"),Object.defineProperties(this,{schema:{value:s},schemaString:{value:n}})}},this.getSchema=function(){return s},this.getSchemaString=function(){return n},this.decode=function(t){s=this.schema,this.errors=[],this.projectXML=t.childNodes[0];var e,n=t.getElementsByTagName("setup")[0],r=s.querySelector("[name=setup]").querySelectorAll("attribute");for(e=0;e1&&this.errors.push("Only one node in the node allowed! Others except first ingnored!"),0!==c.length&&(c=c[0],this.interfaces.decode(this,c,this.schema.querySelectorAll("[name=interface]")[1]));var d=t.getElementsByTagName("page"),u=this.schema.querySelector("[name=page]");for(e=0;e