##// END OF EJS Templates
Update custom.js for 3.0
dongweiming -
Show More
@@ -11,16 +11,20 b''
11 * It will be executed by the ipython notebook at load time.
11 * It will be executed by the ipython notebook at load time.
12 *
12 *
13 * Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook.
13 * Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook.
14 *
14 *
15 * Classes and functions are available at load time and may be accessed plainly:
15 * Classes and functions are available at load time and may be accessed plainly:
16 *
16 *
17 * IPython.Cell.options_default.cm_config.extraKeys['Home'] = 'goLineLeft';
17 * IPython.Cell.options_default.cm_config.extraKeys['Home'] = 'goLineLeft';
18 * IPython.Cell.options_default.cm_config.extraKeys['End'] = 'goLineRight';
18 * IPython.Cell.options_default.cm_config.extraKeys['End'] = 'goLineRight';
19 *
19 *
20 * Instances are created later however and must be accessed using events:
20 * Instances are created later however and must be accessed using events:
21 *
21 * require([
22 * $([IPython.events]).on("app_initialized.NotebookApp", function () {
22 * 'base/js/namespace',
23 * IPython.keyboard_manager....
23 * 'base/js/events'
24 * ], function(IPython, events) {
25 * events.on("app_initialized.NotebookApp", function () {
26 * IPython.keyboard_manager....
27 * });
24 * });
28 * });
25 *
29 *
26 * __Example 1:__
30 * __Example 1:__
@@ -28,26 +32,35 b''
28 * Create a custom button in toolbar that execute `%qtconsole` in kernel
32 * Create a custom button in toolbar that execute `%qtconsole` in kernel
29 * and hence open a qtconsole attached to the same kernel as the current notebook
33 * and hence open a qtconsole attached to the same kernel as the current notebook
30 *
34 *
31 * IPython.events.on('app_initialized.NotebookApp', function(){
35 * require([
32 * IPython.toolbar.add_buttons_group([
36 * 'base/js/namespace',
33 * {
37 * 'base/js/events'
34 * 'label' : 'run qtconsole',
38 * ], function(IPython, events) {
35 * 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons
39 * events.on('app_initialized.NotebookApp', function(){
36 * 'callback': function () {
40 * IPython.toolbar.add_buttons_group([
37 * IPython.notebook.kernel.execute('%qtconsole')
41 * {
38 * }
42 * 'label' : 'run qtconsole',
39 * }
43 * 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons
40 * // add more button here if needed.
44 * 'callback': function () {
41 * ]);
45 * IPython.notebook.kernel.execute('%qtconsole')
46 * }
47 * }
48 * // add more button here if needed.
49 * ]);
50 * });
42 * });
51 * });
43 *
52 *
44 * __Example 2:__
53 * __Example 2:__
45 *
54 *
46 * At the completion of the dashboard loading, load an unofficial javascript extension
55 * At the completion of the dashboard loading, load an unofficial javascript extension
47 * that is installed in profile/static/custom/
56 * that is installed in profile/static/custom/
48 *
57 *
49 * IPython.events.on('app_initialized.DashboardApp', function(){
58 * require([
50 * require(['custom/unofficial_extension.js'])
59 * 'base/js/events'
60 * ], function(events) {
61 * events.on('app_initialized.DashboardApp', function(){
62 * require(['custom/unofficial_extension.js'])
63 * });
51 * });
64 * });
52 *
65 *
53 * __Example 3:__
66 * __Example 3:__
General Comments 0
You need to be logged in to leave comments. Login now