nickjillings@1575: /** nickjillings@1575: * core.js nickjillings@1575: * nickjillings@1575: * Main script to run, calls all other core functions and manages loading/store to backend. nickjillings@1575: * Also contains all global variables. nickjillings@1575: */ nickjillings@1575: nickjillings@1575: /* create the web audio API context and store in audioContext*/ nickjillings@1575: var audioContext; // Hold the browser web audio API nickjillings@1575: var projectXML; // Hold the parsed setup XML nickjillings@1575: var popup; // Hold the interfacePopup object nickjillings@1575: var testState; nickjillings@1575: var currentTrackOrder = []; // Hold the current XML tracks in their (randomised) order nickjillings@1575: var audioEngineContext; // The custome AudioEngine object nickjillings@1575: var projectReturn; // Hold the URL for the return nickjillings@1575: nickjillings@1575: nickjillings@1575: // Add a prototype to the bufferSourceNode to reference to the audioObject holding it nickjillings@1575: AudioBufferSourceNode.prototype.owner = undefined; nickjillings@1575: nickjillings@1575: window.onload = function() { nickjillings@1575: // Function called once the browser has loaded all files. nickjillings@1575: // This should perform any initial commands such as structure / loading documents nickjillings@1575: nickjillings@1575: // Create a web audio API context nickjillings@1575: // Fixed for cross-browser support nickjillings@1575: var AudioContext = window.AudioContext || window.webkitAudioContext; nickjillings@1575: audioContext = new AudioContext; nickjillings@1575: nickjillings@1575: // Create test state nickjillings@1575: testState = new stateMachine(); nickjillings@1575: nickjillings@1575: // Create the audio engine object nickjillings@1575: audioEngineContext = new AudioEngine(); nickjillings@1575: nickjillings@1575: // Create the popup interface object nickjillings@1575: popup = new interfacePopup(); nickjillings@1575: }; nickjillings@1575: nickjillings@1575: function interfacePopup() { nickjillings@1575: // Creates an object to manage the popup nickjillings@1575: this.popup = null; nickjillings@1575: this.popupContent = null; nickjillings@1575: this.popupButton = null; nickjillings@1575: this.popupOptions = null; nickjillings@1575: this.currentIndex = null; nickjillings@1575: this.responses = null; nickjillings@1575: this.createPopup = function(){ nickjillings@1575: // Create popup window interface nickjillings@1575: var insertPoint = document.getElementById("topLevelBody"); nickjillings@1575: var blank = document.createElement('div'); nickjillings@1575: blank.className = 'testHalt'; nickjillings@1575: nickjillings@1575: this.popup = document.createElement('div'); nickjillings@1575: this.popup.id = 'popupHolder'; nickjillings@1575: this.popup.className = 'popupHolder'; nickjillings@1575: this.popup.style.position = 'absolute'; nickjillings@1575: this.popup.style.left = (window.innerWidth/2)-250 + 'px'; nickjillings@1575: this.popup.style.top = (window.innerHeight/2)-125 + 'px'; nickjillings@1575: nickjillings@1575: this.popupContent = document.createElement('div'); nickjillings@1575: this.popupContent.id = 'popupContent'; nickjillings@1575: this.popupContent.style.marginTop = '25px'; nickjillings@1575: this.popupContent.align = 'center'; nickjillings@1575: this.popup.appendChild(this.popupContent); nickjillings@1575: nickjillings@1575: this.popupButton = document.createElement('button'); nickjillings@1575: this.popupButton.className = 'popupButton'; nickjillings@1575: this.popupButton.innerHTML = 'Next'; nickjillings@1575: this.popupButton.onclick = function(){popup.buttonClicked();}; nickjillings@1575: insertPoint.appendChild(this.popup); nickjillings@1575: insertPoint.appendChild(blank); nickjillings@1575: }; nickjillings@1575: nickjillings@1575: this.showPopup = function(){ nickjillings@1575: if (this.popup == null || this.popup == undefined) { nickjillings@1575: this.createPopup(); nickjillings@1575: } nickjillings@1575: this.popup.style.zIndex = 3; nickjillings@1575: this.popup.style.visibility = 'visible'; nickjillings@1575: var blank = document.getElementsByClassName('testHalt')[0]; nickjillings@1575: blank.style.zIndex = 2; nickjillings@1575: blank.style.visibility = 'visible'; nickjillings@1575: }; nickjillings@1575: nickjillings@1575: this.hidePopup = function(){ nickjillings@1575: this.popup.style.zIndex = -1; nickjillings@1575: this.popup.style.visibility = 'hidden'; nickjillings@1575: var blank = document.getElementsByClassName('testHalt')[0]; nickjillings@1575: blank.style.zIndex = -2; nickjillings@1575: blank.style.visibility = 'hidden'; nickjillings@1575: }; nickjillings@1575: nickjillings@1575: this.postNode = function() { nickjillings@1575: // This will take the node from the popupOptions and display it nickjillings@1575: var node = this.popupOptions[this.currentIndex]; nickjillings@1575: this.popupContent.innerHTML = null; nickjillings@1575: if (node.nodeName == 'statement') { nickjillings@1575: var span = document.createElement('span'); nickjillings@1575: span.textContent = node.textContent; nickjillings@1575: this.popupContent.appendChild(span); nickjillings@1575: } else if (node.nodeName == 'question') { nickjillings@1575: var span = document.createElement('span'); nickjillings@1575: span.textContent = node.textContent; nickjillings@1575: var textArea = document.createElement('textarea'); nickjillings@1575: var br = document.createElement('br'); nickjillings@1575: this.popupContent.appendChild(span); nickjillings@1575: this.popupContent.appendChild(br); nickjillings@1575: this.popupContent.appendChild(textArea); nickjillings@1575: this.popupContent.childNodes[2].focus(); nickjillings@1575: } nickjillings@1575: this.popupContent.appendChild(this.popupButton); nickjillings@1575: }; nickjillings@1575: nickjillings@1575: this.initState = function(node) { nickjillings@1575: //Call this with your preTest and postTest nodes when needed to nickjillings@1575: // initialise the popup procedure. nickjillings@1575: this.popupOptions = $(node).children(); nickjillings@1575: if (this.popupOptions.length > 0) { nickjillings@1575: if (node.nodeName == 'preTest' || node.nodeName == 'PreTest') { nickjillings@1575: this.responses = document.createElement('PreTest'); nickjillings@1575: } else if (node.nodeName == 'postTest' || node.nodeName == 'PostTest') { nickjillings@1575: this.responses = document.createElement('PostTest'); nickjillings@1575: } else { nickjillings@1575: console.log ('WARNING - popup node neither pre or post!'); nickjillings@1575: this.responses = document.createElement('responses'); nickjillings@1575: } nickjillings@1575: this.currentIndex = 0; nickjillings@1575: this.showPopup(); nickjillings@1575: this.postNode(); nickjillings@1575: } nickjillings@1575: }; nickjillings@1575: nickjillings@1575: this.buttonClicked = function() { nickjillings@1575: // Each time the popup button is clicked! nickjillings@1575: var node = this.popupOptions[this.currentIndex]; nickjillings@1575: if (node.nodeName == 'question') { nickjillings@1575: // Must extract the question data nickjillings@1575: var mandatory = node.attributes['mandatory']; nickjillings@1575: if (mandatory == undefined) { nickjillings@1575: mandatory = false; nickjillings@1575: } else { nickjillings@1575: if (mandatory.value == 'true'){mandatory = true;} nickjillings@1575: else {mandatory = false;} nickjillings@1575: } nickjillings@1575: var textArea = $(popup.popupContent).find('textarea')[0]; nickjillings@1575: if (mandatory == true && textArea.value.length == 0) { nickjillings@1575: alert('This question is mandatory'); nickjillings@1575: return; nickjillings@1575: } else { nickjillings@1575: // Save the text content nickjillings@1575: var hold = document.createElement('comment'); nickjillings@1575: hold.id = node.attributes['id'].value; nickjillings@1575: hold.innerHTML = textArea.value; nickjillings@1575: console.log("Question: "+ node.textContent); nickjillings@1575: console.log("Question Response: "+ textArea.value); nickjillings@1575: this.responses.appendChild(hold); nickjillings@1575: } nickjillings@1575: } nickjillings@1575: this.currentIndex++; nickjillings@1575: if (this.currentIndex < this.popupOptions.length) { nickjillings@1575: this.postNode(); nickjillings@1575: } else { nickjillings@1575: // Reached the end of the popupOptions nickjillings@1575: this.hidePopup(); nickjillings@1575: if (this.responses.nodeName == testState.stateResults[testState.stateIndex].nodeName) { nickjillings@1575: testState.stateResults[testState.stateIndex] = this.responses; nickjillings@1575: } else { nickjillings@1575: testState.stateResults[testState.stateIndex].appendChild(this.responses); nickjillings@1575: } nickjillings@1575: advanceState(); nickjillings@1575: } nickjillings@1575: }; nickjillings@1575: } nickjillings@1575: nickjillings@1575: function advanceState() nickjillings@1575: { nickjillings@1575: // Just for complete clarity nickjillings@1575: testState.advanceState(); nickjillings@1575: } nickjillings@1575: nickjillings@1575: function stateMachine() nickjillings@1575: { nickjillings@1575: // Object prototype for tracking and managing the test state nickjillings@1575: this.stateMap = []; nickjillings@1575: this.stateIndex = null; nickjillings@1575: this.currentStateMap = []; nickjillings@1575: this.currentIndex = null; nickjillings@1575: this.currentTestId = 0; nickjillings@1575: this.stateResults = []; nickjillings@1575: this.timerCallBackHolders = null; nickjillings@1575: this.initialise = function(){ nickjillings@1575: if (this.stateMap.length > 0) { nickjillings@1575: if(this.stateIndex != null) { nickjillings@1575: console.log('NOTE - State already initialise'); nickjillings@1575: } nickjillings@1575: this.stateIndex = -1; nickjillings@1575: var that = this; nickjillings@1575: for (var id=0; id= this.stateMap.length) { nickjillings@1575: console.log('Test Completed'); nickjillings@1575: createProjectSave(projectReturn); nickjillings@1575: } else { nickjillings@1575: this.currentStateMap = this.stateMap[this.stateIndex]; nickjillings@1575: if (this.currentStateMap.nodeName == "audioHolder") { nickjillings@1575: console.log('Loading test page'); nickjillings@1575: loadTest(this.currentStateMap); nickjillings@1575: this.initialiseInnerState(this.currentStateMap); nickjillings@1575: } else if (this.currentStateMap.nodeName == "PreTest" || this.currentStateMap.nodeName == "PostTest") { nickjillings@1575: if (this.currentStateMap.childElementCount >= 1) { nickjillings@1575: popup.initState(this.currentStateMap); nickjillings@1575: } else { nickjillings@1575: this.advanceState(); nickjillings@1575: } nickjillings@1575: } else { nickjillings@1575: this.advanceState(); nickjillings@1575: } nickjillings@1575: } nickjillings@1575: } else { nickjillings@1575: this.advanceInnerState(); nickjillings@1575: } nickjillings@1575: }; nickjillings@1575: nickjillings@1575: this.testPageCompleted = function(store, testXML, testId) { nickjillings@1575: // Function called each time a test page has been completed nickjillings@1575: // Can be used to over-rule default behaviour nickjillings@1575: nickjillings@1575: pageXMLSave(store, testXML, testId); nickjillings@1576: }; nickjillings@1575: nickjillings@1575: this.initialiseInnerState = function(testXML) { nickjillings@1575: // Parses the received testXML for pre and post test options nickjillings@1575: this.currentStateMap = []; nickjillings@1575: var preTest = $(testXML).find('PreTest')[0]; nickjillings@1575: var postTest = $(testXML).find('PostTest')[0]; nickjillings@1575: if (preTest == undefined) {preTest = document.createElement("preTest");} nickjillings@1575: if (postTest == undefined){postTest= document.createElement("postTest");} nickjillings@1575: this.currentStateMap.push(preTest); nickjillings@1575: this.currentStateMap.push(testXML); nickjillings@1575: this.currentStateMap.push(postTest); nickjillings@1575: this.currentIndex = -1; nickjillings@1575: this.advanceInnerState(); nickjillings@1576: }; nickjillings@1575: nickjillings@1575: this.advanceInnerState = function() { nickjillings@1575: this.currentIndex++; nickjillings@1575: if (this.currentIndex >= this.currentStateMap.length) { nickjillings@1575: this.currentIndex = null; nickjillings@1575: this.currentStateMap = this.stateMap[this.stateIndex]; nickjillings@1575: this.advanceState(); nickjillings@1575: } else { nickjillings@1575: if (this.currentStateMap[this.currentIndex].nodeName == "audioHolder") { nickjillings@1575: console.log("Loading test page"+this.currentTestId); nickjillings@1575: } else if (this.currentStateMap[this.currentIndex].nodeName == "PreTest") { nickjillings@1575: popup.initState(this.currentStateMap[this.currentIndex]); nickjillings@1575: } else if (this.currentStateMap[this.currentIndex].nodeName == "PostTest") { nickjillings@1575: popup.initState(this.currentStateMap[this.currentIndex]); nickjillings@1575: } else { nickjillings@1575: this.advanceInnerState(); nickjillings@1575: } nickjillings@1575: } nickjillings@1576: }; nickjillings@1575: nickjillings@1575: this.previousState = function(){}; nickjillings@1575: } nickjillings@1575: nickjillings@1575: function testEnded(testId) nickjillings@1575: { nickjillings@1575: pageXMLSave(testId); nickjillings@1575: if (testXMLSetups.length-1 > testId) nickjillings@1575: { nickjillings@1575: // Yes we have another test to perform nickjillings@1575: testId = (Number(testId)+1); nickjillings@1575: currentState = 'testRun-'+testId; nickjillings@1575: loadTest(testId); nickjillings@1575: } else { nickjillings@1575: console.log('Testing Completed!'); nickjillings@1575: currentState = 'postTest'; nickjillings@1575: // Check for any post tests nickjillings@1575: var xmlSetup = projectXML.find('setup'); nickjillings@1575: var postTest = xmlSetup.find('PostTest')[0]; nickjillings@1575: popup.initState(postTest); nickjillings@1575: } nickjillings@1575: } nickjillings@1575: nickjillings@1575: function loadProjectSpec(url) { nickjillings@1575: // Load the project document from the given URL, decode the XML and instruct audioEngine to get audio data nickjillings@1575: // If url is null, request client to upload project XML document nickjillings@1575: var r = new XMLHttpRequest(); nickjillings@1575: r.open('GET',url,true); nickjillings@1575: r.onload = function() { nickjillings@1575: loadProjectSpecCallback(r.response); nickjillings@1575: }; nickjillings@1575: r.send(); nickjillings@1575: }; nickjillings@1575: nickjillings@1575: function loadProjectSpecCallback(response) { nickjillings@1575: // Function called after asynchronous download of XML project specification nickjillings@1575: var decode = $.parseXML(response); nickjillings@1575: projectXML = $(decode); nickjillings@1575: nickjillings@1575: // Now extract the setup tag nickjillings@1575: var xmlSetup = projectXML.find('setup'); nickjillings@1576: nickjillings@1576: nickjillings@1576: // Create pre and post test questions nickjillings@1576: nickjillings@1576: var preTest = xmlSetup.find('PreTest'); nickjillings@1576: var postTest = xmlSetup.find('PostTest'); nickjillings@1576: preTest = preTest[0]; nickjillings@1576: postTest = postTest[0]; nickjillings@1576: nickjillings@1576: if (preTest == undefined) {preTest = document.createElement("preTest");} nickjillings@1576: if (postTest == undefined){postTest= document.createElement("postTest");} nickjillings@1576: nickjillings@1576: testState.stateMap.push(preTest); nickjillings@1576: nickjillings@1576: // Extract the different test XML DOM trees nickjillings@1576: var audioHolders = projectXML.find('audioHolder'); nickjillings@1576: var testXMLSetups = []; nickjillings@1576: audioHolders.each(function(index,element) { nickjillings@1576: var repeatN = element.attributes['repeatCount'].value; nickjillings@1576: for (var r=0; r<=repeatN; r++) { nickjillings@1576: testXMLSetups.push(element); nickjillings@1576: } nickjillings@1576: }); nickjillings@1576: nickjillings@1576: // New check if we need to randomise the test order nickjillings@1576: var randomise = xmlSetup[0].attributes['randomiseOrder']; nickjillings@1576: if (randomise != undefined) { nickjillings@1576: if (randomise.value === 'true'){ nickjillings@1576: randomise = true; nickjillings@1576: } else { nickjillings@1576: randomise = false; nickjillings@1576: } nickjillings@1576: } else { nickjillings@1576: randomise = false; nickjillings@1576: } nickjillings@1576: nickjillings@1576: if (randomise) nickjillings@1576: { nickjillings@1576: testXMLSetups = randomiseOrder(testXMLSetups); nickjillings@1576: } nickjillings@1576: nickjillings@1576: $(testXMLSetups).each(function(index,elem){ nickjillings@1576: testState.stateMap.push(elem); nickjillings@1576: }); nickjillings@1576: nickjillings@1576: testState.stateMap.push(postTest); nickjillings@1576: nickjillings@1576: // Obtain the metrics enabled nickjillings@1576: var metricNode = xmlSetup.find('Metric'); nickjillings@1576: var metricNode = metricNode.find('metricEnable'); nickjillings@1576: metricNode.each(function(index,node){ nickjillings@1576: var enabled = node.textContent; nickjillings@1576: switch(enabled) nickjillings@1576: { nickjillings@1576: case 'testTimer': nickjillings@1576: sessionMetrics.prototype.enableTestTimer = true; nickjillings@1576: break; nickjillings@1576: case 'elementTimer': nickjillings@1576: sessionMetrics.prototype.enableElementTimer = true; nickjillings@1576: break; nickjillings@1576: case 'elementTracker': nickjillings@1576: sessionMetrics.prototype.enableElementTracker = true; nickjillings@1576: break; nickjillings@1576: case 'elementListenTracker': nickjillings@1576: sessionMetrics.prototype.enableElementListenTracker = true; nickjillings@1576: break; nickjillings@1576: case 'elementInitialPosition': nickjillings@1576: sessionMetrics.prototype.enableElementInitialPosition = true; nickjillings@1576: break; nickjillings@1576: case 'elementFlagListenedTo': nickjillings@1576: sessionMetrics.prototype.enableFlagListenedTo = true; nickjillings@1576: break; nickjillings@1576: case 'elementFlagMoved': nickjillings@1576: sessionMetrics.prototype.enableFlagMoved = true; nickjillings@1576: break; nickjillings@1576: case 'elementFlagComments': nickjillings@1576: sessionMetrics.prototype.enableFlagComments = true; nickjillings@1576: break; nickjillings@1576: } nickjillings@1576: }); nickjillings@1576: nickjillings@1576: nickjillings@1576: nickjillings@1575: // Detect the interface to use and load the relevant javascripts. nickjillings@1575: var interfaceType = xmlSetup[0].attributes['interface']; nickjillings@1575: var interfaceJS = document.createElement('script'); nickjillings@1575: interfaceJS.setAttribute("type","text/javascript"); nickjillings@1575: if (interfaceType.value == 'APE') { nickjillings@1575: interfaceJS.setAttribute("src","ape.js"); nickjillings@1575: nickjillings@1575: // APE comes with a css file nickjillings@1575: var css = document.createElement('link'); nickjillings@1575: css.rel = 'stylesheet'; nickjillings@1575: css.type = 'text/css'; nickjillings@1575: css.href = 'ape.css'; nickjillings@1575: nickjillings@1575: document.getElementsByTagName("head")[0].appendChild(css); nickjillings@1575: } nickjillings@1575: document.getElementsByTagName("head")[0].appendChild(interfaceJS); nickjillings@1575: nickjillings@1575: // Define window callbacks for interface nickjillings@1575: window.onresize = function(event){resizeWindow(event);}; nickjillings@1575: } nickjillings@1575: nickjillings@1575: function createProjectSave(destURL) { nickjillings@1575: // Save the data from interface into XML and send to destURL nickjillings@1575: // If destURL is null then download XML in client nickjillings@1575: // Now time to render file locally nickjillings@1575: var xmlDoc = interfaceXMLSave(); nickjillings@1575: var parent = document.createElement("div"); nickjillings@1575: parent.appendChild(xmlDoc); nickjillings@1575: var file = [parent.innerHTML]; nickjillings@1575: if (destURL == "null" || destURL == undefined) { nickjillings@1575: var bb = new Blob(file,{type : 'application/xml'}); nickjillings@1575: var dnlk = window.URL.createObjectURL(bb); nickjillings@1575: var a = document.createElement("a"); nickjillings@1575: a.hidden = ''; nickjillings@1575: a.href = dnlk; nickjillings@1575: a.download = "save.xml"; nickjillings@1575: a.textContent = "Save File"; nickjillings@1575: nickjillings@1575: var submitDiv = document.getElementById('download-point'); nickjillings@1575: submitDiv.appendChild(a); nickjillings@1575: popup.showPopup(); nickjillings@1575: popup.popupContent.innerHTML = null; nickjillings@1575: popup.popupContent.appendChild(submitDiv) nickjillings@1575: } else { nickjillings@1575: var xmlhttp = new XMLHttpRequest; nickjillings@1575: xmlhttp.open("POST",destURL,true); nickjillings@1575: xmlhttp.setRequestHeader('Content-Type', 'text/xml'); nickjillings@1575: xmlhttp.onerror = function(){ nickjillings@1575: console.log('Error saving file to server! Presenting download locally'); nickjillings@1575: createProjectSave(null); nickjillings@1575: }; nickjillings@1575: xmlhttp.onreadystatechange = function() { nickjillings@1575: console.log(xmlhttp.status); nickjillings@1575: if (xmlhttp.status != 200 && xmlhttp.readyState == 4) { nickjillings@1575: createProjectSave(null); nickjillings@1575: } nickjillings@1575: }; nickjillings@1575: xmlhttp.send(file); nickjillings@1575: } nickjillings@1575: return submitDiv; nickjillings@1575: } nickjillings@1575: nickjillings@1575: // Only other global function which must be defined in the interface class. Determines how to create the XML document. nickjillings@1575: function interfaceXMLSave(){ nickjillings@1575: // Create the XML string to be exported with results nickjillings@1575: var xmlDoc = document.createElement("BrowserEvaluationResult"); nickjillings@1575: xmlDoc.appendChild(returnDateNode()); nickjillings@1575: for (var i=0; i nickjillings@1575: // DD/MM/YY nickjillings@1575: // nickjillings@1575: // nickjillings@1575: var dateTime = new Date(); nickjillings@1575: var year = document.createAttribute('year'); nickjillings@1575: var month = document.createAttribute('month'); nickjillings@1575: var day = document.createAttribute('day'); nickjillings@1575: var hour = document.createAttribute('hour'); nickjillings@1575: var minute = document.createAttribute('minute'); nickjillings@1575: var secs = document.createAttribute('secs'); nickjillings@1575: nickjillings@1575: year.nodeValue = dateTime.getFullYear(); nickjillings@1575: month.nodeValue = dateTime.getMonth()+1; nickjillings@1575: day.nodeValue = dateTime.getDate(); nickjillings@1575: hour.nodeValue = dateTime.getHours(); nickjillings@1575: minute.nodeValue = dateTime.getMinutes(); nickjillings@1575: secs.nodeValue = dateTime.getSeconds(); nickjillings@1575: nickjillings@1575: var hold = document.createElement("datetime"); nickjillings@1575: var date = document.createElement("date"); nickjillings@1575: date.textContent = year.nodeValue+'/'+month.nodeValue+'/'+day.nodeValue; nickjillings@1575: var time = document.createElement("time"); nickjillings@1575: time.textContent = hour.nodeValue+':'+minute.nodeValue+':'+secs.nodeValue; nickjillings@1575: nickjillings@1575: date.setAttributeNode(year); nickjillings@1575: date.setAttributeNode(month); nickjillings@1575: date.setAttributeNode(day); nickjillings@1575: time.setAttributeNode(hour); nickjillings@1575: time.setAttributeNode(minute); nickjillings@1575: time.setAttributeNode(secs); nickjillings@1575: nickjillings@1575: hold.appendChild(date); nickjillings@1575: hold.appendChild(time); nickjillings@1575: return hold nickjillings@1575: nickjillings@1575: } nickjillings@1575: nickjillings@1575: function testWaitIndicator() { nickjillings@1575: if (audioEngineContext.checkAllReady() == false) { nickjillings@1575: var hold = document.createElement("div"); nickjillings@1575: hold.id = "testWaitIndicator"; nickjillings@1575: hold.className = "indicator-box"; nickjillings@1575: var span = document.createElement("span"); nickjillings@1575: span.textContent = "Please wait! Elements still loading"; nickjillings@1575: hold.appendChild(span); nickjillings@1575: var body = document.getElementsByTagName('body')[0]; nickjillings@1575: body.appendChild(hold); nickjillings@1575: testWaitTimerIntervalHolder = setInterval(function(){ nickjillings@1575: var ready = audioEngineContext.checkAllReady(); nickjillings@1575: if (ready) { nickjillings@1575: var elem = document.getElementById('testWaitIndicator'); nickjillings@1575: var body = document.getElementsByTagName('body')[0]; nickjillings@1575: body.removeChild(elem); nickjillings@1575: clearInterval(testWaitTimerIntervalHolder); nickjillings@1575: } nickjillings@1575: },500,false); nickjillings@1575: } nickjillings@1575: } nickjillings@1575: nickjillings@1575: var testWaitTimerIntervalHolder = null;