changeset 1055:6bd41ef8b1e0

Slider now enabled optionally based on tag <option name='playhead'/> in interfaces
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Wed, 01 Jul 2015 13:49:01 +0100
parents 5bcf1745e044
children ae2f1c7f7584
files ape.js core.js example_eval/project.xml
diffstat 3 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ape.js	Wed Jul 01 11:55:08 2015 +0100
+++ b/ape.js	Wed Jul 01 13:49:01 2015 +0100
@@ -297,13 +297,27 @@
 	feedbackHolder.innerHTML = null;
 	canvas.innerHTML = null;
 	
-	var playbackHolder = document.createElement('div');
-	playbackHolder.style.width = "100%";
-	playbackHolder.align = 'center';
-	playbackHolder.appendChild(interfaceContext.playhead.object);
-	feedbackHolder.appendChild(playbackHolder);
+	var interfaceObj = audioHolderObject.interfaces;
+	for (var k=0; k<interfaceObj.length; k++) {
+		for (var i=0; i<interfaceObj[k].options.length; i++)
+		{
+			if (interfaceObj[k].options[i].type == 'option' && interfaceObj[k].options[i].name == 'playhead')
+			{
+				var playbackHolder = document.getElementById('playback-holder');
+				if (playbackHolder == null)
+				{
+					playbackHolder = document.createElement('div');
+					playbackHolder.style.width = "100%";
+					playbackHolder.align = 'center';
+					playbackHolder.appendChild(interfaceContext.playhead.object);
+					feedbackHolder.appendChild(playbackHolder);
+				}
+				break;
+			}
+		}
+	}
 	// Setup question title
-	var interfaceObj = audioHolderObject.interfaces;
+	
 	var commentBoxPrefix = "Comment on track";
 	if (interfaceObj.length != 0) {
 		interfaceObj = interfaceObj[0];
--- a/core.js	Wed Jul 01 11:55:08 2015 +0100
+++ b/core.js	Wed Jul 01 13:49:01 2015 +0100
@@ -1288,7 +1288,11 @@
 		this.commonInterface = new function() {
 			this.OptionNode = function(child) {
 				this.type = child.nodeName;
-				if (this.type == 'check') {
+				if (this.type == 'option')
+				{
+					this.name = child.getAttribute('name');
+				}
+				else if (this.type == 'check') {
 					this.check = child.getAttribute('name');
 					if (this.check == 'scalerange') {
 						this.min = child.getAttribute('min');
--- a/example_eval/project.xml	Wed Jul 01 11:55:08 2015 +0100
+++ b/example_eval/project.xml	Wed Jul 01 13:49:01 2015 +0100
@@ -40,6 +40,7 @@
 			<check name="fragmentMoved"/>
 			<check name="fragmentComments"/>-->
 			<check name="scalerange" min="25" max="75"/>
+			<option name='playhead'/>
 		</interface>
 	</setup>
 	<audioHolder id='test-0' hostURL="example_eval/" sampleRate="44100" randomiseOrder='true' repeatCount='0' loop='true' elementComments='true'>