Mercurial > hg > webaudioevaluationtool
comparison core.js @ 609:34d8bca65edc multiple-tests-concatenation
Allow for returnUrl===undefined
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 12 Mar 2016 16:23:37 +0000 |
parents | 0256f3748b27 |
children | fef9f13bec0a |
comparison
equal
deleted
inserted
replaced
608:0256f3748b27 | 609:34d8bca65edc |
---|---|
373 popup.popupContent.appendChild(a); | 373 popup.popupContent.appendChild(a); |
374 } else { | 374 } else { |
375 destUrlFull = destURL+"?key="+storage.SessionKey.key; | 375 destUrlFull = destURL+"?key="+storage.SessionKey.key; |
376 var saveFilenamePrefix; | 376 var saveFilenamePrefix; |
377 // parse the querystring of destUrl, get the "id" (if any) and append it to destUrl | 377 // parse the querystring of destUrl, get the "id" (if any) and append it to destUrl |
378 var qs = returnUrl.split("?"); | 378 if(typeof(returnUrl) !== "undefined"){ |
379 if(qs.length == 2){ | 379 var qs = returnUrl.split("?"); |
380 qs = qs[1]; | 380 if(qs.length == 2){ |
381 qs = qs.split("&"); | 381 qs = qs[1]; |
382 for(var n = 0; n < qs.length; n++){ | 382 qs = qs.split("&"); |
383 var pair = qs[n].split("="); | 383 for(var n = 0; n < qs.length; n++){ |
384 if (pair[0] == "id") { | 384 var pair = qs[n].split("="); |
385 saveFilenamePrefix = pair[1]; | 385 if (pair[0] == "id") { |
386 } | 386 saveFilenamePrefix = pair[1]; |
387 } | |
388 } | |
387 } | 389 } |
388 } | 390 } |
389 if(typeof(saveFilenamePrefix) !== "undefined"){ | 391 if(typeof(saveFilenamePrefix) !== "undefined"){ |
390 destUrlFull+="&saveFilenamePrefix="+saveFilenamePrefix; | 392 destUrlFull+="&saveFilenamePrefix="+saveFilenamePrefix; |
391 } | 393 } |
406 var xmlDoc = parser.parseFromString(xmlhttp.responseText, "application/xml"); | 408 var xmlDoc = parser.parseFromString(xmlhttp.responseText, "application/xml"); |
407 var response = xmlDoc.getElementsByTagName('response')[0]; | 409 var response = xmlDoc.getElementsByTagName('response')[0]; |
408 window.onbeforeunload=null; | 410 window.onbeforeunload=null; |
409 if (response.getAttribute("state") == "OK") { | 411 if (response.getAttribute("state") == "OK") { |
410 var file = response.getElementsByTagName("file")[0]; | 412 var file = response.getElementsByTagName("file")[0]; |
411 if(typeof(returnUrl) !== "undefined"){ | 413 if(typeof(returnUrl) !== "undefined"){ |
412 window.location = returnUrl; | 414 window.location = returnUrl; |
413 } | 415 } |
414 console.log("Save: OK, written "+file.getAttribute("bytes")+"B"); | 416 console.log("Save: OK, written "+file.getAttribute("bytes")+"B"); |
415 popup.popupContent.textContent = "Thank you. Your session has been saved."; | 417 popup.popupContent.textContent = "Thank you. Your session has been saved."; |
416 } else { | 418 } else { |