Mercurial > hg > webaudioevaluationtool
changeset 153:789c3cd06290 Dev_main
Feature #1252: Test Wait Indicator now fully implemented with auto clearing on test ready.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Mon, 01 Jun 2015 09:46:51 +0100 |
parents | 300d4f58f2b4 |
children | 61f8e66d119d |
files | ape.js core.js |
diffstat | 2 files changed, 27 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/ape.js Mon Jun 01 09:26:59 2015 +0100 +++ b/ape.js Mon Jun 01 09:46:51 2015 +0100 @@ -267,7 +267,6 @@ testState.initialise(); testState.advanceState(); - testWaitIndicator(); } function loadTest(textXML) @@ -495,6 +494,9 @@ trackComment.appendChild(trackCommentBox); feedbackHolder.appendChild(trackComment); }); + + + testWaitIndicator(); }
--- a/core.js Mon Jun 01 09:26:59 2015 +0100 +++ b/core.js Mon Jun 01 09:46:51 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; @@ -382,6 +378,9 @@ createProjectSave(null); }; xmlhttp.send(file); + if (xmlhttp.status == 404) { + createProjectSave(null); + } } return submitDiv; } @@ -496,13 +495,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 +755,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;