changeset 2319:6897339ac651

#48. JS in core.js
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Fri, 29 Apr 2016 16:26:34 +0100
parents f1e67258f0b8
children ae69e61a6b76
files index.html js/core.js test.html
diffstat 3 files changed, 20 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/index.html	Fri Apr 29 15:52:41 2016 +0100
+++ b/index.html	Fri Apr 29 16:26:34 2016 +0100
@@ -22,28 +22,6 @@
 		<script type="text/javascript" src='js/loudness.js'></script>
 		<script type="text/javascript" src='js/xmllint.js'></script>
         <script type="text/javascript" src='js/WAVE.js'></script>
-		<script type="text/javascript">
-			// 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)
-			{
-				var search = window.location.search.split('?')[1];
-				// Now split the requests into pairs
-				var searchQueries = search.split('&');
-				for (var i in searchQueries)
-				{
-					// Split each request into
-					searchQueries[i] = searchQueries[i].split('=');
-					if (searchQueries[i][0] == "url")
-					{
-						url = decodeURI(searchQueries[i][1]);
-					}
-				}
-				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>
 
 	<body>
--- a/js/core.js	Fri Apr 29 15:52:41 2016 +0100
+++ b/js/core.js	Fri Apr 29 16:26:34 2016 +0100
@@ -140,6 +140,26 @@
 	storage = new Storage();
 	// Define window callbacks for interface
 	window.onresize = function(event){interfaceContext.resizeWindow(event);};
+    
+    if (window.location.search.length != 0)
+    {
+        var search = window.location.search.split('?')[1];
+        // Now split the requests into pairs
+        var searchQueries = search.split('&');
+        for (var i in searchQueries)
+        {
+            // Split each request into
+            searchQueries[i] = searchQueries[i].split('=');
+            if (searchQueries[i][0] == "url")
+            {
+                url = decodeURI(searchQueries[i][1]);
+            }
+        }
+        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?";
+        };
+    }
 };
 
 function loadProjectSpec(url) {
--- a/test.html	Fri Apr 29 15:52:41 2016 +0100
+++ b/test.html	Fri Apr 29 16:26:34 2016 +0100
@@ -22,28 +22,6 @@
 		<script type="text/javascript" src='js/loudness.js'></script>
 		<script type="text/javascript" src='js/xmllint.js'></script>
         <script type="text/javascript" src='js/WAVE.js'></script>
-		<script type="text/javascript">
-			// 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)
-			{
-				var search = window.location.search.split('?')[1];
-				// Now split the requests into pairs
-				var searchQueries = search.split('&');
-				for (var i in searchQueries)
-				{
-					// Split each request into
-					searchQueries[i] = searchQueries[i].split('=');
-					if (searchQueries[i][0] == "url")
-					{
-						url = decodeURI(searchQueries[i][1]);
-					}
-				}
-				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>
 
 	<body>