mirror of
https://github.com/wassname/jupyter_contrib_nbextensions.git
synced 2026-06-27 16:10:24 +08:00
[various] ensure actions have names and prefixes, and buttons keep correct ids
This commit is contained in:
@@ -9,7 +9,7 @@ define([
|
||||
|
||||
var load_extension = function() {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'Insert Cell Above',
|
||||
'icon' : 'fa-arrow-circle-o-up',
|
||||
'handler': function () {
|
||||
@@ -17,8 +17,8 @@ define([
|
||||
Jupyter.notebook.select_prev();
|
||||
Jupyter.notebook.focus_cell();
|
||||
}
|
||||
}),
|
||||
Jupyter.actions.register ({
|
||||
}, 'insert-cell-above', 'addbefore'),
|
||||
Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'Insert Cell Below',
|
||||
'icon' : 'fa-arrow-circle-o-down',
|
||||
'handler': function () {
|
||||
@@ -26,7 +26,7 @@ define([
|
||||
Jupyter.notebook.select_next();
|
||||
Jupyter.notebook.focus_cell();
|
||||
}
|
||||
})
|
||||
}, 'insert-cell-below', 'addbefore'),
|
||||
]);
|
||||
$('#insert_above_below').remove()
|
||||
|
||||
|
||||
@@ -47,20 +47,20 @@ define([
|
||||
/*
|
||||
* Buttons to increase/decrease code font size
|
||||
*/
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'Increase code font size',
|
||||
'icon' : 'fa-search-plus',
|
||||
'handler': function () {
|
||||
$( document ).ready(code_change_fontsize(true));
|
||||
}
|
||||
}),
|
||||
Jupyter.actions.register ({
|
||||
}, 'increase-code-font-size', 'code_font_size'),
|
||||
Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'Decrease code font size',
|
||||
'icon' : 'fa-search-minus',
|
||||
'handler': function () {
|
||||
$( document ).ready(code_change_fontsize(false));
|
||||
}
|
||||
})
|
||||
}, 'decrease-code-font-size', 'code_font_size'),
|
||||
|
||||
]);
|
||||
};
|
||||
|
||||
@@ -736,6 +736,39 @@
|
||||
'uncollapse_all_headings', mod_name
|
||||
);
|
||||
|
||||
action_names.toggle = Jupyter.keyboard_manager.actions.register ({
|
||||
handler: function () {
|
||||
var heading_cell = find_header_cell(Jupyter.notebook.get_selected_cell(), function (cell) {
|
||||
return cell.element.is(':visible') && !_is_collapsed(cell);
|
||||
});
|
||||
if (is_heading(heading_cell)) {
|
||||
toggle_heading(heading_cell, true);
|
||||
Jupyter.notebook.select(Jupyter.notebook.find_cell_index(heading_cell));
|
||||
}
|
||||
},
|
||||
help : "Toggle closest heading's collapsed status",
|
||||
icon : 'fa-angle-double-up',
|
||||
},
|
||||
'toggle_collapse_heading', mod_name
|
||||
);
|
||||
|
||||
action_names.toggle_all = Jupyter.keyboard_manager.actions.register ({
|
||||
handler: function () {
|
||||
var cells = Jupyter.notebook.get_cells();
|
||||
for (var ii = 0; ii < cells.length; ii++) {
|
||||
if (is_heading(cells[ii])) {
|
||||
Jupyter.keyboard_manager.actions.call(action_names[
|
||||
is_collapsed_heading(cells[ii]) ? 'uncollapse_all' : 'collapse_all']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
help : 'Collapse/uncollapse all headings based on the status of the first',
|
||||
icon : 'fa-angle-double-up',
|
||||
},
|
||||
'toggle_collapse_all_headings', mod_name
|
||||
);
|
||||
|
||||
action_names.select = Jupyter.keyboard_manager.actions.register({
|
||||
handler : function (env) {
|
||||
var cell = env.notebook.get_selected_cell();
|
||||
@@ -834,46 +867,10 @@
|
||||
function add_buttons_and_shortcuts () {
|
||||
// (Maybe) add buttons to the toolbar
|
||||
if (params.add_button) {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
help : 'toggle heading',
|
||||
icon : 'fa-angle-double-up',
|
||||
handler: function () {
|
||||
/**
|
||||
* Collapse the closest uncollapsed heading above the
|
||||
* currently selected cell.
|
||||
*/
|
||||
var heading_cell = find_header_cell(Jupyter.notebook.get_selected_cell(), function (cell) {
|
||||
return cell.element.is(':visible') && !_is_collapsed(cell);
|
||||
});
|
||||
if (is_heading(heading_cell)) {
|
||||
toggle_heading(heading_cell, true);
|
||||
Jupyter.notebook.select(Jupyter.notebook.find_cell_index(heading_cell));
|
||||
}
|
||||
}
|
||||
})
|
||||
]);
|
||||
Jupyter.toolbar.add_buttons_group([action_names.toggle]);
|
||||
}
|
||||
if (params.add_all_cells_button) {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
help : 'toggle all headings',
|
||||
icon : 'fa-angle-double-up',
|
||||
handler: function () {
|
||||
/**
|
||||
* Collapse/uncollapse all heading cells based on status of first
|
||||
*/
|
||||
var cells = Jupyter.notebook.get_cells();
|
||||
for (var ii = 0; ii < cells.length; ii++) {
|
||||
if (is_heading(cells[ii])) {
|
||||
Jupyter.keyboard_manager.actions.call(action_names[
|
||||
is_collapsed_heading(cells[ii]) ? 'uncollapse_all' : 'collapse_all']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
]);
|
||||
Jupyter.toolbar.add_buttons_group([action_names.toggle_all]);
|
||||
}
|
||||
if (params.add_insert_header_buttons) {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
|
||||
@@ -26,13 +26,14 @@ define([
|
||||
};
|
||||
|
||||
var load_ipython_extension = function () {
|
||||
IPython.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
IPython.toolbar.add_buttons_group([{
|
||||
id: 'datestamp',
|
||||
action: IPython.keyboard_manager.actions.register ({
|
||||
help : 'insert datestamp',
|
||||
icon : 'fa-calendar',
|
||||
handler: datestamp
|
||||
}, 'datestamp')
|
||||
]);
|
||||
}, 'insert-datestamp', 'datestamp')
|
||||
}]);
|
||||
};
|
||||
|
||||
var extension = {
|
||||
|
||||
@@ -7,12 +7,15 @@ define([
|
||||
'require',
|
||||
'notebook/js/textcell',
|
||||
'base/js/utils',
|
||||
], function(IPython, $, require, textcell, utils) {
|
||||
], function(Jupyter, $, require, textcell, utils) {
|
||||
"use strict";
|
||||
|
||||
var MathJax = window.MathJax;
|
||||
|
||||
var load_ipython_extension = function() {
|
||||
IPython.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'reset_numbering',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
help : 'Reset equation numbering',
|
||||
icon : 'fa-sort-numeric-asc',
|
||||
handler: function () {
|
||||
@@ -23,8 +26,8 @@ define([
|
||||
);
|
||||
$('#reset_numbering').blur();
|
||||
}
|
||||
}, 'reset_numbering')
|
||||
]);
|
||||
}, 'reset-numbering', 'equation_numbering')
|
||||
}]);
|
||||
MathJax.Hub.Config({
|
||||
TeX: { equationNumbers: { autoNumber: "AMS" } }
|
||||
});
|
||||
|
||||
@@ -131,16 +131,17 @@ define([
|
||||
}
|
||||
|
||||
function load_ipython_extension(){
|
||||
IPython.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
IPython.toolbar.add_buttons_group([{
|
||||
id: 'hide_solutions',
|
||||
action: IPython.keyboard_manager.actions.register ({
|
||||
help : 'Exercise: Create/Remove solutions',
|
||||
icon : 'fa-mortar-board',
|
||||
handler : function () {
|
||||
//console.log(IPython.notebook.get_selected_cells())
|
||||
hide_solutions();
|
||||
}
|
||||
}, 'hide_solutions')
|
||||
]);
|
||||
}, 'hide_solutions', 'exercise')
|
||||
}]);
|
||||
|
||||
/**
|
||||
* load css file and append to document
|
||||
|
||||
@@ -127,15 +127,16 @@ id=\"myCheck' + cbx + '\" >\
|
||||
}
|
||||
|
||||
function load_ipython_extension(){
|
||||
IPython.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
IPython.toolbar.add_buttons_group([{
|
||||
id: 'process_solution',
|
||||
action: IPython.keyboard_manager.actions.register ({
|
||||
help : 'Exercise2: Create/Remove solution',
|
||||
icon : 'fa-toggle-on',
|
||||
handler : function () {
|
||||
process_solution();
|
||||
}
|
||||
}, 'process_solution')
|
||||
]);
|
||||
}, 'process_solution', 'exercise2')
|
||||
}]);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,15 +33,16 @@ define([
|
||||
|
||||
/* Add also a Button, currently disabled */
|
||||
/*
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
help : 'Embedded HTML Export',
|
||||
icon : 'fa-save',
|
||||
handler: function() {
|
||||
Jupyter.menubar._nbconvert('html_embed', true);
|
||||
}
|
||||
}, 'export_embeddedhtml')
|
||||
]);
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'export_embeddedhtml',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
help : 'Embedded HTML Export',
|
||||
icon : 'fa-save',
|
||||
handler: function() {
|
||||
Jupyter.menubar._nbconvert('html_embed', true);
|
||||
}
|
||||
}, 'export-embedded-html', 'export_embedded')
|
||||
}]);
|
||||
*/
|
||||
if (Jupyter.notebook !== undefined && Jupyter.notebook._fully_loaded) {
|
||||
// notebook_loaded.Notebook event has already happened
|
||||
|
||||
@@ -160,23 +160,28 @@ define([
|
||||
}
|
||||
|
||||
function load_extension () {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'make_normal',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
help : 'lift restrictions from selected cells',
|
||||
icon : 'fa-unlock-alt',
|
||||
handler : make_normal_selected
|
||||
},'make_normal'),
|
||||
Jupyter.actions.register({
|
||||
}, 'make-cells-normal', mod_name)
|
||||
}, {
|
||||
id: 'make_read_only',
|
||||
action: Jupyter.keyboard_manager.actions.register({
|
||||
help : 'make selected cells read-only',
|
||||
icon: 'fa-lock',
|
||||
handler : make_read_only_selected
|
||||
},'make_read_only'),
|
||||
Jupyter.actions.register({
|
||||
}, 'make-cells-read-only', mod_name),
|
||||
}, {
|
||||
id: 'freeze_cells',
|
||||
action: Jupyter.keyboard_manager.actions.register({
|
||||
help : 'freeze selected cells',
|
||||
icon : 'fa-asterisk',
|
||||
handler : make_frozen_selected
|
||||
},'freeze_cells')
|
||||
]);
|
||||
}, 'freeze-cells', mod_name)
|
||||
}]);
|
||||
|
||||
patch_CodeCell_execute();
|
||||
patch_MarkdownCell_unrender();
|
||||
|
||||
@@ -44,11 +44,11 @@ define([
|
||||
var initialize = function () {
|
||||
update_params();
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
help : 'Create/Edit Gist of Notebook',
|
||||
Jupyter.keyboard_manager.actions.register ({
|
||||
help : 'Create/Edit Gist of Notebook',
|
||||
icon : 'fa-github',
|
||||
handler: show_gist_editor_modal
|
||||
})
|
||||
}, 'create-gist-from-notebook', 'gist_it')
|
||||
]);
|
||||
};
|
||||
|
||||
|
||||
@@ -53,8 +53,9 @@ define([
|
||||
var initialize = function () {
|
||||
update_params();
|
||||
if (params.help_panel_add_toolbar_button) {
|
||||
IPython.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
IPython.toolbar.add_buttons_group([{
|
||||
id: 'btn_help_panel',
|
||||
action: IPython.keyboard_manager.actions.register({
|
||||
help : 'Show help panel',
|
||||
icon : 'fa-book',
|
||||
handler: function() {
|
||||
@@ -62,8 +63,8 @@ define([
|
||||
var btn = $(this);
|
||||
setTimeout(function() { btn.blur(); }, 500);
|
||||
}
|
||||
}, 'btn_help_panel')
|
||||
]);
|
||||
}, 'show-help-panel', 'help_panel'),
|
||||
}]);
|
||||
$('#btn_help_panel').attr({
|
||||
'data-toggle': 'button',
|
||||
'aria-pressed': 'false'
|
||||
|
||||
@@ -44,7 +44,7 @@ define([
|
||||
var prefix = 'hide_header';
|
||||
var action_name = 'toggle';
|
||||
|
||||
var full_action_name = Jupyter.actions.register(action, action_name, prefix);
|
||||
var full_action_name = Jupyter.keyboard_manager.actions.register(action, action_name, prefix);
|
||||
|
||||
// define keyboard shortcuts
|
||||
var shortcuts = {};
|
||||
|
||||
@@ -30,16 +30,17 @@ define([
|
||||
var load_ipython_extension = function() {
|
||||
|
||||
// Add a button to the toolbar
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'btn-hide-input',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
help : 'Toggle selected cell input display',
|
||||
icon : 'fa-chevron-up',
|
||||
handler: function() {
|
||||
toggle_selected_input();
|
||||
setTimeout(function() { $('#btn-hide-input').blur(); }, 500);
|
||||
}
|
||||
}, 'btn-hide-input')
|
||||
]);
|
||||
}, 'toggle-cell-input-display', 'hide_input')
|
||||
}]);
|
||||
// Collapse all cells that are marked as hidden
|
||||
if (Jupyter.notebook !== undefined && Jupyter.notebook._fully_loaded) {
|
||||
// notebook already loaded. Update directly
|
||||
|
||||
@@ -36,16 +36,17 @@ define([
|
||||
}
|
||||
|
||||
var load_ipython_extension = function() {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'toggle_codecells',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
help : 'Hide codecell inputs',
|
||||
icon : 'fa-eye',
|
||||
handler: function() {
|
||||
toggle();
|
||||
setTimeout(function() { $('#toggle_codecells').blur(); }, 500);
|
||||
}
|
||||
}, 'toggle_codecells')
|
||||
]);
|
||||
}, 'hide-codecell-inputs', 'hide_input_all'),
|
||||
}]);
|
||||
if (Jupyter.notebook !== undefined && Jupyter.notebook._fully_loaded) {
|
||||
// notebook_loaded.Notebook event has already happened
|
||||
initialize();
|
||||
|
||||
@@ -60,17 +60,20 @@ define(function(require, exports, module) {
|
||||
function showToolbar() {
|
||||
if ($('#showToolbar').length == 0) {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
'help' : 'Translate current cell',
|
||||
'icon' : 'fa-language',
|
||||
'handler': translateCurrentCell,
|
||||
}, 'showToolbar'),
|
||||
Jupyter.actions.register ({
|
||||
'help' : 'nbTranslate: Configuration (toggle toolbar)',
|
||||
'icon' : 'fa-wrench',
|
||||
'handler': translateToolbarToggle //translateToolbar
|
||||
})
|
||||
]);
|
||||
{
|
||||
id: 'showToolbar',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'Translate current cell',
|
||||
'icon' : 'fa-language',
|
||||
'handler': translateCurrentCell,
|
||||
}, 'translate-cell', 'nbTranslate'),
|
||||
},
|
||||
Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'nbTranslate: Configuration (toggle toolbar)',
|
||||
'icon' : 'fa-wrench',
|
||||
'handler': translateToolbarToggle //translateToolbar
|
||||
}, 'show-nbTranslate-toolbar', 'nbTranslate'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,13 +64,14 @@ define([
|
||||
|
||||
var add_permissions_button = function () {
|
||||
if ($("#permissions-button").length === 0) {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'permissions-button',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'Grant Notification Permissions',
|
||||
'icon' : 'fa-check',
|
||||
'handler': ask_permission,
|
||||
},'permissions-button')
|
||||
]);
|
||||
},'grant-notifications-permission', 'notify')
|
||||
}]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -59,13 +59,14 @@ define([
|
||||
};
|
||||
|
||||
var load_ipython_extension = function() {
|
||||
IPython.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
IPython.toolbar.add_buttons_group([{
|
||||
id: 'doPrintView',
|
||||
action: IPython.keyboard_manager.actions.register ({
|
||||
help : 'Create static print view',
|
||||
icon : 'fa-print',
|
||||
handler: nbconvertPrintView
|
||||
}, 'doPrintView')
|
||||
]);
|
||||
}, 'create-static-printview', 'printview'),
|
||||
}]);
|
||||
return IPython.notebook.config.loaded.then(initialize);
|
||||
};
|
||||
|
||||
|
||||
@@ -5,18 +5,19 @@ define([
|
||||
'base/js/events'
|
||||
], function(Jupyter, events) {
|
||||
var load_ipython_extension = function () {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
/**
|
||||
* Button to launch QTConsole
|
||||
*/
|
||||
Jupyter.actions.register ({
|
||||
id: 'qtconsole',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'Run QTConsole',
|
||||
'icon' : 'fa-terminal',
|
||||
'handler': function () {
|
||||
Jupyter.notebook.kernel.execute('%qtconsole')
|
||||
}
|
||||
}, 'qtconsole')
|
||||
]);
|
||||
}, 'run-qtconsole', 'qtconsole')
|
||||
}]);
|
||||
};
|
||||
return {
|
||||
load_ipython_extension : load_ipython_extension
|
||||
|
||||
@@ -77,13 +77,14 @@ define([
|
||||
add_gutter_events();
|
||||
|
||||
/* Add run control buttons to toolbar */
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'toggle_runtools',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
help: 'Toggle Runtools Toolbar',
|
||||
icon: 'fa-cogs',
|
||||
handler: toggle_toolbar
|
||||
}, 'toggle_runtools')
|
||||
]);
|
||||
}, 'toggle-runtools-toolbar', 'runtools')
|
||||
}]);
|
||||
$("#toggle_runtools").css({
|
||||
'outline': 'none'
|
||||
});
|
||||
|
||||
@@ -28,13 +28,14 @@ define([
|
||||
}
|
||||
|
||||
function load_extension() {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'toggle_scroll_down',
|
||||
action: Jupyter.keyboard_manager.actions.register({
|
||||
help : 'toggle automatic scrolling down',
|
||||
icon : 'fa-angle-double-down ',
|
||||
handler: toggleScrollDown
|
||||
}, 'toggle_scroll_down')
|
||||
]);
|
||||
}, 'toggle-auto-scroll-down', 'scroll_down')
|
||||
}]);
|
||||
|
||||
console.log("[ScrollDown] is loaded");
|
||||
|
||||
|
||||
@@ -148,18 +148,19 @@ define([
|
||||
* Add a button to the jupyter toolbar for toggling spellcheck overlay
|
||||
*/
|
||||
function add_toolbar_buttons () {
|
||||
return Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
help : 'Toggle spell checking on markdown cells',
|
||||
icon : 'fa-check',
|
||||
handler: function (evt) {
|
||||
toggle_spellcheck();
|
||||
setTimeout(function () {
|
||||
evt.currentTarget.blur();
|
||||
}, 100);
|
||||
}
|
||||
}, 'spellchecker_btn')
|
||||
]);
|
||||
return Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'spellchecker_btn',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
help : 'Toggle spell checking on markdown cells',
|
||||
icon : 'fa-check',
|
||||
handler: function (evt) {
|
||||
toggle_spellcheck();
|
||||
setTimeout(function () {
|
||||
evt.currentTarget.blur();
|
||||
}, 100);
|
||||
}
|
||||
}, 'toggle-spellchecking', 'spellchecker')
|
||||
}]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -125,13 +125,14 @@ define([
|
||||
return;
|
||||
}
|
||||
if ($("#toc_button").length === 0) {
|
||||
IPython.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
IPython.toolbar.add_buttons_group([{
|
||||
id: 'toc_button',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'Table of Contents',
|
||||
'icon' : 'fa-list',
|
||||
'handler': toggleToc,
|
||||
}, 'toc_button')
|
||||
]);
|
||||
}, 'toggle-toc', 'toc2')
|
||||
}]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -100,13 +100,14 @@ define([
|
||||
return;
|
||||
}
|
||||
if ($("#varInspector_button").length === 0) {
|
||||
Jupyter.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
Jupyter.toolbar.add_buttons_group([{
|
||||
id: 'varInspector_button',
|
||||
action: Jupyter.keyboard_manager.actions.register ({
|
||||
'help' : 'Variable Inspector',
|
||||
'icon' : 'fa-crosshairs',
|
||||
'handler': toggleVarInspector,
|
||||
}, 'varInspector_button')
|
||||
]);
|
||||
}, 'toggle-variable-inspector', 'varInspector')
|
||||
}]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -161,9 +161,10 @@ define([
|
||||
};
|
||||
|
||||
var load_ipython_extension = function(background) {
|
||||
IPython.toolbar.add_buttons_group([
|
||||
Jupyter.actions.register ({
|
||||
'help' : 'Enter/Exit Zenmode',
|
||||
IPython.toolbar.add_buttons_group([{
|
||||
id: 'zenmode-toggle-btn',
|
||||
action: IPython.keyboard_manager.actions.register({
|
||||
'help' : 'Enter/Exit Zenmode',
|
||||
'icon' : 'fa-empire',
|
||||
'handler': function() {
|
||||
toggleZenMode(background);
|
||||
@@ -171,9 +172,8 @@ define([
|
||||
$('#zenmode-toggle-btn').blur();
|
||||
}, 500);
|
||||
},
|
||||
}, 'zenmode-toggle-btn')],
|
||||
'zenmode-btn-grp'
|
||||
);
|
||||
}, 'toggle-zenmode', 'zenmode'),
|
||||
}], 'zenmode-btn-grp');
|
||||
$("#maintoolbar-container").prepend($('#zenmode-btn-grp'));
|
||||
return IPython.notebook.config.loaded.then(initialize);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user