Created
November 29, 2014 11:36
-
-
Save Carreau/682b52d75dacc5ab4fbb to your computer and use it in GitHub Desktop.
This file contains 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
// Add help panel at right side of notebook window | |
"using strict"; | |
var help_panel_extension = (function() { | |
toggleHelpPanel = function () { | |
/* check if help panel is already there */ | |
var link = $('<a/>').text('clickme') | |
link.on('click', function(){IPython.notebook.kernel.execute( | |
'"Hi there"', | |
{ | |
shell : { | |
reply : function(data){console.log('reply',data.content)}, | |
payload : { | |
set_next_input : function(data){console.log('sni',data)}, | |
page : function(data){console.log('page',data)}, | |
} | |
}, | |
iopub : { | |
output : function(data){$("#helpPanel").append(data.content.data['text/plain']); console.log('output',data.content)}, | |
clear_output : function(data){console.log('cloup',data)}, | |
}, | |
input : function(data){console.log('rawin',data)} | |
} | |
, {silent: false, store_history: true})}) | |
var a= $("#helpPanel").html(); | |
if ( a == undefined ) { | |
$("#notebook_panel").css({"float": "left","overflow-x": "hidden","height": "100%","width": "70%","font-size": "9pt"}); | |
var helppanel = '<div id="helpPanel"></div>'; | |
$("#ipython-main-app").append(helppanel); | |
$('#helpPanel').append(link); | |
} | |
else { | |
$("#notebook_panel").css({"width": "100%"}); | |
$('#helpPanel').remove(); | |
} | |
}; | |
IPython.toolbar.add_buttons_group([ | |
{ | |
id : 'help_panel', | |
label : 'Show help panel', | |
icon : 'icon-book fa fa-book', | |
callback : toggleHelpPanel | |
} | |
]); | |
var scripts = document.getElementsByTagName("script"); | |
var scriptLocation = scripts[scripts.length - 1].src; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment