comparison ape.js @ 1582:d4b626a4bc76

Comment Boxes handled by Interface object.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Thu, 04 Jun 2015 16:48:04 +0100
parents 284251e3a6a3
children 62e755ce8d34
comparison
equal deleted inserted replaced
1581:284251e3a6a3 1582:d4b626a4bc76
18 // Get the dimensions of the screen available to the page 18 // Get the dimensions of the screen available to the page
19 var width = window.innerWidth; 19 var width = window.innerWidth;
20 var height = window.innerHeight; 20 var height = window.innerHeight;
21 21
22 // The injection point into the HTML page 22 // The injection point into the HTML page
23 var insertPoint = document.getElementById("topLevelBody"); 23 interfaceContext.insertPoint = document.getElementById("topLevelBody");
24 var testContent = document.createElement('div'); 24 var testContent = document.createElement('div');
25 25
26 testContent.id = 'testContent'; 26 testContent.id = 'testContent';
27 27
28 28
155 // Global parent for the comment boxes on the page 155 // Global parent for the comment boxes on the page
156 var feedbackHolder = document.createElement('div'); 156 var feedbackHolder = document.createElement('div');
157 feedbackHolder.id = 'feedbackHolder'; 157 feedbackHolder.id = 'feedbackHolder';
158 158
159 testContent.style.zIndex = 1; 159 testContent.style.zIndex = 1;
160 insertPoint.innerHTML = null; // Clear the current schema 160 interfaceContext.insertPoint.innerHTML = null; // Clear the current schema
161 161
162 // Inject into HTML 162 // Inject into HTML
163 testContent.appendChild(title); // Insert the title 163 testContent.appendChild(title); // Insert the title
164 testContent.appendChild(pagetitle); 164 testContent.appendChild(pagetitle);
165 testContent.appendChild(interfaceButtons); 165 testContent.appendChild(interfaceButtons);
166 testContent.appendChild(sliderBox); 166 testContent.appendChild(sliderBox);
167 testContent.appendChild(feedbackHolder); 167 testContent.appendChild(feedbackHolder);
168 insertPoint.appendChild(testContent); 168 interfaceContext.insertPoint.appendChild(testContent);
169 169
170 // Load the full interface 170 // Load the full interface
171 testState.initialise(); 171 testState.initialise();
172 testState.advanceState(); 172 testState.advanceState();
173 173
276 // Find URL of track 276 // Find URL of track
277 // In this jQuery loop, variable 'this' holds the current audioElement. 277 // In this jQuery loop, variable 'this' holds the current audioElement.
278 278
279 // Now load each audio sample. First create the new track by passing the full URL 279 // Now load each audio sample. First create the new track by passing the full URL
280 var trackURL = audioHolderObject.hostURL + element.url; 280 var trackURL = audioHolderObject.hostURL + element.url;
281 var audioObject = audioEngineContext.newTrack(trackURL); 281 var audioObject = audioEngineContext.newTrack(element);
282 282
283 if (commentShow) { 283 if (commentShow) {
284 // Create document objects to hold the comment boxes 284 var node = interfaceContext.createCommentBox(audioObject);
285 var trackComment = document.createElement('div');
286 trackComment.className = 'comment-div';
287 trackComment.id = 'comment-div-'+index;
288 // Create a string next to each comment asking for a comment
289 var trackString = document.createElement('span');
290 trackString.innerHTML = commentBoxPrefix+' '+index;
291 // Create the HTML5 comment box 'textarea'
292 var trackCommentBox = document.createElement('textarea');
293 trackCommentBox.rows = '4';
294 trackCommentBox.cols = '100';
295 trackCommentBox.name = 'trackComment'+index;
296 trackCommentBox.className = 'trackComment';
297 var br = document.createElement('br');
298 // Add to the holder.
299 trackComment.appendChild(trackString);
300 trackComment.appendChild(br);
301 trackComment.appendChild(trackCommentBox);
302 feedbackHolder.appendChild(trackComment);
303 audioObject.commentDOM = trackComment;
304 } 285 }
305 286
306 // Create a slider per track 287 // Create a slider per track
307 288
308 var trackSliderObj = document.createElement('div'); 289 var trackSliderObj = document.createElement('div');
352 333
353 canvas.appendChild(trackSliderObj); 334 canvas.appendChild(trackSliderObj);
354 audioObject.metric.initialised(convSliderPosToRate(index)); 335 audioObject.metric.initialised(convSliderPosToRate(index));
355 336
356 }); 337 });
338 if (commentShow) {
339 interfaceContext.showCommentBoxes(feedbackHolder,true);
340 }
357 341
358 // Append any commentQuestion boxes 342 // Append any commentQuestion boxes
359 $(audioHolderObject.commentQuestions).each(function(index,element) { 343 $(audioHolderObject.commentQuestions).each(function(index,element) {
360 // Create document objects to hold the comment boxes 344 // Create document objects to hold the comment boxes
361 var trackComment = document.createElement('div'); 345 var trackComment = document.createElement('div');