Show More
@@ -1,58 +1,68 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 | * | |||
|
15 | * Classes and functions are available at load time and may be accessed plainly: | |||
|
16 | * | |||
|
17 | * IPython.Cell.options_default.cm_config.extraKeys = {Home: "goLineLeft", End: "goLineRight"}; | |||
|
18 | * | |||
|
19 | * Instances are created later however and must be accessed using events: | |||
|
20 | * | |||
|
21 | * $([IPython.events]).on("app_initialized.NotebookApp", function () { | |||
|
22 | * IPython.keyboard_manager.... | |||
|
23 | * }); | |||
14 | * |
|
24 | * | |
15 | * __Example 1:__ |
|
25 | * __Example 1:__ | |
16 | * |
|
26 | * | |
17 | * Create a custom button in toolbar that execute `%qtconsole` in kernel |
|
27 | * 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 |
|
28 | * and hence open a qtconsole attached to the same kernel as the current notebook | |
19 | * |
|
29 | * | |
20 | * IPython.events.on('app_initialized.NotebookApp', function(){ |
|
30 | * IPython.events.on('app_initialized.NotebookApp', function(){ | |
21 | * IPython.toolbar.add_buttons_group([ |
|
31 | * IPython.toolbar.add_buttons_group([ | |
22 | * { |
|
32 | * { | |
23 | * 'label' : 'run qtconsole', |
|
33 | * 'label' : 'run qtconsole', | |
24 | * 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons |
|
34 | * 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons | |
25 | * 'callback': function () { |
|
35 | * 'callback': function () { | |
26 | * IPython.notebook.kernel.execute('%qtconsole') |
|
36 | * IPython.notebook.kernel.execute('%qtconsole') | |
27 | * } |
|
37 | * } | |
28 | * } |
|
38 | * } | |
29 | * // add more button here if needed. |
|
39 | * // add more button here if needed. | |
30 | * ]); |
|
40 | * ]); | |
31 | * }); |
|
41 | * }); | |
32 | * |
|
42 | * | |
33 | * __Example 2:__ |
|
43 | * __Example 2:__ | |
34 | * |
|
44 | * | |
35 | * At the completion of the dashboard loading, load an unofficial javascript extension |
|
45 | * At the completion of the dashboard loading, load an unofficial javascript extension | |
36 | * that is installed in profile/static/custom/ |
|
46 | * that is installed in profile/static/custom/ | |
37 | * |
|
47 | * | |
38 | * IPython.events.on('app_initialized.DashboardApp', function(){ |
|
48 | * IPython.events.on('app_initialized.DashboardApp', function(){ | |
39 | * require(['custom/unofficial_extension.js']) |
|
49 | * require(['custom/unofficial_extension.js']) | |
40 | * }); |
|
50 | * }); | |
41 | * |
|
51 | * | |
42 | * __Example 3:__ |
|
52 | * __Example 3:__ | |
43 | * |
|
53 | * | |
44 | * Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );` |
|
54 | * Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );` | |
45 | * to load custom script into the notebook. |
|
55 | * to load custom script into the notebook. | |
46 | * |
|
56 | * | |
47 | * // to load the metadata ui extension example. |
|
57 | * // to load the metadata ui extension example. | |
48 | * $.getScript('/static/notebook/js/celltoolbarpresets/example.js'); |
|
58 | * $.getScript('/static/notebook/js/celltoolbarpresets/example.js'); | |
49 | * // or |
|
59 | * // or | |
50 | * // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert |
|
60 | * // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert | |
51 | * $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js'); |
|
61 | * $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js'); | |
52 | * |
|
62 | * | |
53 | * |
|
63 | * | |
54 | * @module IPython |
|
64 | * @module IPython | |
55 | * @namespace IPython |
|
65 | * @namespace IPython | |
56 | * @class customjs |
|
66 | * @class customjs | |
57 | * @static |
|
67 | * @static | |
58 | */ |
|
68 | */ |
General Comments 0
You need to be logged in to leave comments.
Login now