2021-03-14 10:42:06 +00:00
|
|
|
{"version":3,"file":"main.min.js","sources":["main.min.js"],"sourcesContent":["// import Popper\n// ../../../node_modules/popper.js/dist/umd/popper.js\n\n// import required js-files Bootstrap 5\n// ../../../node_modules/bootstrap/js/dist/alert.js\n// ../../../node_modules/bootstrap/js/dist/button.js\n// ../../../node_modules/bootstrap/js/dist/carousel.js\n// ../../../node_modules/bootstrap/js/dist/collapse.js\n// ../../../node_modules/bootstrap/js/dist/dropdown.js\n// ../../../node_modules/bootstrap/js/dist/modal.js\n// ../../../node_modules/bootstrap/js/dist/popover.js\n// ../../../node_modules/bootstrap/js/dist/scrollspy.js\n// ../../../node_modules/bootstrap/js/dist/tab.js\n// ../../../node_modules/bootstrap/js/dist/toast.js\n// ../../../node_modules/bootstrap/js/dist/tooltip.js\n\n\nfunction bruh_moment(){\n\talert('this is a bruh moment')\n}\n\nconst downloadToFile = (content, filename, contentType) => {\n const a = document.createElement('a');\n const file = new Blob([content], {type: contentType});\n \n a.href= URL.createObjectURL(file);\n a.download = filename;\n a.click();\n\n\tURL.revokeObjectURL(a.href);\n};\n\nfunction get_smiles_from_element_text(el_id){\n\tvar inputVal = document.getElementById(el_id).value;\n\tlet url = `https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${inputVal}/property/CanonicalSMILES/JSON`;\n\tconsole.log(url)\n\tfetch(url)\n\t.then(res => res.json())\n\t.then((out) => {\n\t console.log('Aye, got that dub from PubChem');\n\t //console.log(out[\"PropertyTable\"][\"Properties\"][0][\"CanonicalSMILES\"])\n\t document.getElementById(\"inputSMILES\").value = out[\"PropertyTable\"][\"Properties\"][0][\"CanonicalSMILES\"]\n\t})\n\t.catch(err => { \n\t\tbruh_moment()\n\t\tthrow err });\n}\n\n\n\nfunction draw_me_like_one_of_your_french_girls(mol){\n\t\n\tmol.condense_abbreviations();\n\t//var canvas = document.getElementById(\"draw-canvas-2\");\n\t//mol.draw_to_canvas(canvas, -1, -1);\n\tvar dest = document.getElementById(\"draw-output\");\n\tvar svg = mol.get_svg();\n\tdest.outerHTML = \"<div id='drawing-1'>\" + svg + \"</div>\";\n\tdocument.getElementById('drawing-1').children[0].setAttribute(\"height\", \"100%\");\n\tdocument.getElementById('drawing-1').children[0].setAttribute(\"width\", \"100%\");\n}\n\n\nfunction calculate_and_disperse(mol){\n\tconst shy_values_do_not_show = [\"NumUnspecifiedAtomStereoCenters\",\"NumAliphaticHeterocycles\",\n\t\"NumSaturatedHeterocycles\",\"NumAromaticHeterocycles\",\"NumAmideBonds\",\"NumAromaticRings\",\"NumAliphaticRings\"\n\t,\"NumSaturatedRings\",\"NumSpiroAtoms\",\"NumBridgeheadAtoms\",\"NumAtomStereoCenters\"]\n\ttry {\n\t\tvar descrs = JSON.parse(mol.get_descriptors());\n\t} catch(err) {\n\t\talert(\"oo wee, failed to calculate descriptors senpai\")\n\t}\n\t//document.getElementById('exactmw').textContent = descrs[\"exactmw\"];\n\t//document.getElementById('CrippenMR').textContent = descrs[\"CrippenMR\"];\n\t//document.getElementById('CrippenClogP').textContent = descrs[\"CrippenClogP\"];\n\tlet tableRef = document.getElementById(\"analyse_table\");\n\tconst keys = Object.keys(descrs);\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key = keys[i];\n\t\t\tif(shy_values_do_not_show.indexOf(key) !== -1){\n \t\t//console.log(\"skipping\")\n \t\t} else{\n\t\t\t\t//console.log(key, descrs[key]);\n\t\t\t\tvar newRow = tableRef.insertRow(-1);\n\t\t\t \tvar newCell_label = newRow.insertCell(0);\n\t\t\t \tvar newCell_value = newRow.insertCell(-1);\n\t\t\t \tvar newText_label = document.createTextNode(key);\n\t\t\t \tvar newText_value = document.createTextNode(descrs[key]);\n\t\t\t \tnewCell_label.appendChild(newText_label);\n\t\t\t \tnewCell_value.appendChild(newText_value);\n\t\t\t}\n\t\t}\n\t\n}\n\nfunction convert_me_senpai(smiles) {\n\tvar OpenBabel = OpenBabelModule();\n\tOpenBabel.onRuntimeInitialized = function() {\n\t\tvar conv = new OpenBabel.ObConversionWrapper();\n\t\ttry {\n\t\t\tvar inData = smiles; \n\t\t\tconv.setInFormat('', 'smiles'); \n\t\t\tvar mol = new OpenBabel.OBMol();\n\t\t\tconv.readStri
|