Last active
December 26, 2016 04:38
-
-
Save westonplatter/cbf981f87dc94d3ab5d7fae0babf9779 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # only include once in the python notebook file | |
| # | |
| js = """ | |
| <script> | |
| function removeTabs($tabs, matchPharse) { | |
| $.each($tabs, function(index, element){ | |
| var links = $(element).find('li a'); | |
| $.each(links, function(ii, ee){ | |
| $(ee).remove(); | |
| }); | |
| }); | |
| } | |
| function removeSVGs($parent) { | |
| var $sibs = $parent.siblings('.widget-box'); | |
| $sibs.remove(); | |
| } | |
| $(document).ready( function() { | |
| // $(document).on('click', '.jupyter-widgets.widget-button.btn.btn-default', function(e){ | |
| // var buttonText = $(e.target).text(); | |
| // var $tabs = $(e.target).siblings().find('div.nav.nav-tabs'); | |
| // if(buttonText == 'Show builder') { | |
| // setTimeout(function(){ removeTabs($tabs, 'write_strings'); }, 10); | |
| // var $parent = $(e.target); | |
| // removeSVGs($parent); | |
| // } | |
| // if(buttonText == 'Calculate orbitals') { | |
| // setTimeout(function(){ removeTabs($tabs, 'write_strings'); }, 10); | |
| // } | |
| // if(buttonText == 'Build orbitals') { | |
| // setTimeout(function(){ removeTabs($tabs, 'write_strings'); }, 10); | |
| // } | |
| // }); | |
| $(document).on('keyup', '.jupyter-widgets.widget-hbox.widget-text input', function(e){ | |
| if(e.keyCode == 13) { | |
| // find and remove molecular groups/SVGs | |
| var $input = $(e.target); | |
| var $parent = $($input).closest('.jupyter-widgets.widget-hbox.widget-text'); | |
| removeSVGs($parent); | |
| // find and remove the, 'from_smiles' and 'write_string' tabs | |
| var $tabs = $parent.siblings().find('div.nav.nav-tabs'); | |
| // | |
| // this is hacky, so here's what's going on, | |
| // | |
| setTimeout(function(){ removeTabs($tabs, 'write_strings'); }, 10); | |
| setTimeout(function(){ removeTabs($tabs, 'from_strings'); }, 10); | |
| } | |
| }) | |
| }); | |
| </script>""" | |
| display(HTML(js)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment