X-Git-Url: http://git.scottworley.com/nt3d/blobdiff_plain/1df99269ed4f25d4e70389ba70337ca62a545a5c..refs/heads/master:/nt3d.js diff --git a/nt3d.js b/nt3d.js index d4e62f6..80390b9 100644 --- a/nt3d.js +++ b/nt3d.js @@ -421,14 +421,14 @@ nt3d = { setTimeout(function() { // Get params from form - var params = []; + var params = {}; for (var i = 0; i < this.user_params.length; i++) { var as_string = this.form.elements["param"+i].value; var as_num = +as_string; - params[i] = isNaN(as_num) ? as_string : as_num; + params[this.user_params[i][0]] = isNaN(as_num) ? as_string : as_num; } - this.points = this.user_function.apply(null, params); + this.points = this.user_function.call(null, params); this.validate(this.points); @@ -476,7 +476,18 @@ nt3d = { tr = document.createElement("tr"); table.appendChild(tr); var td = document.createElement("td"); - td.appendChild(document.createTextNode(params[i][0])); + var description; + if (params[i].length > 2) { + description = params[i][2]; + } else { + description = params[i][0]; + description = description[0].toUpperCase() + description.substr(1); + description = description.replace(/_(.)/g, function(_, c) { + return " " + c.toUpperCase(); + }); + description = description.replace("Num ", "Number of "); + } + td.appendChild(document.createTextNode(description)); tr.appendChild(td); td = document.createElement("td"); var input = document.createElement("input");