# HG changeset patch # User Nicholas Jillings # Date 1461746352 -3600 # Node ID c63df53cbd103b9fc47f40fc3115d43e9c7b0152 # Parent fd711d12dd145ad3f33b54e17f85b5c08489b120# Parent 5a2aaa964f6d703e0ae9b2e2eaa62ccdcbbb6591 Merge branch 'Dev_main' diff -r fd711d12dd14 -r c63df53cbd10 js/core.js --- a/js/core.js Tue Apr 26 01:46:15 2016 +0100 +++ b/js/core.js Wed Apr 27 09:39:12 2016 +0100 @@ -241,8 +241,8 @@ } else if (responseDocument.firstChild.nodeName == "waetresult") { // document is a result projectXML = document.implementation.createDocument(null,"waet"); - projectXML.children[0].appendChild(responseDocument.getElementsByTagName('waet')[0].getElementsByTagName("setup")[0].cloneNode(true)); - var child = responseDocument.children[0].children[0]; + projectXML.firstChild.appendChild(responseDocument.getElementsByTagName('waet')[0].getElementsByTagName("setup")[0].cloneNode(true)); + var child = responseDocument.firstChild.firstChild; while (child != null) { if (child.nodeName == "survey") { // One of the global survey elements @@ -268,15 +268,15 @@ // We need to complete this, so it must be regenerated by store var copy = child; child = child.previousElementSibling; - responseDocument.children[0].removeChild(copy); + responseDocument.firstChild.removeChild(copy); } } else if (child.nodeName == "page") { if (child.getAttribute("state") == "empty") { // We need to complete this page - projectXML.children[0].appendChild(responseDocument.getElementById(child.getAttribute("ref")).cloneNode(true)); + projectXML.firstChild.appendChild(responseDocument.getElementById(child.getAttribute("ref")).cloneNode(true)); var copy = child; child = child.previousElementSibling; - responseDocument.children[0].removeChild(copy); + responseDocument.firstChild.removeChild(copy); } } child = child.nextElementSibling; @@ -2102,9 +2102,11 @@ this.span = document.createElement('div'); this.inputs.align = 'center'; this.inputs.style.marginLeft = '12px'; + this.inputs.className = "comment-radio-inputs-holder"; this.span.style.marginLeft = '12px'; this.span.align = 'center'; this.span.style.marginTop = '15px'; + this.span.className = "comment-radio-span-holder"; var optCount = commentQuestion.options.length; for (var optNode of commentQuestion.options) @@ -2174,9 +2176,9 @@ boxwidth = 400; } this.holder.style.width = boxwidth+"px"; - var text = this.holder.children[2]; - var options = this.holder.children[3]; - var optCount = options.children.length; + var text = this.holder.getElementsByClassName("comment-radio-span-holder")[0]; + var options = this.holder.getElementsByClassName("comment-radio-inputs-holder")[0]; + var optCount = options.childElementCount; var spanMargin = Math.floor(((boxwidth-20-(optCount*80))/(optCount))/2)+'px'; var options = options.firstChild; var text = text.firstChild; @@ -2214,9 +2216,11 @@ this.span = document.createElement('div'); this.inputs.align = 'center'; this.inputs.style.marginLeft = '12px'; + this.inputs.className = "comment-checkbox-inputs-holder"; this.span.style.marginLeft = '12px'; this.span.align = 'center'; this.span.style.marginTop = '15px'; + this.span.className = "comment-checkbox-span-holder"; var optCount = commentQuestion.options.length; for (var i=0; i \ No newline at end of file