# HG changeset patch # User Nicholas Jillings # Date 1464347802 -3600 # Node ID 3013cf94571676a4e8bf36258b227dfbbd04cf4f # Parent b7ed9d43ea873124d9b4e70df6474ba06548a038# Parent dd8894bca6914d9feed13063e03ea9591f3031b5 Merge branch 'Dev_main' diff -r b7ed9d43ea87 -r 3013cf945716 js/core.js --- a/js/core.js Fri May 27 12:15:40 2016 +0100 +++ b/js/core.js Fri May 27 12:16:42 2016 +0100 @@ -1677,7 +1677,7 @@ } else { this.outputGain.gain.setValueAtTime(0.0,startTime); } - this.bufferNode.start(startTime); + this.bufferNode.start(startTime,this.specification.startTime || 0, this.specification.stopTime-this.specification.startTime || this.buffer.buffer.duration); this.bufferNode.playbackStartTime = audioEngineContext.timer.getTestTime(); } }; @@ -2488,7 +2488,7 @@ this.outsideReferenceHolder = document.createElement('button'); this.outsideReferenceHolder.className = 'outside-reference'; this.outsideReferenceHolder.setAttribute('track-id',index); - this.outsideReferenceHolder.textContent = "Play Reference"; + this.outsideReferenceHolder.textContent = this.parent.specification.label || "Reference"; this.outsideReferenceHolder.disabled = true; this.outsideReferenceHolder.onclick = function(event) @@ -2511,7 +2511,7 @@ progress = progress.split('.')[0]; this.outsideReferenceHolder.textContent = progress+'%'; } else { - this.outsideReferenceHolder.textContent = "Play Reference"; + this.outsideReferenceHolder.textContent = this.parent.specification.label || "Reference"; } }; this.startPlayback = function() @@ -2536,7 +2536,7 @@ }; this.getPresentedId = function() { - return 'Reference'; + return this.parent.specification.label || "Reference"; }; this.canMove = function() { diff -r b7ed9d43ea87 -r 3013cf945716 js/specification.js --- a/js/specification.js Fri May 27 12:15:40 2016 +0100 +++ b/js/specification.js Fri May 27 12:16:42 2016 +0100 @@ -625,6 +625,9 @@ this.marker = null; this.enforce = false; this.gain = 0.0; + this.label = null; + this.startTime = null; + this.stopTime = null; this.schema = specification.schema.getAllElementsByName('audioelement')[0];; this.parent = null; this.decode = function(parent,xml) diff -r b7ed9d43ea87 -r 3013cf945716 test_create/attributes.json --- a/test_create/attributes.json Fri May 27 12:15:40 2016 +0100 +++ b/test_create/attributes.json Fri May 27 12:16:42 2016 +0100 @@ -13,7 +13,6 @@ "repeatCount": "Repeat Count", "loop": "Loop playback", "synchronous": "Synchronous playback", - "showElementComments": "Show Comment Boxes", "type": "Type", "min": "Minimum", "max": "Maximum", diff -r b7ed9d43ea87 -r 3013cf945716 test_create/test_core.js --- a/test_create/test_core.js Fri May 27 12:15:40 2016 +0100 +++ b/test_create/test_core.js Fri May 27 12:16:42 2016 +0100 @@ -1332,7 +1332,7 @@ span.textContent = "NOTE FOR SAFARI! You cannot right click on the below link and save it as a file, Safari does not like that at all. Instead click on it to open the XML, the Press Cmd+S to open the save dialogue. Make sure you have 'save as Page Source' selected on the bottom of the window. Currently Safari has no plans to support the HTML 'download' attribute which causes this problem"; obj.content.appendChild(span); var link = document.createElement("div"); - link.appendChild(doc.firstElementChild); + link.appendChild(doc.firstChild); var file = [link.innerHTML]; var bb = new Blob(file,{type : 'application/xml'}); var dnlk = window.URL.createObjectURL(bb); @@ -1946,6 +1946,31 @@ this.deleteNode.root.textContent = "Delete Entry"; this.deleteNode.root.addEventListener("click",this.deleteNode,false); this.buttonDOM.appendChild(this.deleteNode.root); + + this.moveToPosition = function(new_index){ + new_index = Math.min(new_index,this.parent.children.length); + var curr_index = this.parent.children.findIndex(function(elem){ + if (elem == this) {return true;} else {return false;} + },this); + // Split at the current location to remove the node and shift all the children up + var tail = this.parent.children.splice(curr_index+1); + this.parent.children.pop(); + this.parent.children = this.parent.children.concat(tail); + + //Split at the new location and insert the node + tail = this.parent.children.splice(new_index); + this.parent.children.push(this); + this.parent.children = this.parent.children.concat(tail); + + // Re-build the specification + this.parent.specification.options = []; + this.parent.childrenDOM.innerHTML = ""; + for (var obj of this.parent.children) { + this.parent.specification.options.push(obj.specification); + this.parent.childrenDOM.appendChild(obj.rootDOM); + } + + } } this.addNode = { root: document.createElement("button"), diff -r b7ed9d43ea87 -r 3013cf945716 xml/test-schema.xsd --- a/xml/test-schema.xsd Fri May 27 12:15:40 2016 +0100 +++ b/xml/test-schema.xsd Fri May 27 12:16:42 2016 +0100 @@ -81,7 +81,6 @@ - @@ -161,6 +160,7 @@ + @@ -184,6 +184,20 @@ + + + + + + + + + + + + + +