changeset 158:76b81557b2ca

Merge from 156:402bb0f56dc4
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Mon, 01 Jun 2015 12:56:15 +0100
parents 97ebdb6b266a (current diff) 402bb0f56dc4 (diff)
children 826dfaa860d1
files
diffstat 6 files changed, 138 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/ape.css	Mon Jun 01 08:55:53 2015 +0100
+++ b/ape.css	Mon Jun 01 12:56:15 2015 +0100
@@ -72,44 +72,11 @@
 	background-color: rgb(100,200,100);
 }
 
-div.comment-div {
-	border:#444444;
-	border-style:solid;
-	border-width:1px;
-	width: 624px;
-	float: left;
-	margin: 5px;
+div.track-slider-playing {
+	background-color: #FF0000;
 }
 
-div.comment-div span {
-	margin-left: 15px;
+div.comment-box-playing {
+	background-color: #FFDDDD;
 }
 
-div.popupHolder {
-	width: 500px;
-	height: 250px;
-	background-color: #fff;
-	border-radius: 10px;
-	box-shadow: 0px 0px 50px #000;
-	z-index: 2;
-}
-
-button.popupButton {
-	/* Button for popup window
-	 */
-	width: 50px;
-	height: 25px;
-	position: absolute;
-	left: 440px;
-	top: 215px;
-	border-radius: 5px;
-	border: #444;
-	border-width: 1px;
-	border-style: solid;
-	background-color: #fff;
-}
-
-textarea.trackComment {
-	width: 618px;
-	margin-right:15px;
-}
--- a/ape.js	Mon Jun 01 08:55:53 2015 +0100
+++ b/ape.js	Mon Jun 01 12:56:15 2015 +0100
@@ -267,7 +267,6 @@
 	testState.initialise();
 	testState.advanceState();
 	
-	testWaitIndicator();
 }
 
 function loadTest(textXML)
@@ -408,6 +407,7 @@
 			// Create document objects to hold the comment boxes
 			var trackComment = document.createElement('div');
 			trackComment.className = 'comment-div';
+			trackComment.id = 'comment-div-'+index;
 			// Create a string next to each comment asking for a comment
 			var trackString = document.createElement('span');
 			trackString.innerHTML = 'Comment on track '+index;
@@ -430,6 +430,11 @@
 		var trackSliderObj = document.createElement('div');
 		trackSliderObj.className = 'track-slider';
 		trackSliderObj.id = 'track-slider-'+index;
+		
+		var trackSliderAOIndex = document.createAttribute('trackIndex');
+		trackSliderAOIndex.nodeValue = index;
+		trackSliderObj.setAttributeNode(trackSliderAOIndex);
+		
 		// Distribute it randomnly
 		var w = window.innerWidth - (offset+8)*2;
 		w = Math.random()*w;
@@ -440,7 +445,7 @@
 		trackSliderObj.ondragend = dragEnd;
 		trackSliderObj.ondragstart = function()
 		{
-			var id = Number(this.id.substr(13,2)); // Maximum theoretical tracks is 99!
+			var id = Number(event.srcElement.attributes['trackIndex'].value);
 			audioEngineContext.metric.sliderMoveStart(id);
 		};
 		
@@ -451,19 +456,16 @@
 			if (audioEngineContext.audioObjectsReady) {
 				// Cannot continue to issue play command until audioObjects reported as ready!
 				// Get the track ID from the object ID
-				var id = Number(this.id.substr(13,2)); // Maximum theoretical tracks is 99!
+				var id = Number(event.srcElement.attributes['trackIndex'].value);
 				//audioEngineContext.metric.sliderPlayed(id);
 				audioEngineContext.selectedTrack(id);
 	            // Currently playing track red, rest green
-	            document.getElementById('track-slider-'+index).style.backgroundColor = "#FF0000";
-	            for (var i = 0; i<$(currentTrackOrder).length; i++)
-	            {
-	                if (i!=index) // Make all other sliders green
-	                {
-	           	        document.getElementById('track-slider-'+i).style.backgroundColor = "rgb(100,200,100)";
-	                }
-	                              
-	            }
+	            
+	            //document.getElementById('track-slider-'+index).style.backgroundColor = "#FF0000";
+	            $('.track-slider').removeClass('track-slider-playing');
+	            $(event.srcElement).addClass('track-slider-playing');
+	            $('.comment-div').removeClass('comment-box-playing');
+	            $('#comment-div-'+id).addClass('comment-box-playing');
 			}
 		};
 		
@@ -495,6 +497,9 @@
 		trackComment.appendChild(trackCommentBox);
 		feedbackHolder.appendChild(trackComment);
 	});
+	
+	
+	testWaitIndicator();
 }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core.css	Mon Jun 01 12:56:15 2015 +0100
@@ -0,0 +1,63 @@
+/* structure.css
+ * Define the structure for classes and objects in HTML
+ */
+
+div.title {
+	width: 100%;
+	height: 50px;
+	margin-bottom: 10px;
+	font-size: 2em;
+}
+
+div.indicator-box {
+	position: absolute;
+	left: 150px;
+	top: 10px;
+	width: 300px;
+	height: 60px;
+	padding: 20px;
+	border-radius: 10px;
+	background-color: rgb(100,200,200);
+}
+
+div.comment-div {
+	border:#444444;
+	border-style:solid;
+	border-width:1px;
+	width: 624px;
+	float: left;
+	margin: 5px;
+}
+
+div.comment-div span {
+	margin-left: 15px;
+}
+
+div.popupHolder {
+	width: 500px;
+	height: 250px;
+	background-color: #fff;
+	border-radius: 10px;
+	box-shadow: 0px 0px 50px #000;
+	z-index: 2;
+}
+
+button.popupButton {
+	/* Button for popup window
+	 */
+	width: 50px;
+	height: 25px;
+	position: absolute;
+	left: 440px;
+	top: 215px;
+	border-radius: 5px;
+	border: #444;
+	border-width: 1px;
+	border-style: solid;
+	background-color: #fff;
+}
+
+textarea.trackComment {
+	width: 618px;
+	margin-right:15px;
+}
--- a/core.js	Mon Jun 01 08:55:53 2015 +0100
+++ b/core.js	Mon Jun 01 12:56:15 2015 +0100
@@ -11,14 +11,10 @@
 var popup; // Hold the interfacePopup object
 var testState;
 var currentState; // Keep track of the current state (pre/post test, which test, final test? first test?)
