Mercurial > hg > webaudioevaluationtool
comparison core.js @ 607:328f24798462 multiple-tests-concatenation
working, hacked together.
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 11 Mar 2016 16:49:47 +0000 |
parents | fc6720146f80 |
children | 0256f3748b27 |
comparison
equal
deleted
inserted
replaced
583:6833d8c2b52e | 607:328f24798462 |
---|---|
13 var interfaceContext; | 13 var interfaceContext; |
14 var storage; | 14 var storage; |
15 var popup; // Hold the interfacePopup object | 15 var popup; // Hold the interfacePopup object |
16 var testState; | 16 var testState; |
17 var currentTrackOrder = []; // Hold the current XML tracks in their (randomised) order | 17 var currentTrackOrder = []; // Hold the current XML tracks in their (randomised) order |
18 var audioEngineContext; // The custome AudioEngine object | 18 var audioEngineContext; // The custom AudioEngine object |
19 var projectReturn; // Hold the URL for the return | 19 var projectReturn; |
20 | 20 var returnUrl; // Holds the url to be redirected to at the end of the test |
21 | 21 |
22 // Add a prototype to the bufferSourceNode to reference to the audioObject holding it | 22 // Add a prototype to the bufferSourceNode to reference to the audioObject holding it |
23 AudioBufferSourceNode.prototype.owner = undefined; | 23 AudioBufferSourceNode.prototype.owner = undefined; |
24 // Add a prototype to the bufferSourceNode to hold when the object was given a play command | 24 // Add a prototype to the bufferSourceNode to hold when the object was given a play command |
25 AudioBufferSourceNode.prototype.playbackStartTime = undefined; | 25 AudioBufferSourceNode.prototype.playbackStartTime = undefined; |
336 a.href = dnlk; | 336 a.href = dnlk; |
337 a.download = "save.xml"; | 337 a.download = "save.xml"; |
338 a.textContent = "Save File"; | 338 a.textContent = "Save File"; |
339 | 339 |
340 popup.showPopup(); | 340 popup.showPopup(); |
341 popup.popupContent.innerHTML = "</span>Please save the file below to give to your test supervisor</span><br>"; | 341 popup.popupContent.innerHTML = "<span>Please save the file below to give to your test supervisor</span><br>"; |
342 popup.popupContent.appendChild(a); | 342 popup.popupContent.appendChild(a); |
343 } else { | 343 } else { |
344 var xmlhttp = new XMLHttpRequest; | 344 var xmlhttp = new XMLHttpRequest; |
345 xmlhttp.open("POST",destURL,true); | 345 destUrlFull = destURL; |
346 var saveFilenamePrefix; | |
347 // parse the querystring of destUrl, get the "id" (if any) and append it to destUrl | |
348 var qs = returnUrl.split("?"); | |
349 if(qs.length == 2){ | |
350 qs = qs[1]; | |
351 qs = qs.split("&"); | |
352 for(var n = 0; n < qs.length; n++){ | |
353 var pair = qs[n].split("="); | |
354 if (pair[0] == "id") { | |
355 saveFilenamePrefix = pair[1]; | |
356 } | |
357 } | |
358 } | |
359 if(typeof(saveFilenamePrefix) !== "undefined"){ | |
360 destUrlFull+="?saveFilenamePrefix="+saveFilenamePrefix; | |
361 } | |
362 xmlhttp.open("POST",destUrlFull,true); | |
346 xmlhttp.setRequestHeader('Content-Type', 'text/xml'); | 363 xmlhttp.setRequestHeader('Content-Type', 'text/xml'); |
347 xmlhttp.onerror = function(){ | 364 xmlhttp.onerror = function(){ |
348 console.log('Error saving file to server! Presenting download locally'); | 365 console.log('Error saving file to server! Presenting download locally'); |
349 createProjectSave(null); | 366 createProjectSave(null); |
350 }; | 367 }; |
366 console.log('Save OK: Filename '+file.textContent+','+file.getAttribute('bytes')+'B'); | 383 console.log('Save OK: Filename '+file.textContent+','+file.getAttribute('bytes')+'B'); |
367 popup.showPopup(); | 384 popup.showPopup(); |
368 popup.popupContent.innerHTML = null; | 385 popup.popupContent.innerHTML = null; |
369 popup.popupContent.textContent = "Thank you!"; | 386 popup.popupContent.textContent = "Thank you!"; |
370 window.onbeforeunload=null; | 387 window.onbeforeunload=null; |
388 if(typeof(returnUrl) !== "undefined"){ | |
389 window.location = returnUrl; | |
390 } | |
371 } else { | 391 } else { |
372 var message = response.getElementsByTagName('message')[0]; | 392 var message = response.getElementsByTagName('message')[0]; |
373 errorSessionDump(message.textContent); | 393 errorSessionDump(message.textContent); |
374 } | 394 } |
375 } | 395 } |