##// END OF EJS Templates
Backport PR #4143: update example custom.js...
MinRK -
Show More
@@ -1,47 +1,49 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 * Example :
15 * Example :
16 *
16 *
17 * Create a custom button in toolbar that execute `%qtconsole` in kernel
17 * Create a custom button in toolbar that execute `%qtconsole` in kernel
18 * and hence open a qtconsole attached to the same kernel as the current notebook
18 * and hence open a qtconsole attached to the same kernel as the current notebook
19 *
19 *
20 * $([IPython.events]).on('notebook_loaded.Notebook', function(){
20 * $([IPython.events]).on('app_initialized.NotebookApp', function(){
21 * IPython.toolbar.add_buttons_group([
21 * IPython.toolbar.add_buttons_group([
22 * {
22 * {
23 * 'label' : 'run qtconsole',
23 * 'label' : 'run qtconsole',
24 * 'icon' : 'ui-icon-calculator', // select your icon from http://jqueryui.com/themeroller/
24 * 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons
25 * 'callback': function(){IPython.notebook.kernel.execute('%qtconsole')}
25 * 'callback': function () {
26 * IPython.notebook.kernel.execute('%qtconsole')
27 * }
26 * }
28 * }
27 * // add more button here if needed.
29 * // add more button here if needed.
28 * ]);
30 * ]);
29 * });
31 * });
30 *
32 *
31 * Example :
33 * Example :
32 *
34 *
33 * Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
35 * Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
34 * to load custom script into the notebook.
36 * to load custom script into the notebook.
35 *
37 *
36 * // to load the metadata ui extension example.
38 * // to load the metadata ui extension example.
37 * $.getScript('/static/notebook/js/celltoolbarpresets/example.js');
39 * $.getScript('/static/notebook/js/celltoolbarpresets/example.js');
38 * // or
40 * // or
39 * // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
41 * // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
40 * $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');
42 * $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');
41 *
43 *
42 *
44 *
43 * @module IPython
45 * @module IPython
44 * @namespace IPython
46 * @namespace IPython
45 * @class customjs
47 * @class customjs
46 * @static
48 * @static
47 */
49 */
General Comments 0
You need to be logged in to leave comments. Login now