##// END OF EJS Templates
Update custom.js for 3.0
dongweiming -
Show More
@@ -1,69 +1,82 b''
1 // leave at least 2 line with only a star on it below, or doc generation fails
1 // leave at least 2 line with only a star on it below, or doc generation fails
2 /**
2 /**
3 *
3 *
4 *
4 *
5 * Placeholder for custom user javascript
5 * Placeholder for custom user javascript
6 * mainly to be overridden in profile/static/custom/custom.js
6 * mainly to be overridden in profile/static/custom/custom.js
7 * This will always be an empty file in IPython
7 * This will always be an empty file in IPython
8 *
8 *
9 * User could add any javascript in the `profile/static/custom/custom.js` file
9 * User could add any javascript in the `profile/static/custom/custom.js` file
10 * (and should create it if it does not exist).
10 * (and should create it if it does not exist).
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:__
27 *
31 *
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:__
54 *
67 *
55 * Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
68 * Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
56 * to load custom script into the notebook.
69 * to load custom script into the notebook.
57 *
70 *
58 * // to load the metadata ui extension example.
71 * // to load the metadata ui extension example.
59 * $.getScript('/static/notebook/js/celltoolbarpresets/example.js');
72 * $.getScript('/static/notebook/js/celltoolbarpresets/example.js');
60 * // or
73 * // or
61 * // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
74 * // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
62 * $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');
75 * $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');
63 *
76 *
64 *
77 *
65 * @module IPython
78 * @module IPython
66 * @namespace IPython
79 * @namespace IPython
67 * @class customjs
80 * @class customjs
68 * @static
81 * @static
69 */
82 */
General Comments 0
You need to be logged in to leave comments. Login now