Mercurial > hg > webaudioevaluationtool
changeset 2348:0c03d92dc27c
Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool
author | www-data <www-data@sucuk.dcs.qmul.ac.uk> |
---|---|
date | Mon, 16 May 2016 11:22:35 +0100 |
parents | dc05aa1411f3 (current diff) 7de03d416f38 (diff) |
children | 1ab42e36b6c8 |
files | |
diffstat | 2 files changed, 57 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/css/core.css Sun May 15 11:20:51 2016 +0100 +++ b/css/core.css Mon May 16 11:22:35 2016 +0100 @@ -58,6 +58,7 @@ overflow: auto; margin-bottom: 5px; padding: 8px; + text-align: center; } #popupTitle { @@ -98,6 +99,18 @@ margin-right: 15px; } +table.popup-option-list { + margin: auto; +} + +table.popup-option-list tr { + padding: 5px; +} + +table.popup-option-list tr td { + padding: 5px; +} + button#popup-proceed { bottom: 10px; right: 10px; @@ -209,14 +222,3 @@ padding: 0 5px; height: 290px; } - -::-webkit-scrollbar { - -webkit-appearance: none; - width: 7px; -} - -::-webkit-scrollbar-thumb { - border-radius: 4px; - background-color: rgba(0,0,0,.5); - -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5); -}
--- a/js/core.js Sun May 15 11:20:51 2016 +0100 +++ b/js/core.js Mon May 16 11:22:35 2016 +0100 @@ -708,61 +708,70 @@ node.response = Array(node.specification.options.length); } var index = 0; - var max_w = 0; + var table = document.createElement("table"); + table.className = "popup-option-list"; + table.border = "0"; for (var option of node.specification.options) { - var input = document.createElement('input'); - input.id = option.name; + var tr = document.createElement("tr"); + table.appendChild(tr); + var td = document.createElement("td"); + tr.appendChild(td); + var input = document.createElement('input'); + input.id = option.name; input.type = 'checkbox'; + td.appendChild(input); + + td = document.createElement("td"); + tr.appendChild(td); var span = document.createElement('span'); span.textContent = option.text; - var hold = document.createElement('div'); - hold.setAttribute('name','option'); - hold.className = "popup-option-checbox"; - hold.appendChild(input); - hold.appendChild(span); - this.popupResponse.appendChild(hold); + td.appendChild(span); + var tr = document.createElement('div'); + tr.setAttribute('name','option'); + tr.className = "popup-option-checbox"; if (node.response[index] != undefined){ if (node.response[index].checked == true) { input.checked = "true"; } } - var w = $(hold).width(); - if (w > max_w) - max_w = w; index++; - } - this.popupResponse.style.textAlign=""; - var leftP = 50-(((max_w/$('#popupContent').width())/2)*100); - this.popupResponse.style.left=leftP+"%"; + } + this.popupResponse.appendChild(table); } else if (node.specification.type == 'radio') { if (node.response == undefined) { node.response = {name: "", text: ""}; } var index = 0; - var max_w = 0; + var table = document.createElement("table"); + table.className = "popup-option-list"; + table.border = "0"; for (var option of node.specification.options) { - var input = document.createElement('input'); - input.id = option.name; + var tr = document.createElement("tr"); + table.appendChild(tr); + var td = document.createElement("td"); + tr.appendChild(td); + var input = document.createElement('input'); + input.id = option.name; input.type = 'radio'; - input.name = node.specification.id; + input.name = node.specification.id; + td.appendChild(input); + + td = document.createElement("td"); + tr.appendChild(td); var span = document.createElement('span'); span.textContent = option.text; - var hold = document.createElement('div'); - hold.setAttribute('name','option'); - hold.className = "popup-option-checbox"; - hold.appendChild(input); - hold.appendChild(span); - this.popupResponse.appendChild(hold); - if (input.id == node.response.name) { - input.checked = "true"; + td.appendChild(span); + var tr = document.createElement('div'); + tr.setAttribute('name','option'); + tr.className = "popup-option-checbox"; + if (node.response[index] != undefined){ + if (node.response[index].checked == true) { + input.checked = "true"; + } } - var w = $(hold).width(); - if (w > max_w) - max_w = w; - } - this.popupResponse.style.textAlign=""; - var leftP = 50-(((max_w/$('#popupContent').width())/2)*100); - this.popupResponse.style.left=leftP+"%"; + index++; + } + this.popupResponse.appendChild(table); } else if (node.specification.type == 'number') { var input = document.createElement('input'); input.type = 'textarea';