# HG changeset patch # User Nicholas Jillings # Date 1434727874 -3600 # Node ID b51da1e7547c9f741662454765f3f79959845761 # Parent ccb62b429a8533667a8bd7951628a1c6f5542185 Added check type 'scalerange' with min max attributes to enforce use of the scale. diff -r ccb62b429a85 -r b51da1e7547c ape.js --- a/ape.js Thu Jun 18 16:39:40 2015 +0100 +++ b/ape.js Fri Jun 19 16:31:14 2015 +0100 @@ -147,6 +147,38 @@ return state; }; + Interface.prototype.checkScaleRange = function() + { + var audioObjs = audioEngineContext.audioObjects; + var audioHolder = testState.stateMap[testState.stateIndex]; + var interfaces = audioHolder.interfaces; + + var minRanking = audioObjs[0].interfaceDOM.getValue(); + var maxRanking = minRanking; + + var minScale; + var maxScale; + for (var i=0; i maxRanking) { maxRanking = ranking;} + } + if (minRanking > minScale || maxRanking < maxScale) { + alert('Please use the full width of the scale'); + return false; + } else { + return true; + } + }; + // Bindings for audioObjects // Create the top div for the Title element @@ -530,9 +562,15 @@ var checkState = interfaceContext.checkAllCommented(); if (checkState == false) {canContinue = false;} break; + case 'scalerange': + // Check the scale is used to its full width outlined by the node + var checkState = interfaceContext.checkScaleRange(); + if (checkState == false) {canContinue = false;} + break; } } + if (!canContinue) {break;} } if (canContinue) { diff -r ccb62b429a85 -r b51da1e7547c core.js --- a/core.js Thu Jun 18 16:39:40 2015 +0100 +++ b/core.js Fri Jun 19 16:31:14 2015 +0100 @@ -1246,6 +1246,22 @@ this.type = child.nodeName; if (this.type == 'check') { this.check = child.getAttribute('name'); + if (this.check == 'scalerange') { + this.min = child.getAttribute('min'); + this.max = child.getAttribute('max'); + if (this.min == null) {this.min = 1;} + else if (Number(this.min) > 1 && this.min != null) { + this.min = Number(this.min)/100; + } else { + this.min = Number(this.min); + } + if (this.max == null) {this.max = 0;} + else if (Number(this.max) > 1 && this.max != null) { + this.max = Number(this.max)/100; + } else { + this.max = Number(this.max); + } + } } else if (this.type == 'anchor' || this.type == 'reference') { this.value = Number(child.textContent); } @@ -1345,7 +1361,7 @@ var title = DOM.getElementsByTagName('title'); if (title.length == 0) {this.title = null;} else {this.title = title[0].textContent;} - + this.options = parent.commonInterface.options; var scale = DOM.getElementsByTagName('scale'); this.scale = []; for (var i=0; i --> + 20 80 @@ -92,6 +93,7 @@ Max Middle 75 + Comment on fragment