# HG changeset patch # User Nicholas Jillings # Date 1450368658 0 # Node ID 41054721d1368157db83fdd0aa0e0c6b449b0b28 # Parent 8325139a738a20a125209c897c93d1cc666a616e MUSHRA: Set the initial position of sliders using the attribute initial-position using integer 0 to 100 diff -r 8325139a738a -r 41054721d136 core.js --- a/core.js Thu Dec 17 15:58:16 2015 +0000 +++ b/core.js Thu Dec 17 16:10:58 2015 +0000 @@ -1847,6 +1847,7 @@ this.elementComments = undefined; this.outsideReference = null; this.loudness = null; + this.initialPosition = null; this.preTest = new parent.prepostNode("pretest"); this.postTest = new parent.prepostNode("pretest"); this.interfaces = []; @@ -1871,6 +1872,18 @@ { this.loudness = parent.loudness; } + if (typeof xml.getAttribute('initial-position') === "string") + { + var xmlInitialPosition = Number(xml.getAttribute('initial-position')); + if (isNaN(xmlInitialPosition) == false) + { + if (xmlInitialPosition > 1) + { + xmlInitialPosition /= 100; + } + this.initialPosition = xmlInitialPosition; + } + } if (xml.getAttribute('loudness') != null) { var XMLloudness = xml.getAttribute('loudness'); @@ -1946,7 +1959,9 @@ AHNode.setAttribute("loop",this.loop); AHNode.setAttribute("elementComments",this.elementComments); if(this.loudness != null) {AHNode.setAttribute("loudness",this.loudness);} - + if(this.initialPosition != null) { + AHNode.setAttribute("loudness",this.initialPosition*100); + } for (var i=0; i