# HG changeset patch # User Nicholas Jillings # Date 1444383483 -3600 # Node ID 25c16110d0fa0fe22499614911ad8549c93993bb # Parent f73d9333ab0d6c21721b222ec4db470be453d59b and tags depricated. All anchor/ref are directly applied as attributes on diff -r f73d9333ab0d -r 25c16110d0fa core.js --- a/core.js Wed Oct 07 22:16:06 2015 +0100 +++ b/core.js Fri Oct 09 10:38:03 2015 +0100 @@ -1376,10 +1376,7 @@ } } } else if (this.type == 'anchor' || this.type == 'reference') { - this.value = Number(child.textContent); - this.enforce = child.getAttribute('enforce'); - if (this.enforce == 'true') {this.enforce = true;} - else {this.enforce = false;} + Console.log("WARNING: Anchor and Reference tags in the node are depricated"); } }; this.options = []; @@ -1524,24 +1521,32 @@ if (this.type == 'reference') {this.reference = true;} else {this.reference = false;} - this.marker = xml.getAttribute('marker'); - if (this.marker == null) {this.marker = undefined;} - - if (this.anchor == true) { - if (this.marker != undefined) {this.enforce = true;} - else {this.enforce = enforceAnchor;} - this.marker = anchor; + if (this.anchor == true || this.reference == true) + { + this.marker = xml.getAttribute('marker'); + if (this.marker != undefined) + { + this.marker = Number(this.marker); + if (isNaN(this.marker) == false) + { + if (this.marker > 1) + { this.marker /= 100.0;} + if (this.marker >= 0 && this.marker <= 1) + { + this.enforce = true; + return; + } else { + console.log("ERROR - Marker of audioElement "+this.id+" is not between 0 and 1 (float) or 0 and 100 (integer)!"); + console.log("ERROR - Marker not enforced!"); + } + } else { + console.log("ERROR - Marker of audioElement "+this.id+" is not a number!"); + console.log("ERROR - Marker not enforced!"); + } + } } - else if (this.reference == true) { - if (this.marker != undefined) {this.enforce = true;} - else {this.enforce = enforceReference;} - this.marker = reference; - } - - if (this.marker != undefined) { - this.marker = Number(this.marker); - if (this.marker > 1) {this.marker /= 100;} - } + this.marker = false; + this.enforce = false; }; this.commentQuestionNode = function(xml) { @@ -1597,50 +1602,6 @@ if (xml.getAttribute('elementComments') == "true") {this.elementComments = true;} else {this.elementComments = false;} - var anchor = xml.getElementsByTagName('anchor'); - var enforceAnchor = false; - if (anchor.length == 0) { - // Find anchor in commonInterface; - for (var i=0; i 1 && anchor < 100) {anchor /= 100.0;} - } - - if (typeof(reference) == 'number') { - if (reference > 1 && reference < 100) {reference /= 100.0;} - } - this.preTest = new parent.prepostNode('pretest',xml.getElementsByTagName('PreTest')); this.postTest = new parent.prepostNode('posttest',xml.getElementsByTagName('PostTest')); @@ -1678,36 +1639,6 @@ this.audioElements = randomiseOrder(this.audioElements); } - // Check only one anchor and one reference per audioNode - var anchor = []; - var reference = []; - this.anchorId = null; - this.referenceId = null; - for (var i=0; i 1) { - console.log('Error - cannot have more than one anchor!'); - console.log('Each anchor node will be a normal mode to continue the test'); - for (var i=0; i 1) { - console.log('Error - cannot have more than one anchor!'); - console.log('Each anchor node will be a normal mode to continue the test'); - for (var i=0; i