From 6e282b6b0f1ee7128399113c3d1286948747494c Mon Sep 17 00:00:00 2001 From: Kevin Nadro Date: Wed, 6 Jul 2016 21:40:50 -0700 Subject: [PATCH 1/3] fixed minor bugs - fixed the input fields to be text for matrix tracers can store characters and not just numbers - fixed the output of the 1d tracer array because it was storing it as a 2d matrix --- js/create/array2d.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/js/create/array2d.js b/js/create/array2d.js index 596ac857..e37f0fbf 100644 --- a/js/create/array2d.js +++ b/js/create/array2d.js @@ -35,7 +35,7 @@ const tableToInputFields = (numRows, numColumns) => { for(var i = 0; i < numRows; i++){ for(var j = 0; j < numColumns; j++){ var elem = document.createElement('input'); - elem.type = 'Number'; + elem.type = 'Text'; elem.value = Math.floor(Math.random() * 10 + 1); elem.classList.add('mtbl-col','inputField'); table.childNodes[i].childNodes[j].innerHTML = ''; @@ -56,14 +56,18 @@ const generateJS = (logger, tracer, tracerName) => { logger.print('Copy and paste this code in your data.js file!'); logger.print(''); - logger.print('let myTable = ['); + if(numRows > 1) { + logger.print('let myTable = ['); + } - var line = ''; + var line = 'let myTable = ['; var i; var j; var comma = ','; for(i = 0; i < numRows; i++){ - line = '['; + if(numRows > 1){ + line = '['; + } for(j = 0; j < numColumns-1; j++){ line += table.childNodes[i].childNodes[j].childNodes[0].value + ','; } @@ -71,7 +75,9 @@ const generateJS = (logger, tracer, tracerName) => { line += table.childNodes[i].childNodes[j++].childNodes[0].value + ']' + comma; logger.print(line); } - logger.print(']'); + if(numRows > 1){ + logger.print(']'); + } logger.print("let myTableTracer = new "+ tracer +" ('"+tracerName+"')"); From 94ea13ce079d0204a5a0837eb471063727243f8e Mon Sep 17 00:00:00 2001 From: Kevin Nadro Date: Wed, 6 Jul 2016 22:03:17 -0700 Subject: [PATCH 2/3] fixed strings with the array --- js/create/array2d.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/js/create/array2d.js b/js/create/array2d.js index e37f0fbf..43fa4ecc 100644 --- a/js/create/array2d.js +++ b/js/create/array2d.js @@ -64,15 +64,27 @@ const generateJS = (logger, tracer, tracerName) => { var i; var j; var comma = ','; + var currVal; + var nors; for(i = 0; i < numRows; i++){ if(numRows > 1){ line = '['; } for(j = 0; j < numColumns-1; j++){ - line += table.childNodes[i].childNodes[j].childNodes[0].value + ','; + currVal = table.childNodes[i].childNodes[j].childNodes[0].value; + nors = Number(currVal); + if(isNaN(nors)){ + currVal = "'" + currVal + "'"; + } + line += currVal + ','; } if(i === numRows - 1){comma = '';} - line += table.childNodes[i].childNodes[j++].childNodes[0].value + ']' + comma; + currVal = table.childNodes[i].childNodes[j++].childNodes[0].value; + nors = Number(currVal); + if(isNaN(nors)){ + currVal = "'" + currVal + "'"; + } + line += currVal + ']' + comma; logger.print(line); } if(numRows > 1){ From bdd258187a7e1fc72f29d1132c87a884b129150b Mon Sep 17 00:00:00 2001 From: Kevin Nadro Date: Wed, 6 Jul 2016 22:20:27 -0700 Subject: [PATCH 3/3] auto presses the trace tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - auto presses the trace tab for the user will be able to see the tracers once created for they don’t have to figure out on their own its under the tracer tab. --- js/create/index.js | 1 + js/create/util.js | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/js/create/index.js b/js/create/index.js index e5980beb..0b3514de 100644 --- a/js/create/index.js +++ b/js/create/index.js @@ -85,6 +85,7 @@ const init = () => { array2d.setup(); array1d.setup(); closeCreate(); + util.clickTraceTab(); } }; diff --git a/js/create/util.js b/js/create/util.js index 6d6f4484..981259f5 100644 --- a/js/create/util.js +++ b/js/create/util.js @@ -39,8 +39,16 @@ const enabledHightlighting = () =>{ } } +const clickTraceTab = () => { + var btn = document.getElementById('btn_trace'); + if(btn){ + btn.click(); + } +} + module.exports = { enabledHightlighting, positionModules, - clearModules + clearModules, + clickTraceTab }; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy