Mercurial > hg > webaudioevaluationtool
comparison interfaces/discrete.js @ 1295:ba8c8c7f1de5
Bug #1652 and Feature #1650 fixes. You can specify the track labels through page attribute 'label' ('default', 'none', 'number', 'letter', 'capital'). Updated examples to match schema
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Thu, 10 Mar 2016 16:16:16 +0000 |
parents | 175cf75946f7 |
children | ba6b9e1aaef5 |
comparison
equal
deleted
inserted
replaced
1294:e7a819fe85bf | 1295:ba8c8c7f1de5 |
---|---|
53 console.log('Stopped at ' + time); // DEBUG/SAFETY | 53 console.log('Stopped at ' + time); // DEBUG/SAFETY |
54 } | 54 } |
55 }; | 55 }; |
56 // Create Submit (save) button | 56 // Create Submit (save) button |
57 var submit = document.createElement("button"); | 57 var submit = document.createElement("button"); |
58 submit.innerHTML = 'Submit'; | 58 submit.innerHTML = 'Next'; |
59 submit.onclick = buttonSubmitClick; | 59 submit.onclick = buttonSubmitClick; |
60 submit.id = 'submit-button'; | 60 submit.id = 'submit-button'; |
61 submit.style.float = 'left'; | 61 submit.style.float = 'left'; |
62 // Append the interface buttons into the interfaceButtons object. | 62 // Append the interface buttons into the interfaceButtons object. |
63 interfaceButtons.appendChild(playback); | 63 interfaceButtons.appendChild(playback); |
182 var node = interfaceContext.createCommentQuestion(element); | 182 var node = interfaceContext.createCommentQuestion(element); |
183 feedbackHolder.appendChild(node.holder); | 183 feedbackHolder.appendChild(node.holder); |
184 }); | 184 }); |
185 | 185 |
186 // Find all the audioElements from the audioHolder | 186 // Find all the audioElements from the audioHolder |
187 var label = 0; | 187 var index = 0; |
188 var interfaceScales = testState.currentStateMap.interfaces[0].scales; | 188 var interfaceScales = testState.currentStateMap.interfaces[0].scales; |
189 $(page.audioElements).each(function(index,element){ | 189 $(page.audioElements).each(function(index,element){ |
190 // Find URL of track | 190 // Find URL of track |
191 // In this jQuery loop, variable 'this' holds the current audioElement. | 191 // In this jQuery loop, variable 'this' holds the current audioElement. |
192 | 192 |
196 // Construct outside reference; | 196 // Construct outside reference; |
197 var orNode = new outsideReferenceDOM(audioObject,index,document.getElementById('interface-buttons')); | 197 var orNode = new outsideReferenceDOM(audioObject,index,document.getElementById('interface-buttons')); |
198 audioObject.bindInterface(orNode); | 198 audioObject.bindInterface(orNode); |
199 } else { | 199 } else { |
200 // Create a slider per track | 200 // Create a slider per track |
201 switch(audioObject.specification.parent.label) { | |
202 case "none": | |
203 label = ""; | |
204 break; | |
205 case "letter": | |
206 label = String.fromCharCode(97 + index); | |
207 break; | |
208 case "capital": | |
209 label = String.fromCharCode(65 + index); | |
210 break; | |
211 default: | |
212 label = ""+index; | |
213 break; | |
214 } | |
201 var sliderObj = new discreteObject(audioObject,label,interfaceScales); | 215 var sliderObj = new discreteObject(audioObject,label,interfaceScales); |
202 sliderBox.appendChild(sliderObj.holder); | 216 sliderBox.appendChild(sliderObj.holder); |
203 audioObject.bindInterface(sliderObj); | 217 audioObject.bindInterface(sliderObj); |
204 interfaceContext.commentBoxes.createCommentBox(audioObject); | 218 interfaceContext.commentBoxes.createCommentBox(audioObject); |
205 label += 1; | 219 index += 1; |
206 } | 220 } |
207 | 221 |
208 }); | 222 }); |
209 | 223 |
210 if (page.showElementComments) | 224 if (page.showElementComments) |