Mercurial > hg > webaudioevaluationtool
changeset 543:f81c46b294a9 Dev_main
Bug #1607, #1608 and #1610 fixes.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Mon, 22 Feb 2016 14:38:45 +0000 |
parents | e23de2023941 |
children | e0f95b33ba31 |
files | core.js interfaces/AB.css interfaces/AB.js test_create/test_core.js |
diffstat | 4 files changed, 42 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/core.js Mon Feb 22 14:20:50 2016 +0000 +++ b/core.js Mon Feb 22 14:38:45 2016 +0000 @@ -147,6 +147,15 @@ r.onload = function() { loadProjectSpecCallback(r.response); }; + r.onerror = function() { + document.getElementsByTagName('body')[0].innerHTML = null; + var msg = document.createElement("h3"); + msg.textContent = "FATAL ERROR"; + var span = document.createElement("p"); + span.textContent = "There was an error when loading your XML file. Please check your path in the URL. After the path to this page, there should be '?url=path/to/your/file.xml'. Check the spelling of your filename as well. If you are still having issues, check the log of the python server or your webserver distribution for 404 codes for your file."; + document.getElementsByTagName('body')[0].appendChild(msg); + document.getElementsByTagName('body')[0].appendChild(span); + } r.send(); }; xmlhttp.send();
--- a/interfaces/AB.css Mon Feb 22 14:20:50 2016 +0000 +++ b/interfaces/AB.css Mon Feb 22 14:38:45 2016 +0000 @@ -37,7 +37,7 @@ font-size: 1.2em; } -div.comparitor-holder { +div.comparator-holder { width: 260px; height: 300px; border: black 1px solid; @@ -46,7 +46,7 @@ margin: 25px; } -div.comparitor-selector { +div.comparator-selector { width: 248px; height: 250px; border: black 1px solid; @@ -63,11 +63,11 @@ background-color: #008000; } -div.comparitor-selector span { +div.comparator-selector span { font-size: 4em; } -button.comparitor-button { +button.comparator-button { width: 250px; height: 38px; position: relative;
--- a/interfaces/AB.js Mon Feb 22 14:20:50 2016 +0000 +++ b/interfaces/AB.js Mon Feb 22 14:38:45 2016 +0000 @@ -7,8 +7,8 @@ var height = window.innerHeight; interfaceContext.insertPoint.innerHTML = null; // Clear the current schema - // Custom Comparitor Object - Interface.prototype.comparitor = null; + // Custom comparator Object + Interface.prototype.comparator = null; // The injection point into the HTML page interfaceContext.insertPoint = document.getElementById("topLevelBody"); @@ -148,8 +148,8 @@ } } - // Populate the comparitor object - interfaceContext.comparitor = new Comparitor(audioHolderObject); + // Populate the comparator object + interfaceContext.comparator = new comparator(audioHolderObject); if (audioHolderObject.showElementComments) { var commentHolder = document.createElement('div'); @@ -165,25 +165,25 @@ resizeWindow(null); } -function Comparitor(audioHolderObject) +function comparator(audioHolderObject) { - this.comparitorBox = function(audioElement,id,text) + this.comparatorBox = function(audioElement,id,text) { this.parent = audioElement; this.id = id; this.value = 0; this.disabled = true; this.box = document.createElement('div'); - this.box.className = 'comparitor-holder'; + this.box.className = 'comparator-holder'; this.box.setAttribute('track-id',audioElement.id); - this.box.id = 'comparitor-'+text; + this.box.id = 'comparator-'+text; this.selector = document.createElement('div'); - this.selector.className = 'comparitor-selector disabled'; + this.selector.className = 'comparator-selector disabled'; var selectorText = document.createElement('span'); selectorText.textContent = text; this.selector.appendChild(selectorText); this.playback = document.createElement('button'); - this.playback.className = 'comparitor-button'; + this.playback.className = 'comparator-button'; this.playback.disabled = true; this.playback.textContent = "Listen"; this.box.appendChild(this.selector); @@ -202,13 +202,13 @@ console.log("Please listen to the samples before making a selection"); return; } - $(".comparitor-selector").removeClass('selected'); + $(".comparator-selector").removeClass('selected'); var id = event.currentTarget.parentElement.getAttribute('track-id'); - interfaceContext.comparitor.selected = id; + interfaceContext.comparator.selected = id; $(event.currentTarget).addClass('selected'); - for (var i=0; i<interfaceContext.comparitor.comparitors.length; i++) + for (var i=0; i<interfaceContext.comparator.comparators.length; i++) { - var obj = interfaceContext.comparitor.comparitors[i]; + var obj = interfaceContext.comparator.comparators[i]; if (i == id) { obj.value = 1; } else { @@ -252,7 +252,7 @@ }; this.startPlayback = function() { - $('.comparitor-button').text('Listen'); + $('.comparator-button').text('Listen'); $(this.playback).text('Stop'); this.playback.setAttribute("playstate","playing"); }; @@ -282,7 +282,7 @@ this.boxHolders = document.getElementById('box-holders'); this.boxHolders.innerHTML = null; - this.comparitors = []; + this.comparators = []; this.selected = null; // First generate the Audio Objects for the Audio Engine @@ -294,9 +294,9 @@ console.log("WARNING - AB cannot have fixed reference"); } var audioObject = audioEngineContext.newTrack(element); - var node = new this.comparitorBox(audioObject,index,String.fromCharCode(65 + index)); + var node = new this.comparatorBox(audioObject,index,String.fromCharCode(65 + index)); audioObject.bindInterface(node); - this.comparitors.push(node); + this.comparators.push(node); this.boxHolders.appendChild(node.box); } return this; @@ -305,7 +305,7 @@ function resizeWindow(event) { document.getElementById('submit').style.left = (window.innerWidth-250)/2 + 'px'; - var numObj = interfaceContext.comparitor.comparitors.length; + var numObj = interfaceContext.comparator.comparators.length; var boxW = numObj*312; var diff = window.innerWidth - boxW; while (diff < 0)
--- a/test_create/test_core.js Mon Feb 22 14:20:50 2016 +0000 +++ b/test_create/test_core.js Mon Feb 22 14:38:45 2016 +0000 @@ -141,7 +141,11 @@ this.proceedButton.onclick = function() { popupObject.popupContent.innerHTML = null; - popupObject.shownObject.continue(); + if(typeof popupObject.shownObject.continue == "function") { + popupObject.shownObject.continue(); + } else { + popupObject.hide(); + } }; this.object.appendChild(this.proceedButton); @@ -198,6 +202,11 @@ } else { this.backButton.style.visibility = "hidden"; } + if (typeof this.shownObject.continue == "function") { + this.proceedButton.textContent = "Next"; + } else { + this.proceedButton.textContent = "Finish"; + } this.show(); }