Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50640 views
1
// leave at least 2 line with only a star on it below, or doc generation fails
2
/**
3
*
4
*
5
* Placeholder for custom user javascript
6
* mainly to be overridden in profile/static/custom/custom.js
7
* This will always be an empty file in IPython
8
*
9
* User could add any javascript in the `profile/static/custom/custom.js` file.
10
* It will be executed by the ipython notebook at load time.
11
*
12
* Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook.
13
*
14
*
15
* The object available at load time depend on the version of IPython in use.
16
* there is no guaranties of API stability.
17
*
18
* The example below explain the principle, and might not be valid.
19
*
20
* Instances are created after the loading of this file and might need to be accessed using events:
21
* define([
22
* 'base/js/namespace',
23
* 'base/js/events'
24
* ], function(IPython, events) {
25
* events.on("app_initialized.NotebookApp", function () {
26
* IPython.keyboard_manager....
27
* });
28
* });
29
*
30
* __Example 1:__
31
*
32
* Create a custom button in toolbar that execute `%qtconsole` in kernel
33
* and hence open a qtconsole attached to the same kernel as the current notebook
34
*
35
* define([
36
* 'base/js/namespace',
37
* 'base/js/events'
38
* ], function(IPython, events) {
39
* events.on('app_initialized.NotebookApp', function(){
40
* IPython.toolbar.add_buttons_group([
41
* {
42
* 'label' : 'run qtconsole',
43
* 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons
44
* 'callback': function () {
45
* IPython.notebook.kernel.execute('%qtconsole')
46
* }
47
* }
48
* // add more button here if needed.
49
* ]);
50
* });
51
* });
52
*
53
* __Example 2:__
54
*
55
* At the completion of the dashboard loading, load an unofficial javascript extension
56
* that is installed in profile/static/custom/
57
*
58
* define([
59
* 'base/js/events'
60
* ], function(events) {
61
* events.on('app_initialized.DashboardApp', function(){
62
* require(['custom/unofficial_extension.js'])
63
* });
64
* });
65
*
66
* __Example 3:__
67
*
68
* Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
69
* to load custom script into the notebook.
70
*
71
* // to load the metadata ui extension example.
72
* $.getScript('/static/notebook/js/celltoolbarpresets/example.js');
73
* // or
74
* // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
75
* $.getScript('/static/notebook/js/celltoolbarpresets/slideshow.js');
76
*
77
*
78
* @module IPython
79
* @namespace IPython
80
* @class customjs
81
* @static
82
*/
83
84