mirror of
https://github.com/wassname/jupyter_contrib_nbextensions.git
synced 2026-06-27 16:10:24 +08:00
31 lines
791 B
JavaScript
31 lines
791 B
JavaScript
var clean_restart = function(){
|
|
IPython.notebook.clear_all_output();
|
|
IPython.notebook.kernel.restart();
|
|
}
|
|
|
|
var confirm_dialog = function(){
|
|
var dialog = $('<div/>');
|
|
dialog.html('This will clear all output and restart the kernel, do you want to continue?');
|
|
dialog.dialog({
|
|
resizable: false,
|
|
modal: true,
|
|
title: 'Clear All',
|
|
buttons: {
|
|
"Reset All": function() {
|
|
clean_restart();
|
|
$( this ).dialog( "close" );
|
|
},
|
|
Cancel: function() {
|
|
$( this ).dialog( "close" );
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
IPython.toolbar.add_buttons_group([{
|
|
label:'clear all, and restart',
|
|
icon:'fa-chevron-circle-down',
|
|
callback:confirm_dialog,
|
|
}])
|
|
console.log('loading clear and restart extension ok');
|