comparison interfaces/mushra.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
59 console.log('Stopped at ' + time); // DEBUG/SAFETY 59 console.log('Stopped at ' + time); // DEBUG/SAFETY
60 } 60 }
61 }; 61 };
62 // Create Submit (save) button 62 // Create Submit (save) button
63 var submit = document.createElement("button"); 63 var submit = document.createElement("button");
64 submit.innerHTML = 'Submit'; 64 submit.innerHTML = 'Next';
65 submit.onclick = buttonSubmitClick; 65 submit.onclick = buttonSubmitClick;
66 submit.id = 'submit-button'; 66 submit.id = 'submit-button';
67 submit.style.float = 'left'; 67 submit.style.float = 'left';
68 // Append the interface buttons into the interfaceButtons object. 68 // Append the interface buttons into the interfaceButtons object.
69 interfaceButtons.appendChild(playback); 69 interfaceButtons.appendChild(playback);
181 currentTestHolder = document.createElement('audioHolder'); 181 currentTestHolder = document.createElement('audioHolder');
182 currentTestHolder.id = audioHolderObject.id; 182 currentTestHolder.id = audioHolderObject.id;
183 currentTestHolder.repeatCount = audioHolderObject.repeatCount; 183 currentTestHolder.repeatCount = audioHolderObject.repeatCount;
184 184
185 // Find all the audioElements from the audioHolder 185 // Find all the audioElements from the audioHolder
186 var label = 0; 186 var index = 0;
187 $(audioHolderObject.audioElements).each(function(index,element){ 187 $(audioHolderObject.audioElements).each(function(index,element){
188 // Find URL of track 188 // Find URL of track
189 // In this jQuery loop, variable 'this' holds the current audioElement. 189 // In this jQuery loop, variable 'this' holds the current audioElement.
190 190
191 var audioObject = audioEngineContext.newTrack(element); 191 var audioObject = audioEngineContext.newTrack(element);
194 // Construct outside reference; 194 // Construct outside reference;
195 var orNode = new outsideReferenceDOM(audioObject,index,document.getElementById('interface-buttons')); 195 var orNode = new outsideReferenceDOM(audioObject,index,document.getElementById('interface-buttons'));
196 audioObject.bindInterface(orNode); 196 audioObject.bindInterface(orNode);
197 } else { 197 } else {
198 // Create a slider per track 198 // Create a slider per track
199 switch(audioObject.specification.parent.label) {
200 case "none":
201 label = "";
202 break;
203 case "letter":
204 label = String.fromCharCode(97 + index);
205 break;
206 case "capital":
207 label = String.fromCharCode(65 + index);
208 break;
209 default:
210 label = ""+index;
211 break;
212 }
199 var sliderObj = new sliderObject(audioObject,label); 213 var sliderObj = new sliderObject(audioObject,label);
200 214
201 if (typeof audioHolderObject.initialPosition === "number") 215 if (typeof audioHolderObject.initialPosition === "number")
202 { 216 {
203 // Set the values 217 // Set the values
207 sliderObj.slider.value = Math.random(); 221 sliderObj.slider.value = Math.random();
208 } 222 }
209 sliderBox.appendChild(sliderObj.holder); 223 sliderBox.appendChild(sliderObj.holder);
210 audioObject.bindInterface(sliderObj); 224 audioObject.bindInterface(sliderObj);
211 interfaceContext.commentBoxes.createCommentBox(audioObject); 225 interfaceContext.commentBoxes.createCommentBox(audioObject);
212 label += 1; 226 index += 1;
213 } 227 }
214 228
215 }); 229 });
216 230
217 if (audioHolderObject.showElementComments) { 231 if (audioHolderObject.showElementComments) {