Mercurial > hg > webaudioevaluationtool
comparison interfaces/ABX.js @ 2363:95dc0833eb0a
Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool
author | www-data <www-data@sucuk.dcs.qmul.ac.uk> |
---|---|
date | Mon, 16 May 2016 16:20:59 +0100 |
parents | a3099bdb056c |
children | 5b23f2e05207 |
comparison
equal
deleted
inserted
replaced
2350:1ab42e36b6c8 | 2363:95dc0833eb0a |
---|---|
9 function loadInterface() { | 9 function loadInterface() { |
10 // Use this to do any one-time page / element construction. For instance, placing any stationary text objects, | 10 // Use this to do any one-time page / element construction. For instance, placing any stationary text objects, |
11 // holding div's, or setting up any nodes which are present for the entire test sequence | 11 // holding div's, or setting up any nodes which are present for the entire test sequence |
12 | 12 |
13 interfaceContext.insertPoint.innerHTML = null; // Clear the current schema | 13 interfaceContext.insertPoint.innerHTML = null; // Clear the current schema |
14 | |
15 Interface.prototype.checkScaleRange = function(min, max) { | |
16 var page = testState.getCurrentTestPage(); | |
17 var audioObjects = audioEngineContext.audioObjects; | |
18 var state = true; | |
19 var str = "Please keep listening. "; | |
20 var minRanking = Infinity; | |
21 var maxRanking = -Infinity; | |
22 for (var ao of audioObjects) { | |
23 var rank = ao.interfaceDOM.getValue(); | |
24 if (rank < minRanking) {minRanking = rank;} | |
25 if (rank > maxRanking) {maxRanking = rank;} | |
26 } | |
27 if (maxRanking*100 < max) { | |
28 str += "At least one fragment must be selected." | |
29 state = false; | |
30 } | |
31 if (!state) { | |
32 console.log(str); | |
33 this.storeErrorNode(str); | |
34 interfaceContext.lightbox.post("Message",str); | |
35 } | |
36 return state; | |
37 } | |
14 | 38 |
15 // Custom comparator Object | 39 // Custom comparator Object |
16 Interface.prototype.comparator = null; | 40 Interface.prototype.comparator = null; |
17 | 41 |
18 // The injection point into the HTML page | 42 // The injection point into the HTML page |
196 console.log("Please wait until sample has loaded"); | 220 console.log("Please wait until sample has loaded"); |
197 return; | 221 return; |
198 } | 222 } |
199 if (audioEngineContext.status == 0) | 223 if (audioEngineContext.status == 0) |
200 { | 224 { |
201 alert("Please listen to the samples before making a selection"); | 225 interfaceContext.lightbox.post("Message", "Please listen to the samples before making a selection"); |
202 console.log("Please listen to the samples before making a selection"); | 226 console.log("Please listen to the samples before making a selection"); |
203 return; | 227 return; |
204 } | 228 } |
205 var id = event.currentTarget.parentElement.getAttribute('track-id'); | 229 var id = event.currentTarget.parentElement.getAttribute('track-id'); |
206 interfaceContext.comparator.selected = id; | 230 interfaceContext.comparator.selected = id; |
451 // This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options | 475 // This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options |
452 } else | 476 } else |
453 { | 477 { |
454 if (audioEngineContext.timer.testStarted == false) | 478 if (audioEngineContext.timer.testStarted == false) |
455 { | 479 { |
456 alert('You have not started the test! Please press start to begin the test!'); | 480 interfaceContext.lightbox.post("Warning",'You have not started the test! Please listen to a sample to begin the test!'); |
457 return; | 481 return; |
458 } | 482 } |
459 } | 483 } |
460 testState.advanceState(); | 484 testState.advanceState(); |
461 } | 485 } |