changeset 2330:fc8d79f8d9c5

Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool
author www-data <www-data@sucuk.dcs.qmul.ac.uk>
date Wed, 04 May 2016 12:21:11 +0100
parents 510fe0e815fd (current diff) 59083312c5ff (diff)
children 98033840992d
files
diffstat 1 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Tue May 03 15:21:03 2016 +0100
+++ b/js/core.js	Wed May 04 12:21:11 2016 +0100
@@ -16,7 +16,7 @@
 var testState;
 var currentTrackOrder = []; // Hold the current XML tracks in their (randomised) order
 var audioEngineContext; // The custome AudioEngine object
-var projectReturn; // Hold the URL for the return
+var gReturnURL;
 
 
 // Add a prototype to the bufferSourceNode to reference to the audioObject holding it
@@ -150,9 +150,13 @@
         {
             // Split each request into
             searchQueries[i] = searchQueries[i].split('=');
-            if (searchQueries[i][0] == "url")
-            {
-                url = decodeURI(searchQueries[i][1]);
+            switch(searchQueries[i][0]) {
+                case "url":
+                    url = decodeURI(searchQueries[i][1]);
+                    break;
+                case "returnURL":
+                    gReturnURL = decodeURI(searchQueries[i][1]);
+                    break;
             }
         }
         loadProjectSpec(url);
@@ -399,6 +403,11 @@
             break;
 	}
 	document.getElementsByTagName("head")[0].appendChild(interfaceJS);
+    
+    if (gReturnURL != undefined) {
+        console.log("returnURL Overide from "+specification.returnURL+" to "+gReturnURL);
+        specification.returnURL = gReturnURL;
+    }
 	
 	// Create the audio engine object
 	audioEngineContext = new AudioEngine(specification);
@@ -454,7 +463,9 @@
                     var file = response.getElementsByTagName("file")[0];
                     console.log("Save: OK, written "+file.getAttribute("bytes")+"B");
                     if (typeof specification.returnURL == "string") {
-                        window.location = returnURL;
+                        if (specification.returnURL.length > 0) {
+                            window.location = specification.returnURL;
+                        }
                     } else {
                         popup.popupContent.textContent = specification.exitText;
                     }