chrome is horrible

This commit is contained in:
Jacob Levine 2019-03-22 00:46:19 -05:00
parent 02ce675a0b
commit 0124d9db97

View File

@ -136,13 +136,12 @@ function cseries(seriesName) {
if (seriesName == "quantitative") { if (seriesName == "quantitative") {
document.getElementById('FormData').innerHTML += "<h3>" + 'Sandstorm' + "</h3>"; document.getElementById('FormData').innerHTML += "<h3>" + 'Sandstorm' + "</h3>";
document.getElementById('FormData').innerHTML += "<div id='repsec1'>"; document.getElementById('FormData').innerHTML += "<div id='repsec1'>""</div>";
var ss = firebase.firestore().collection('appBuilding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('appElements').doc('quantitativeSandstorm'); var ss = firebase.firestore().collection('appBuilding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('appElements').doc('quantitativeSandstorm');
ss.get().then(function(doc) { ss.get().then(function(doc) {
if (doc.exists) { if (doc.exists) {
processAndAppendReturn(doc.data()) processAndAppendReturn(doc.data(),'repsec1')
} }
document.getElementById('FormData').innerHTML += "</div>";
}).then(function() { }).then(function() {
document.getElementById('FormData').innerHTML += "<h3>" + 'TeleOp' + "</h3>"; document.getElementById('FormData').innerHTML += "<h3>" + 'TeleOp' + "</h3>";
document.getElementById('FormData').innerHTML += "<div id='repsec2'>"; document.getElementById('FormData').innerHTML += "<div id='repsec2'>";
@ -204,7 +203,7 @@ function cseries(seriesName) {
}); });
} }
function processAndAppendReturn(data) { function processAndAppendReturn(data,newloc) {
labels = Object.keys(data); labels = Object.keys(data);
var index = labels.indexOf('header'); var index = labels.indexOf('header');
if (index > -1) { if (index > -1) {
@ -230,30 +229,28 @@ function processAndAppendReturn(data) {
return a[1].order - b[1].order; return a[1].order - b[1].order;
}) })
for (var j = 0; j < questions.length; j++) { for (var j = 0; j < questions.length; j++) {
document.getElementById('FormData').innerHTML += "<div>"; document.getElementById(newLoc).innerHTML += "<div id='"+newloc+j.toString()+"'></div>";
document.getElementById('FormData').innerHTML += questions[j][0]; document.getElementById(newloc+j.toString()).innerHTML += questions[j][0];
if (questions[j][1]['type'] == 'shortText') { if (questions[j][1]['type'] == 'shortText') {
document.getElementById('FormData').innerHTML += "<input id=''" + questions[j][0] + "' type='text'></input>"; document.getElementById(newloc+j.toString()).innerHTML += "<input id=''" + questions[j][0] + "' type='text'></input>";
} else if (questions[j][1]['type'] == 'textField') { } else if (questions[j][1]['type'] == 'textField') {
document.getElementById('FormData').innerHTML += "<br><textarea id=''" + questions[j][0] + "' rows='4' cols='50''></textarea>"; document.getElementById(newloc+j.toString()).innerHTML += "<br><textarea id=''" + questions[j][0] + "' rows='4' cols='50''></textarea>";
} else if (questions[j][1]['type'] == 'stepper') { } else if (questions[j][1]['type'] == 'stepper') {
document.getElementById('FormData').innerHTML += "<span id='" + questions[j][0] + "'><input type='button' onclick=\"dec('" + questions[j][0] + "')\" value='-'></input>" + (questions[j][1]['defaultValue']).toString() + "<input type='button' onclick=\"inc('" + questions[j][0] + "')\" value='+'></input></span>"; document.getElementById(newloc+j.toString()).innerHTML += "<span id='" + questions[j][0] + "'><input type='button' onclick=\"dec('" + questions[j][0] + "')\" value='-'></input>" + (questions[j][1]['defaultValue']).toString() + "<input type='button' onclick=\"inc('" + questions[j][0] + "')\" value='+'></input></span>";
}else if (questions[j][1]['type'] == 'label') { }else if (questions[j][1]['type'] == 'label') {
document.getElementById('FormData').innerHTML += "<span id='" + questions[j][0] + "'><input type='button' onclick=\"dec('" + questions[j][0] + "')\" value='-'></input>" + '0' + "<input type='button' onclick=\"inc('" + questions[j][0] + "')\" value='+'></input></span>"; document.getElementById(newloc+j.toString()).innerHTML += "<span id='" + questions[j][0] + "'><input type='button' onclick=\"dec('" + questions[j][0] + "')\" value='-'></input>" + '0' + "<input type='button' onclick=\"inc('" + questions[j][0] + "')\" value='+'></input></span>";
} else if (questions[j][1]['type'] == 'slider') { } else if (questions[j][1]['type'] == 'slider') {
document.getElementById('FormData').innerHTML += "&nbsp;&nbsp;" + questions[j][1]['min'] + "&nbsp;&nbsp;"; document.getElementById(newloc+j.toString()).innerHTML += "&nbsp;&nbsp;" + questions[j][1]['min'] + "&nbsp;&nbsp;";
document.getElementById('FormData').innerHTML += "<input type='range' min='" + questions[j][1]['min']+ "' max='" + questions[j][1]['max'] + "'>"; document.getElementById(newloc+j.toString()).innerHTML += "<input type='range' min='" + questions[j][1]['min']+ "' max='" + questions[j][1]['max'] + "'>";
document.getElementById('FormData').innerHTML += "&nbsp;&nbsp;" + questions[j][1]['max']; document.getElementById(newloc+j.toString()).innerHTML += "&nbsp;&nbsp;" + questions[j][1]['max'];
} else if (questions[j][1]['type'] == 'segment') { } else if (questions[j][1]['type'] == 'segment') {
document.getElementById('FormData').innerHTML += "<div id='" + questions[j][0] + "'>" document.getElementById(newloc+j.toString()).innerHTML += "<div id='" + questions[j][0] + "'></div>"
for (var k = 0; k < questions[j][1]['elements'].length; k++) { for (var k = 0; k < questions[j][1]['elements'].length; k++) {
//// TODO: replace with real buttons for good styling //// TODO: replace with real buttons for good styling
document.getElementById('FormData').innerHTML += questions[j][1]['elements'][k]; document.getElementById(questions[j][0]).innerHTML += questions[j][1]['elements'][k];
document.getElementById('FormData').innerHTML += "<input type='radio' name='" + questions[j][0] + "' value=" + questions[j][1]['elements'][k] + "></input>" document.getElementById(questions[j][0]).innerHTML += "<input type='radio' name='" + questions[j][0] + "' value=" + questions[j][1]['elements'][k] + "></input>"
} }
document.getElementById('FormData').innerHTML += "</div>"
} }
document.getElementById('FormData').innerHTML += "</div>";
} }
} }