diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2021-03-14 15:13:31 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2021-03-14 15:13:31 +0530 |
commit | 849fe346897fa91e574db463a2a03ece2d27b16d (patch) | |
tree | 7f40f769fac29014987194257a754a5f46c7c594 /assets/src/js | |
parent | df97df0db3d5ea52698854d7eee9f012493cb60d (diff) |
dynamically create table
Diffstat (limited to 'assets/src/js')
-rw-r--r-- | assets/src/js/main.js | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/assets/src/js/main.js b/assets/src/js/main.js index dbcc4a6..7ff1019 100644 --- a/assets/src/js/main.js +++ b/assets/src/js/main.js @@ -38,12 +38,19 @@ function get_smiles_from_element_text(el_id){ function draw_me_like_one_of_your_french_girls(mol){ mol.condense_abbreviations(); - var canvas = document.getElementById("draw-canvas-2"); - mol.draw_to_canvas(canvas, -1, -1); + //var canvas = document.getElementById("draw-canvas-2"); + //mol.draw_to_canvas(canvas, -1, -1); + var dest = document.getElementById("draw-output"); + var svg = mol.get_svg(); + dest.outerHTML = "<div id='drawing-1'>" + svg + "</div>"; + console.log(svg) } function calculate_and_disperse(mol){ + const shy_values_do_not_show = ["NumUnspecifiedAtomStereoCenters","NumAliphaticHeterocycles", + "NumSaturatedHeterocycles","NumAromaticHeterocycles","NumAmideBonds","NumAromaticRings","NumAliphaticRings" + ,"NumSaturatedRings","NumSpiroAtoms","NumBridgeheadAtoms","NumAtomStereoCenters"] try { var descrs = JSON.parse(mol.get_descriptors()); } catch(err) { @@ -55,15 +62,19 @@ function calculate_and_disperse(mol){ let tableRef = document.getElementById("analyse_table"); const keys = Object.keys(descrs); for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - console.log(key, descrs[key]); - var newRow = tableRef.insertRow(-1); - var newCell_label = newRow.insertCell(0); - var newCell_value = newRow.insertCell(-1); - var newText_label = document.createTextNode(key); - var newText_value = document.createTextNode(descrs[key]); - newCell_label.appendChild(newText_label); - newCell_value.appendChild(newText_value); + const key = keys[i]; + if(shy_values_do_not_show.indexOf(key) !== -1){ + console.log("skipping") + } else{ + console.log(key, descrs[key]); + var newRow = tableRef.insertRow(-1); + var newCell_label = newRow.insertCell(0); + var newCell_value = newRow.insertCell(-1); + var newText_label = document.createTextNode(key); + var newText_value = document.createTextNode(descrs[key]); + newCell_label.appendChild(newText_label); + newCell_value.appendChild(newText_value); + } } |