Mercurial > hg > webaudioevaluationtool
changeset 432:cb2132a83247 Dev_main
Merge. Reload will only generate alert if test is loaded.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Fri, 18 Dec 2015 18:31:26 +0000 |
parents | 4e5a5a10525f (current diff) 1295512197f8 (diff) |
children | f57ca6e75aec |
files | index.html |
diffstat | 2 files changed, 30 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/core.js Fri Dec 18 18:29:57 2015 +0000 +++ b/core.js Fri Dec 18 18:31:26 2015 +0000 @@ -66,6 +66,18 @@ var parse = new DOMParser(); projectXML = parse.parseFromString(response,'text/xml'); + var errorNode = projectXML.getElementsByTagName('parsererror'); + if (errorNode.length >= 1) + { + var msg = document.createElement("h3"); + msg.textContent = "FATAL ERROR"; + var span = document.createElement("span"); + span.textContent = "The XML parser returned the following errors when decoding your XML file"; + document.getElementsByTagName('body')[0].appendChild(msg); + document.getElementsByTagName('body')[0].appendChild(span); + document.getElementsByTagName('body')[0].appendChild(errorNode[0]); + return; + } // Build the specification specification.decode(projectXML); @@ -185,11 +197,21 @@ function errorSessionDump(msg){ // Create the partial interface XML save // Include error node with message on why the dump occured + popup.showPopup(); + popup.popupContent.innerHTML = null; + var err = document.createElement('error'); + var parent = document.createElement("div"); + if (typeof msg === "object") + { + err.appendChild(msg); + popup.popupContent.appendChild(msg); + + } else { + err.textContent = msg; + popup.popupContent.innerHTML = "ERROR : "+msg; + } var xmlDoc = interfaceXMLSave(); - var err = document.createElement('error'); - err.textContent = msg; xmlDoc.appendChild(err); - var parent = document.createElement("div"); parent.appendChild(xmlDoc); var file = [parent.innerHTML]; var bb = new Blob(file,{type : 'application/xml'}); @@ -200,8 +222,8 @@ a.download = "save.xml"; a.textContent = "Save File"; - popup.showPopup(); - popup.popupContent.innerHTML = "ERROR : "+msg; + + popup.popupContent.appendChild(a); }
--- a/index.html Fri Dec 18 18:29:57 2015 +0000 +++ b/index.html Fri Dec 18 18:31:26 2015 +0000 @@ -20,10 +20,6 @@ <script src='core.js'></script> <script src='loudness.js'></script> <script type="text/javascript"> - window.onbeforeunload = function() { - return "Please only leave this page once you have completed the tests. Are you sure you have completed all testing?"; - }; - // SEARCH QUERY: By using the GET Request option ?url=loca/path/to/project.xml in the URL bar, you can load a project quickly if (window.location.search.length != 0) { @@ -40,6 +36,9 @@ } } loadProjectSpec(url); + window.onbeforeunload = function() { + return "Please only leave this page once you have completed the tests. Are you sure you have completed all testing?"; + }; } </script> </head>