-//var testXMLSetups = []; // Hold the parsed test instances
-//var testResultsHolders =[]; // Hold the results from each test for publishing to XML
 var currentTrackOrder = []; // Hold the current XML tracks in their (randomised) order
-//var currentTestHolder; // Hold any intermediate results during test - metrics
 var audioEngineContext; // The custome AudioEngine object
 var projectReturn; // Hold the URL for the return
-//var preTestQuestions = document.createElement('PreTest'); // Store any pre-test question response
-//var postTestQuestions = document.createElement('PostTest'); // Store any post-test question response
+
 
 // Add a prototype to the bufferSourceNode to reference to the audioObject holding it
 AudioBufferSourceNode.prototype.owner = undefined;
@@ -112,9 +108,10 @@
 			this.popupContent.appendChild(span);
 			this.popupContent.appendChild(br);
 			this.popupContent.appendChild(textArea);
+			this.popupContent.childNodes[2].focus();
 		}
 		this.popupContent.appendChild(this.popupButton);
-	}
+	};
 	
 	this.initState = function(node) {
 		//Call this with your preTest and postTest nodes when needed to
@@ -133,7 +130,7 @@
 			this.showPopup();
 			this.postNode();
 		}
-	}
+	};
 	
 	this.buttonClicked = function() {
 		// Each time the popup button is clicked!
@@ -174,7 +171,7 @@
 			}
 			advanceState();
 		}
-	}
+	};
 }
 
 function advanceState()
@@ -382,6 +379,9 @@
 			createProjectSave(null);
 		};
 		xmlhttp.send(file);
+		if (xmlhttp.status == 404) {
+			createProjectSave(null);
+		}
 	}
 	return submitDiv;
 }
@@ -496,13 +496,6 @@
 				ready = false;
 			};
 		}
-		if (ready == false) {
-			var holder = document.getElementById('testWaitIndicator');
-			holder.style.visibility = "visible";
-			setInterval(function() {
-				document.getElementById('testWaitIndicator').style.visibility = "hidden";
-			}, 10000);
-		}
 		return ready;
 	};
 	
@@ -763,21 +756,25 @@
 }
 
 function testWaitIndicator() {
-	var hold = document.createElement("div");
-	hold.id = "testWaitIndicator";
-	hold.style.position = "absolute";
-	hold.style.left = "100px";
-	hold.style.top = "10px";
-	hold.style.width = "500px";
-	hold.style.height = "100px";
-	hold.style.padding = "20px";
-	hold.style.backgroundColor = "rgb(100,200,200)";
-	hold.style.visibility = "hidden";
-	var span = document.createElement("span");
-	span.textContent = "Please wait! Elements still loading";
-	hold.appendChild(span);
-	var body = document.getElementsByTagName('body')[0];
-	body.appendChild(hold);
+	if (audioEngineContext.checkAllReady() == false) {
+		var hold = document.createElement("div");
+		hold.id = "testWaitIndicator";
+		hold.className = "indicator-box";
+		var span = document.createElement("span");
+		span.textContent = "Please wait! Elements still loading";
+		hold.appendChild(span);
+		var body = document.getElementsByTagName('body')[0];
+		body.appendChild(hold);
+		testWaitTimerIntervalHolder = setInterval(function(){
+			var ready = audioEngineContext.checkAllReady();
+			if (ready) {
+				var elem = document.getElementById('testWaitIndicator');
+				var body = document.getElementsByTagName('body')[0];
+				body.removeChild(elem);
+				clearInterval(testWaitTimerIntervalHolder);
+			}
+		},500,false);
+	}
 }
 
-var hidetestwait = null;
+var testWaitTimerIntervalHolder = null;
--- a/index.html	Mon Jun 01 08:55:53 2015 +0100
+++ b/index.html	Mon Jun 01 12:56:15 2015 +0100
@@ -13,8 +13,7 @@
 		<meta name="author" content="" />
 		
 		<!-- Load up the default core JS and CSS files-->
-		<link rel='stylesheet' type='text/css' href='graphics.css'>
-		<link rel='stylesheet' type='text/css' href='structure.css'>
+		<link rel='stylesheet' type='text/css' href='core.css'>
 		<!-- Use jQuery hosted from Google CDN -->
 		<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>-->
 		<script src="jquery-2.1.4.js"></script>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test_create/test_create.html	Mon Jun 01 12:56:15 2015 +0100
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8">
+
+		<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
+		Remove this if you use the .htaccess -->
+		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+
+		<title>WAET Create Test</title>
+		<meta name="description" content="">
+		<meta name="author" content="">
+
+		<meta name="viewport" content="width=device-width; initial-scale=1.0">
+	</head>
+
+	<body>
+		<div>
+			<h1>Create Test Setup XML</h1>
+		</div>
+		<div id="topLevelBody">
+			<!-- Interface goes here -->
+		</div>
+	</body>
+</html>