Mercurial > hg > webaudioevaluationtool
changeset 1674:ce9ea95a6279
Added commentQuestion object
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Tue, 21 Apr 2015 21:32:42 +0100 |
parents | faa111de3b33 |
children | 23d44ef052fe |
files | ape.js |
diffstat | 1 files changed, 37 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ape.js Tue Apr 21 21:15:12 2015 +0100 +++ b/ape.js Tue Apr 21 21:32:42 2015 +0100 @@ -497,6 +497,30 @@ canvas.appendChild(trackSliderObj); }); + // Append any commentQuestion boxes + var commentQuestions = $(textXML).find('CommentQuestion'); + $(commentQuestions).each(function(index,element) { + // Create document objects to hold the comment boxes + var trackComment = document.createElement('div'); + trackComment.className = 'comment-div commentQuestion'; + trackComment.id = element.attributes['id'].value; + // Create a string next to each comment asking for a comment + var trackString = document.createElement('span'); + trackString.innerHTML = element.textContent; + // Create the HTML5 comment box 'textarea' + var trackCommentBox = document.createElement('textarea'); + trackCommentBox.rows = '4'; + trackCommentBox.cols = '100'; + trackCommentBox.name = 'commentQuestion'+index; + trackCommentBox.className = 'trackComment'; + var br = document.createElement('br'); + // Add to the holder. + trackComment.appendChild(trackString); + trackComment.appendChild(br); + trackComment.appendChild(trackCommentBox); + feedbackHolder.appendChild(trackComment); + }); + // Now process any pre-test commands var preTest = $(testXMLSetups[id]).find('PreTest')[0]; @@ -863,6 +887,19 @@ audioElement.appendChild(metric); xmlDoc.appendChild(audioElement); } + var commentQuestion = document.getElementsByClassName('commentQuestion'); + for (var i=0; i<commentQuestion.length; i++) + { + var cqHolder = document.createElement('CommentQuestion'); + var comment = document.createElement('comment'); + var question = document.createElement('question'); + cqHolder.id = commentQuestion[i].id; + comment.textContent = commentQuestion[i].children[2].value; + question.textContent = commentQuestion[i].children[0].textContent; + cqHolder.appendChild(question); + cqHolder.appendChild(comment); + xmlDoc.appendChild(cqHolder); + } testResultsHolders[testId] = xmlDoc; }