Mercurial > hg > webaudioevaluationtool
comparison core.js @ 2030:979474558a2a
Feature #1228: Added survey question box sizes
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Fri, 05 Jun 2015 13:26:31 +0100 |
parents | 6c12679be494 |
children | f13b6efc4513 |
comparison
equal
deleted
inserted
replaced
2029:6c12679be494 | 2030:979474558a2a |
---|---|
114 this.popupContent.appendChild(span); | 114 this.popupContent.appendChild(span); |
115 } else if (node.type == 'question') { | 115 } else if (node.type == 'question') { |
116 var span = document.createElement('span'); | 116 var span = document.createElement('span'); |
117 span.textContent = node.question; | 117 span.textContent = node.question; |
118 var textArea = document.createElement('textarea'); | 118 var textArea = document.createElement('textarea'); |
119 switch (node.boxsize) { | |
120 case 'small': | |
121 textArea.cols = "20"; | |
122 textArea.rows = "1"; | |
123 break; | |
124 case 'normal': | |
125 textArea.cols = "30"; | |
126 textArea.rows = "2"; | |
127 break; | |
128 case 'large': | |
129 textArea.cols = "40"; | |
130 textArea.rows = "5"; | |
131 break; | |
132 case 'huge': | |
133 textArea.cols = "50"; | |
134 textArea.rows = "10"; | |
135 break; | |
136 } | |
119 var br = document.createElement('br'); | 137 var br = document.createElement('br'); |
120 this.popupContent.appendChild(span); | 138 this.popupContent.appendChild(span); |
121 this.popupContent.appendChild(br); | 139 this.popupContent.appendChild(br); |
122 this.popupContent.appendChild(textArea); | 140 this.popupContent.appendChild(textArea); |
123 this.popupContent.childNodes[2].focus(); | 141 this.popupContent.childNodes[2].focus(); |
1098 this.childOption = function(element) { | 1116 this.childOption = function(element) { |
1099 this.type = 'option'; | 1117 this.type = 'option'; |
1100 this.id = element.id; | 1118 this.id = element.id; |
1101 this.name = element.getAttribute('name'); | 1119 this.name = element.getAttribute('name'); |
1102 this.text = element.textContent; | 1120 this.text = element.textContent; |
1103 } | 1121 }; |
1104 | 1122 |
1105 this.type = child.nodeName; | 1123 this.type = child.nodeName; |
1106 if (child.nodeName == "question") { | 1124 if (child.nodeName == "question") { |
1107 this.id = child.id; | 1125 this.id = child.id; |
1108 this.mandatory; | 1126 this.mandatory; |
1109 if (child.getAttribute('mandatory') == "true") {this.mandatory = true;} | 1127 if (child.getAttribute('mandatory') == "true") {this.mandatory = true;} |
1110 else {this.mandatory = false;} | 1128 else {this.mandatory = false;} |
1111 this.question = child.textContent; | 1129 this.question = child.textContent; |
1130 if (child.getAttribute('boxsize') == null) { | |
1131 this.boxsize = 'normal'; | |
1132 } else { | |
1133 this.boxsize = child.getAttribute('boxsize'); | |
1134 } | |
1112 } else if (child.nodeName == "statement") { | 1135 } else if (child.nodeName == "statement") { |
1113 this.statement = child.textContent; | 1136 this.statement = child.textContent; |
1114 } else if (child.nodeName == "checkbox" || child.nodeName == "radio") { | 1137 } else if (child.nodeName == "checkbox" || child.nodeName == "radio") { |
1115 var element = child.firstElementChild; | 1138 var element = child.firstElementChild; |
1116 this.id = child.id; | 1139 this.id = child.id; |