Mercurial > hg > webaudioevaluationtool
changeset 135:d769f1623203
Hacky test wait indicator!!
author | Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk> |
---|---|
date | Thu, 28 May 2015 18:58:45 +0100 |
parents | 2e8500c4df02 |
children | c849dcbe71aa |
files | ape.js core.js |
diffstat | 2 files changed, 49 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/ape.js Wed May 27 19:00:20 2015 +0100 +++ b/ape.js Thu May 28 18:58:45 2015 +0100 @@ -22,6 +22,7 @@ // The injection point into the HTML page var insertPoint = document.getElementById("topLevelBody"); var testContent = document.createElement('div'); + testContent.id = 'testContent'; @@ -264,6 +265,8 @@ // Load the full interface testState.initialise(); testState.advanceState(); + + testWaitIndicator(); } function loadTest(textXML) @@ -443,20 +446,23 @@ trackSliderObj.onclick = function() { // Start the test on first click, that way timings are more accurate. audioEngineContext.play(); - // Get the track ID from the object ID - var id = Number(this.id.substr(13,2)); // Maximum theoretical tracks is 99! - //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)"; - } - - } + 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! + //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)"; + } + + } + } }; canvas.appendChild(trackSliderObj);
--- a/core.js Wed May 27 19:00:20 2015 +0100 +++ b/core.js Thu May 28 18:58:45 2015 +0100 @@ -192,6 +192,7 @@ this.currentIndex = null; this.currentTestId = 0; this.stateResults = []; + this.timerCallBackHolders = null; this.initialise = function(){ if (this.stateMap.length > 0) { if(this.stateIndex != null) { @@ -492,6 +493,13 @@ 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; }; @@ -749,4 +757,24 @@ hold.appendChild(time); return hold -} \ No newline at end of file +} + +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); +} + +var hidetestwait = null;