Mercurial > hg > webaudioevaluationtool
comparison test_create/test_create.html @ 159:2799bb693f70 Dev_main
Creat_Test: Structure for APE created.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Mon, 01 Jun 2015 15:26:58 +0100 |
parents | 0a6077dd8b78 |
children | 918d9a5943cd |
comparison
equal
deleted
inserted
replaced
157:0a6077dd8b78 | 159:2799bb693f70 |
---|---|
30 var input = document.createElement("input"); | 30 var input = document.createElement("input"); |
31 input.type = type; | 31 input.type = type; |
32 return [id, input]; | 32 return [id, input]; |
33 } | 33 } |
34 | 34 |
35 function removeNode(event) { | |
36 event.srcElement.parentElement.parentElement.removeChild(event.srcElement.parentElement); | |
37 } | |
38 | |
35 function questionNode() { | 39 function questionNode() { |
36 var node = document.createElement("div"); | 40 var node = document.createElement("div"); |
37 node.setAttribute('class','head'); | 41 node.setAttribute('class','head'); |
38 node.setAttribute('name','question-node'); | 42 node.setAttribute('name','question-node'); |
39 var nodeTitle = document.createElement("span"); | 43 var nodeTitle = document.createElement("span"); |
44 var question = attributePair("Question:","text"); | 48 var question = attributePair("Question:","text"); |
45 node.appendChild(nodeTitle); | 49 node.appendChild(nodeTitle); |
46 id.forEach(function(item){attributes.appendChild(item);},false); | 50 id.forEach(function(item){attributes.appendChild(item);},false); |
47 question.forEach(function(item){attributes.appendChild(item);},false); | 51 question.forEach(function(item){attributes.appendChild(item);},false); |
48 node.appendChild(attributes); | 52 node.appendChild(attributes); |
53 | |
54 var removeButton = document.createElement("button"); | |
55 removeButton.textContent = "Remove"; | |
56 removeButton.onclick = removeNode; | |
57 node.appendChild(removeButton); | |
49 return node; | 58 return node; |
50 } | 59 } |
51 | 60 |
52 function statementNode() { | 61 function statementNode() { |
53 var node = document.createElement("div"); | 62 var node = document.createElement("div"); |
59 attributes.setAttribute('class','attrib'); | 68 attributes.setAttribute('class','attrib'); |
60 var statement = attributePair("Statement:","text"); | 69 var statement = attributePair("Statement:","text"); |
61 node.appendChild(nodeTitle); | 70 node.appendChild(nodeTitle); |
62 statement.forEach(function(item){attributes.appendChild(item);},false); | 71 statement.forEach(function(item){attributes.appendChild(item);},false); |
63 node.appendChild(attributes); | 72 node.appendChild(attributes); |
73 | |
74 var removeButton = document.createElement("button"); | |
75 removeButton.textContent = "Remove"; | |
76 removeButton.onclick = removeNode; | |
77 node.appendChild(removeButton); | |
64 return node; | 78 return node; |
65 } | 79 } |
66 | 80 |
67 function audioHolderNode() { | 81 function audioHolderNode() { |
68 var audioHolderCounts = document.getElementsByName("audio-holder").length; | 82 var audioHolderCounts = document.getElementsByName("audio-holder").length; |
69 var node = document.createElement("div"); | 83 var node = document.createElement("div"); |
70 node.setAttribute("class","head"); | 84 node.setAttribute("class","head"); |
71 node.setAttribute("name","audio-holder"); | 85 node.setAttribute("name","audio-holder"); |
72 node.setAttribute("id","audio-holder-"+length); | 86 node.setAttribute("id","audio-holder-"+audioHolderCounts); |
73 var nodeTitle = document.createElement("span"); | 87 var nodeTitle = document.createElement("span"); |
74 nodeTitle.textContent = "Audio Holder "+(length+1); | 88 nodeTitle.textContent = "Audio Holder "+(audioHolderCounts+1); |
75 | 89 |
76 var attributes = document.createElement("div"); | 90 var attributes = document.createElement("div"); |
77 attributes.setAttribute('class','attrib'); | 91 attributes.setAttribute('class','attrib'); |
78 var id = attributePair("ID:","text"); | 92 var id = attributePair("ID:","text"); |
79 id[1].value=length; | 93 id[1].value=audioHolderCounts; |
94 var hostURL = attributePair("Host URL:", "text"); | |
95 var sampleRate = attributePair("Sample Rate:","text"); | |
96 var randomiseOrder = attributePair("Randomise Element Order:","checkbox"); | |
97 var repeatCount = attributePair("Repeat Page Count:","number"); | |
98 repeatCount[1].value = 0; | |
99 var loop = attributePair("Loop Element Playback","checkbox"); | |
100 var elementComments = attributePair("Enable Comment Boxes","checkbox"); | |
101 id.forEach(function(item){attributes.appendChild(item);},false); | |
102 hostURL.forEach(function(item){attributes.appendChild(item);},false); | |
103 sampleRate.forEach(function(item){attributes.appendChild(item);},false); | |
104 hostURL.forEach(function(item){attributes.appendChild(item);},false); | |
105 randomiseOrder.forEach(function(item){attributes.appendChild(item);},false); | |
106 repeatCount.forEach(function(item){attributes.appendChild(item);},false); | |
107 loop.forEach(function(item){attributes.appendChild(item);},false); | |
108 elementComments.forEach(function(item){attributes.appendChild(item);},false); | |
109 | |
110 node.appendChild(nodeTitle); | |
111 node.appendChild(attributes); | |
112 | |
113 var pretest = document.createElement("div"); | |
114 pretest.setAttribute('class','head'); | |
115 pretest.setAttribute('name','pre-test'); | |
116 var pretestTitle = document.createElement("h4"); | |
117 pretestTitle.textContent = "Pre Test"; | |
118 var buttonAddQ = document.createElement("button"); | |
119 buttonAddQ.textContent = "Add Pre Test Question"; | |
120 buttonAddQ.onclick = function(){event.srcElement.parentElement.appendChild(questionNode());}; | |
121 var buttonAddS = document.createElement("button"); | |
122 buttonAddS.textContent = "Add Pre Test Statement"; | |
123 buttonAddS.onclick = function(){event.srcElement.parentElement.appendChild(statementNode());}; | |
124 pretest.appendChild(pretestTitle); | |
125 pretest.appendChild(buttonAddQ); | |
126 pretest.appendChild(buttonAddS); | |
127 | |
128 var posttest = document.createElement("div"); | |
129 posttest.setAttribute('class','head'); | |
130 posttest.setAttribute('name','post-test'); | |
131 var posttestTitle = document.createElement("h4"); | |
132 posttestTitle.textContent = "Post Test"; | |
133 var buttonAddQ = document.createElement("button"); | |
134 buttonAddQ.textContent = "Add Post Test Question"; | |
135 buttonAddQ.onclick = function(){event.srcElement.parentElement.appendChild(questionNode());}; | |
136 var buttonAddS = document.createElement("button"); | |
137 buttonAddS.textContent = "Add Post Test Statement"; | |
138 buttonAddS.onclick = function(){event.srcElement.parentElement.appendChild(statementNode());}; | |
139 posttest.appendChild(posttestTitle); | |
140 posttest.appendChild(buttonAddQ); | |
141 posttest.appendChild(buttonAddS); | |
142 | |
143 node.appendChild(pretest); | |
144 node.appendChild(posttest); | |
145 | |
146 var newAudioElementButton = document.createElement("button"); | |
147 newAudioElementButton.textContent = "Add audio element"; | |
148 newAudioElementButton.onclick = function(){ | |
149 event.srcElement.parentElement.appendChild(audioElementNode()); | |
150 }; | |
151 node.appendChild(newAudioElementButton); | |
152 | |
153 var newCommentButton = document.createElement("button"); | |
154 newCommentButton.textContent = "Add Comment Box"; | |
155 newCommentButton.onclick = function() { | |
156 event.srcElement.parentElement.appendChild(commentBox()); | |
157 }; | |
158 node.appendChild(newCommentButton); | |
159 | |
160 var removeButton = document.createElement("button"); | |
161 removeButton.textContent = "Remove Audio Holder"; | |
162 removeButton.onclick = removeNode; | |
163 node.appendChild(removeButton); | |
164 return node; | |
165 } | |
166 | |
167 function audioElementNode() { | |
168 var parentStructure = event.srcElement.parentElement.childNodes; | |
169 var audioElemCounts = 0; | |
170 for (var i=0; i<parentStructure.length; i++) { | |
171 if (parentStructure[i].getAttribute('name') == "audio-element") | |
172 {audioElemCounts++;} | |
173 } | |
174 var node = document.createElement('div'); | |
175 node.setAttribute('class','head'); | |
176 node.setAttribute('name','audio-element'); | |
177 var nodeTitle = document.createElement('span'); | |
178 nodeTitle.textContent = 'Audio Element '+(audioElemCounts+1); | |
179 | |
180 var attributes = document.createElement("div"); | |
181 attributes.setAttribute('class','attrib'); | |
182 var id = attributePair("ID:","text"); | |
183 id[1].value = audioElemCounts; | |
184 var url = attributePair("URL:","text"); | |
185 id.forEach(function(item){attributes.appendChild(item);},false); | |
186 url.forEach(function(item){attributes.appendChild(item);},false); | |
187 | |
188 node.appendChild(nodeTitle); | |
189 node.appendChild(attributes); | |
190 | |
191 var removeButton = document.createElement("button"); | |
192 removeButton.textContent = "Remove Audio Element"; | |
193 removeButton.onclick = removeNode; | |
194 node.appendChild(removeButton); | |
195 return node; | |
196 } | |
197 | |
198 function commentBox() { | |
199 var node = document.createElement('div'); | |
200 node.setAttribute('class','head'); | |
201 node.setAttribute('name','comment-question'); | |
202 var nodeTitle = document.createElement('h4'); | |
203 nodeTitle.textContent = "Comment Box"; | |
204 | |
205 var attributes = document.createElement('div'); | |
206 attributes.setAttribute('class','attrib'); | |
207 var id = attributePair("ID:",'text'); | |
208 var question = attributePair("Question:",'text'); | |
209 id.forEach(function(item){attributes.appendChild(item);},false); | |
210 question.forEach(function(item){attributes.appendChild(item);},false); | |
211 | |
212 var removeButton = document.createElement("button"); | |
213 removeButton.textContent = "Remove Comment Box"; | |
214 removeButton.onclick = removeNode; | |
215 | |
216 node.appendChild(nodeTitle); | |
217 node.appendChild(attributes); | |
218 node.appendChild(removeButton); | |
219 return node; | |
80 } | 220 } |
81 </script> | 221 </script> |
82 <style> | 222 <style> |
83 div { | 223 div { |
84 padding: 2px; | 224 padding: 2px; |
146 <input type="checkbox" id="elementFlagListened" /> | 286 <input type="checkbox" id="elementFlagListened" /> |
147 <span>Element Flag Moved</span> | 287 <span>Element Flag Moved</span> |
148 <input type="checkbox" id="elementFlagMoved" /> | 288 <input type="checkbox" id="elementFlagMoved" /> |
149 </div> | 289 </div> |
150 </div> | 290 </div> |
151 <button id="addAudioHolder">Add AudioHolder / Test Page</button> | 291 <button id="addAudioHolder" onclick="event.srcElement.parentElement.appendChild(audioHolderNode());">Add AudioHolder / Test Page</button> |
152 </div> | 292 </div> |
153 </div> | 293 </div> |
154 </div> | 294 </div> |
155 </body> | 295 </body> |
156 </html> | 296 </html> |