Mercurial > hg > webaudioevaluationtool
comparison core.js @ 1583:5e20f0db13b0
XML-DOM created by their own objects
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Thu, 04 Jun 2015 17:23:32 +0100 |
parents | d4b626a4bc76 |
children | de1cc98f2889 |
comparison
equal
deleted
inserted
replaced
1582:d4b626a4bc76 | 1583:5e20f0db13b0 |
---|---|
566 this.state = 0; // 0 - no data, 1 - ready | 566 this.state = 0; // 0 - no data, 1 - ready |
567 this.url = null; // Hold the URL given for the output back to the results. | 567 this.url = null; // Hold the URL given for the output back to the results. |
568 this.metric = new metricTracker(this); | 568 this.metric = new metricTracker(this); |
569 | 569 |
570 // Bindings for GUI | 570 // Bindings for GUI |
571 this.sliderDOM = null; | 571 this.interfaceDOM = null; |
572 this.commentDOM = null; | 572 this.commentDOM = null; |
573 | 573 |
574 // Create a buffer and external gain control to allow internal patching of effects and volume leveling. | 574 // Create a buffer and external gain control to allow internal patching of effects and volume leveling. |
575 this.bufferNode = undefined; | 575 this.bufferNode = undefined; |
576 this.outputGain = audioContext.createGain(); | 576 this.outputGain = audioContext.createGain(); |
664 console.log('FATAL - Error loading buffer on '+audioObj.id); | 664 console.log('FATAL - Error loading buffer on '+audioObj.id); |
665 } | 665 } |
666 }); | 666 }); |
667 }; | 667 }; |
668 request.send(); | 668 request.send(); |
669 }; | |
670 | |
671 this.exportXMLDOM = function() { | |
672 var root = document.createElement('audioElement'); | |
673 root.id = this.specification.id; | |
674 root.setAttribute('url',this.url); | |
675 root.appendChild(this.interfaceDOM.exportXMLDOM()); | |
676 root.appendChild(this.commentDOM.exportXMLDOM()); | |
677 root.appendChild(this.metric.exportXMLDOM()); | |
678 return root; | |
669 }; | 679 }; |
670 } | 680 } |
671 | 681 |
672 function timer() | 682 function timer() |
673 { | 683 { |
1103 this.interfaceObject = function(){}; | 1113 this.interfaceObject = function(){}; |
1104 | 1114 |
1105 this.commentBoxes = []; | 1115 this.commentBoxes = []; |
1106 this.commentBox = function(audioObject) { | 1116 this.commentBox = function(audioObject) { |
1107 var element = audioObject.specification; | 1117 var element = audioObject.specification; |
1118 this.audioObject = audioObject; | |
1108 this.id = audioObject.id; | 1119 this.id = audioObject.id; |
1109 var audioHolderObject = audioObject.specification.parent; | 1120 var audioHolderObject = audioObject.specification.parent; |
1110 // Create document objects to hold the comment boxes | 1121 // Create document objects to hold the comment boxes |
1111 this.trackComment = document.createElement('div'); | 1122 this.trackComment = document.createElement('div'); |
1112 this.trackComment.className = 'comment-div'; | 1123 this.trackComment.className = 'comment-div'; |
1113 this.trackComment.id = 'comment-div-'+audioObject.id; | 1124 this.trackComment.id = 'comment-div-'+audioObject.id; |
1114 // Create a string next to each comment asking for a comment | 1125 // Create a string next to each comment asking for a comment |
1115 var trackString = document.createElement('span'); | 1126 this.trackString = document.createElement('span'); |
1116 trackString.innerHTML = audioHolderObject.commentBoxPrefix+' '+audioObject.id; | 1127 this.trackString.innerHTML = audioHolderObject.commentBoxPrefix+' '+audioObject.id; |
1117 // Create the HTML5 comment box 'textarea' | 1128 // Create the HTML5 comment box 'textarea' |
1118 var trackCommentBox = document.createElement('textarea'); | 1129 this.trackCommentBox = document.createElement('textarea'); |
1119 trackCommentBox.rows = '4'; | 1130 this.trackCommentBox.rows = '4'; |
1120 trackCommentBox.cols = '100'; | 1131 this.trackCommentBox.cols = '100'; |
1121 trackCommentBox.name = 'trackComment'+audioObject.id; | 1132 this.trackCommentBox.name = 'trackComment'+audioObject.id; |
1122 trackCommentBox.className = 'trackComment'; | 1133 this.trackCommentBox.className = 'trackComment'; |
1123 var br = document.createElement('br'); | 1134 var br = document.createElement('br'); |
1124 // Add to the holder. | 1135 // Add to the holder. |
1125 this.trackComment.appendChild(trackString); | 1136 this.trackComment.appendChild(this.trackString); |
1126 this.trackComment.appendChild(br); | 1137 this.trackComment.appendChild(br); |
1127 this.trackComment.appendChild(trackCommentBox); | 1138 this.trackComment.appendChild(this.trackCommentBox); |
1139 | |
1140 this.exportXMLDOM = function() { | |
1141 var root = document.createElement('comment'); | |
1142 if (this.audioObject.specification.parent.elementComments) { | |
1143 var question = document.createElement('question'); | |
1144 question.textContent = this.trackString.textContent; | |
1145 var response = document.createElement('response'); | |
1146 response.textContent = this.trackCommentBox.value; | |
1147 root.appendChild(question); | |
1148 root.appendChild(response); | |
1149 } | |
1150 return root; | |
1151 }; | |
1128 }; | 1152 }; |
1129 | 1153 |
1130 this.createCommentBox = function(audioObject) { | 1154 this.createCommentBox = function(audioObject) { |
1131 var node = new this.commentBox(audioObject); | 1155 var node = new this.commentBox(audioObject); |
1132 this.commentBoxes.push(node); | 1156 this.commentBoxes.push(node); |