Mercurial > hg > webaudioevaluationtool
changeset 2400:e7601d5ff17b
Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool
author | www-data <www-data@sucuk.dcs.qmul.ac.uk> |
---|---|
date | Thu, 26 May 2016 16:20:56 +0100 |
parents | a51a6d810bf4 (current diff) 5d7ad658c699 (diff) |
children | 6b6422523c88 |
files | |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/js/core.js Thu May 26 15:20:55 2016 +0100 +++ b/js/core.js Thu May 26 16:20:56 2016 +0100 @@ -1095,19 +1095,23 @@ { this.currentStateMap = this.stateMap[this.stateIndex]; // Find and extract the outside reference - var elements = [], ref = null; - for (var elem of this.currentStateMap.audioElements) { - if (elem.type == "outside-reference") {ref = elem;} - else {elements.push(elem);} + var elements = [], ref = []; + var elem; + while(elem = this.currentStateMap.audioElements.pop()) + { + if (elem.type == "outside-reference") { + ref.push(elem); + } + else { + elements.push(elem); + } } if (this.currentStateMap.randomiseOrder) { - this.currentStateMap.audioElements = randomiseOrder(elements); + elements = randomiseOrder(elements); } - if (ref != null) - { - this.currentStateMap.audioElements.push(ref); - } + this.currentStateMap.audioElements = elements.concat(ref); + this.currentStore = storage.testPages[this.stateIndex]; if (this.currentStateMap.preTest != null) {