Show More
@@ -1,82 +1,82 b'' | |||
|
1 | 1 | // leave at least 2 line with only a star on it below, or doc generation fails |
|
2 | 2 | /** |
|
3 | 3 | * |
|
4 | 4 | * |
|
5 | 5 | * Placeholder for custom user javascript |
|
6 | 6 | * mainly to be overridden in profile/static/custom/custom.js |
|
7 | 7 | * This will always be an empty file in IPython |
|
8 | 8 | * |
|
9 | 9 | * User could add any javascript in the `profile/static/custom/custom.js` file |
|
10 | 10 | * (and should create it if it does not exist). |
|
11 | 11 | * It will be executed by the ipython notebook at load time. |
|
12 | 12 | * |
|
13 | 13 | * Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook. |
|
14 | 14 | * |
|
15 | 15 | * Classes and functions are available at load time and may be accessed plainly: |
|
16 | 16 | * |
|
17 | 17 | * IPython.Cell.options_default.cm_config.extraKeys['Home'] = 'goLineLeft'; |
|
18 | 18 | * IPython.Cell.options_default.cm_config.extraKeys['End'] = 'goLineRight'; |
|
19 | 19 | * |
|
20 | 20 | * Instances are created later however and must be accessed using events: |
|
21 |
* |
|
|
21 | * define([ | |
|
22 | 22 | * 'base/js/namespace', |
|
23 | 23 | * 'base/js/events' |
|
24 | 24 | * ], function(IPython, events) { |
|
25 | 25 | * events.on("app_initialized.NotebookApp", function () { |
|
26 | 26 | * IPython.keyboard_manager.... |
|
27 | 27 | * }); |
|
28 | 28 | * }); |
|
29 | 29 | * |
|
30 | 30 | * __Example 1:__ |
|
31 | 31 | * |
|
32 | 32 | * Create a custom button in toolbar that execute `%qtconsole` in kernel |
|
33 | 33 | * and hence open a qtconsole attached to the same kernel as the current notebook |
|
34 | 34 | * |
|
35 |
* |
|
|
35 | * define([ | |
|
36 | 36 | * 'base/js/namespace', |
|
37 | 37 | * 'base/js/events' |
|
38 | 38 | * ], function(IPython, events) { |
|
39 | 39 | * events.on('app_initialized.NotebookApp', function(){ |
|
40 | 40 | * IPython.toolbar.add_buttons_group([ |
|
41 | 41 | * { |
|
42 | 42 | * 'label' : 'run qtconsole', |
|
43 | 43 | * 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons |
|
44 | 44 | * 'callback': function () { |
|
45 | 45 | * IPython.notebook.kernel.execute('%qtconsole') |
|
46 | 46 | * } |
|
47 | 47 | * } |
|
48 | 48 | * // add more button here if needed. |
|
49 | 49 | * ]); |
|
50 | 50 | * }); |
|
51 | 51 | * }); |
|
52 | 52 | * |
|
53 | 53 | * __Example 2:__ |
|
54 | 54 | * |
|
55 | 55 | * At the completion of the dashboard loading, load an unofficial javascript extension |
|
56 | 56 | * that is installed in profile/static/custom/ |
|
57 | 57 | * |
|
58 |
* |
|
|
58 | * define([ | |
|
59 | 59 | * 'base/js/events' |
|
60 | 60 | * ], function(events) { |
|
61 | 61 | * events.on('app_initialized.DashboardApp', function(){ |
|
62 | 62 | * require(['custom/unofficial_extension.js']) |
|
63 | 63 | * }); |
|
64 | 64 | * }); |
|
65 | 65 | * |
|
66 | 66 | * __Example 3:__ |
|
67 | 67 | * |
|
68 | 68 | * Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );` |
|
69 | 69 | * to load custom script into the notebook. |
|
70 | 70 | * |
|
71 | 71 | * // to load the metadata ui extension example. |
|
72 | 72 | * $.getScript('/static/notebook/js/celltoolbarpresets/example.js'); |
|
73 | 73 | * // or |
|
74 | 74 | * // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert |
|
75 | 75 | * $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js'); |
|
76 | 76 | * |
|
77 | 77 | * |
|
78 | 78 | * @module IPython |
|
79 | 79 | * @namespace IPython |
|
80 | 80 | * @class customjs |
|
81 | 81 | * @static |
|
82 | 82 | */ |
General Comments 0
You need to be logged in to leave comments.
Login now