Skip to content

Commit a993df3

Browse files
committed
Merge branch 'master' of https://github.com/Sukneet/jupyter_contrib_nbextensions into Sukneet-master
2 parents 59b98a4 + b7aa1bd commit a993df3

File tree

22 files changed

+173
-170
lines changed

22 files changed

+173
-170
lines changed

src/jupyter_contrib_nbextensions/nbextensions/addbefore/main.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ define([
99

1010
var load_extension = function() {
1111
Jupyter.toolbar.add_buttons_group([
12-
{
13-
'label' : 'Insert Cell Above',
14-
'icon' : 'fa-arrow-circle-o-up',
15-
'callback': function () {
12+
Jupyter.actions.register ({
13+
'help' : 'Insert Cell Above',
14+
'icon' : 'fa-arrow-circle-o-up',
15+
'handler': function () {
1616
Jupyter.notebook.insert_cell_above('code');
1717
Jupyter.notebook.select_prev();
1818
Jupyter.notebook.focus_cell();
1919
}
20-
},
21-
{
22-
'label' : 'Insert Cell Below',
23-
'icon' : 'fa-arrow-circle-o-down',
24-
'callback': function () {
20+
}),
21+
Jupyter.actions.register ({
22+
'help' : 'Insert Cell Below',
23+
'icon' : 'fa-arrow-circle-o-down',
24+
'handler': function () {
2525
Jupyter.notebook.insert_cell_below('code');
2626
Jupyter.notebook.select_next();
2727
Jupyter.notebook.focus_cell();
2828
}
29-
}
29+
})
3030
]);
3131
$('#insert_above_below').remove()
3232

src/jupyter_contrib_nbextensions/nbextensions/code_font_size/code_font_size.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,20 @@ define([
4747
/*
4848
* Buttons to increase/decrease code font size
4949
*/
50-
{
51-
'label' : 'Increase code font size',
52-
'icon' : 'fa-search-plus',
53-
'callback': function () {
50+
Jupyter.actions.register ({
51+
'help' : 'Increase code font size',
52+
'icon' : 'fa-search-plus',
53+
'handler': function () {
5454
$( document ).ready(code_change_fontsize(true));
5555
}
56-
},
57-
{
58-
'label' : 'Decrease code font size',
59-
'icon' : 'fa-search-minus',
60-
'callback': function () {
56+
}),
57+
Jupyter.actions.register ({
58+
'help' : 'Decrease code font size',
59+
'icon' : 'fa-search-minus',
60+
'handler': function () {
6161
$( document ).ready(code_change_fontsize(false));
6262
}
63-
}
63+
})
6464

6565
]);
6666
};

src/jupyter_contrib_nbextensions/nbextensions/collapsible_headings/main.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,11 @@
834834
function add_buttons_and_shortcuts () {
835835
// (Maybe) add buttons to the toolbar
836836
if (params.add_button) {
837-
Jupyter.toolbar.add_buttons_group([{
838-
label: 'toggle heading',
839-
icon: 'fa-angle-double-up',
840-
callback: function () {
837+
Jupyter.toolbar.add_buttons_group([
838+
Jupyter.actions.register ({
839+
help : 'toggle heading',
840+
icon : 'fa-angle-double-up',
841+
handler: function () {
841842
/**
842843
* Collapse the closest uncollapsed heading above the
843844
* currently selected cell.
@@ -850,13 +851,15 @@
850851
Jupyter.notebook.select(Jupyter.notebook.find_cell_index(heading_cell));
851852
}
852853
}
853-
}]);
854+
})
855+
]);
854856
}
855857
if (params.add_all_cells_button) {
856-
Jupyter.toolbar.add_buttons_group([{
857-
label: 'toggle all headings',
858-
icon: 'fa-angle-double-up',
859-
callback: function () {
858+
Jupyter.toolbar.add_buttons_group([
859+
Jupyter.actions.register ({
860+
help : 'toggle all headings',
861+
icon : 'fa-angle-double-up',
862+
handler: function () {
860863
/**
861864
* Collapse/uncollapse all heading cells based on status of first
862865
*/
@@ -869,7 +872,8 @@
869872
}
870873
}
871874
}
872-
}]);
875+
})
876+
]);
873877
}
874878
if (params.add_insert_header_buttons) {
875879
Jupyter.toolbar.add_buttons_group([

src/jupyter_contrib_nbextensions/nbextensions/datestamper/main.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@ define([
2727

2828
var load_ipython_extension = function () {
2929
IPython.toolbar.add_buttons_group([
30-
{
31-
id : 'datestamp',
32-
label : 'insert datestamp',
33-
icon : 'fa-calendar',
34-
callback : datestamp
35-
}
30+
Jupyter.actions.register ({
31+
help : 'insert datestamp',
32+
icon : 'fa-calendar',
33+
handler: datestamp
34+
}, 'datestamp')
3635
]);
3736
};
3837

3938
var extension = {
4039
load_ipython_extension : load_ipython_extension,
4140
};
4241
return extension;
43-
});
42+
});

src/jupyter_contrib_nbextensions/nbextensions/equation-numbering/main.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@ define([
1212

1313
var load_ipython_extension = function() {
1414
IPython.toolbar.add_buttons_group([
15-
{
16-
id: 'reset_numbering',
17-
label: 'Reset equation numbering',
18-
icon: 'fa-sort-numeric-asc',
19-
callback: function () {
15+
Jupyter.actions.register ({
16+
help : 'Reset equation numbering',
17+
icon : 'fa-sort-numeric-asc',
18+
handler: function () {
2019
MathJax.Hub.Queue(
2120
["resetEquationNumbers", MathJax.InputJax.TeX],
2221
["PreProcess", MathJax.Hub],
2322
["Reprocess", MathJax.Hub]
2423
);
2524
$('#reset_numbering').blur();
2625
}
27-
}
26+
}, 'reset_numbering')
2827
]);
2928
MathJax.Hub.Config({
3029
TeX: { equationNumbers: { autoNumber: "AMS" } }

src/jupyter_contrib_nbextensions/nbextensions/exercise/main.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,14 @@ define([
132132

133133
function load_ipython_extension(){
134134
IPython.toolbar.add_buttons_group([
135-
{
136-
id : 'hide_solutions',
137-
label : 'Exercise: Create/Remove solutions',
138-
icon : 'fa-mortar-board',
139-
callback : function () {
135+
Jupyter.actions.register ({
136+
help : 'Exercise: Create/Remove solutions',
137+
icon : 'fa-mortar-board',
138+
handler : function () {
140139
//console.log(IPython.notebook.get_selected_cells())
141140
hide_solutions();
142141
}
143-
}
142+
}, 'hide_solutions')
144143
]);
145144

146145
/**

src/jupyter_contrib_nbextensions/nbextensions/exercise2/main.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,13 @@ id=\"myCheck' + cbx + '\" >\
128128

129129
function load_ipython_extension(){
130130
IPython.toolbar.add_buttons_group([
131-
{
132-
id : 'process_solution',
133-
label : 'Exercise2: Create/Remove solution',
134-
icon : 'fa-toggle-on',
135-
callback : function () {
131+
Jupyter.actions.register ({
132+
help : 'Exercise2: Create/Remove solution',
133+
icon : 'fa-toggle-on',
134+
handler : function () {
136135
process_solution();
137136
}
138-
}
137+
}, 'process_solution')
139138
]);
140139

141140

src/jupyter_contrib_nbextensions/nbextensions/export_embedded/main.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ define([
3333

3434
/* Add also a Button, currently disabled */
3535
/*
36-
Jupyter.toolbar.add_buttons_group([{
37-
id : 'export_embeddedhtml',
38-
label : 'Embedded HTML Export',
39-
icon : 'fa-save',
40-
callback : function() {
41-
Jupyter.menubar._nbconvert('html_embed', true);
42-
}
43-
}]);
36+
Jupyter.toolbar.add_buttons_group([
37+
Jupyter.actions.register ({
38+
help : 'Embedded HTML Export',
39+
icon : 'fa-save',
40+
handler: function() {
41+
Jupyter.menubar._nbconvert('html_embed', true);
42+
}
43+
}, 'export_embeddedhtml')
44+
]);
4445
*/
4546
if (Jupyter.notebook !== undefined && Jupyter.notebook._fully_loaded) {
4647
// notebook_loaded.Notebook event has already happened

src/jupyter_contrib_nbextensions/nbextensions/freeze/main.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,24 +161,21 @@ define([
161161

162162
function load_extension () {
163163
Jupyter.toolbar.add_buttons_group([
164-
{
165-
id : 'make_normal',
166-
label : 'lift restrictions from selected cells',
164+
Jupyter.actions.register ({
165+
help : 'lift restrictions from selected cells',
167166
icon : 'fa-unlock-alt',
168-
callback : make_normal_selected
169-
},
170-
{
171-
id : 'make_read_only',
172-
label : 'make selected cells read-only',
167+
handler : make_normal_selected
168+
},'make_normal'),
169+
Jupyter.actions.register({
170+
help : 'make selected cells read-only',
173171
icon: 'fa-lock',
174-
callback : make_read_only_selected
175-
},
176-
{
177-
id : 'freeze_cells',
178-
label : 'freeze selected cells',
172+
handler : make_read_only_selected
173+
},'make_read_only'),
174+
Jupyter.actions.register({
175+
help : 'freeze selected cells',
179176
icon : 'fa-asterisk',
180-
callback : make_frozen_selected
181-
}
177+
handler : make_frozen_selected
178+
},'freeze_cells')
182179
]);
183180

184181
patch_CodeCell_execute();

src/jupyter_contrib_nbextensions/nbextensions/gist_it/main.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ define([
4343

4444
var initialize = function () {
4545
update_params();
46-
Jupyter.toolbar.add_buttons_group([{
47-
label : 'Create/Edit Gist of Notebook',
48-
icon : 'fa-github',
49-
callback: show_gist_editor_modal
50-
}]);
46+
Jupyter.toolbar.add_buttons_group([
47+
Jupyter.actions.register ({
48+
help : 'Create/Edit Gist of Notebook',
49+
icon : 'fa-github',
50+
handler: show_gist_editor_modal
51+
})
52+
]);
5153
};
5254

5355
// update params with any specified in the server's config file

0 commit comments

Comments
 (0)