diff --git a/IPython/html/static/custom/custom.js b/IPython/html/static/custom/custom.js index efb420e..0b9fed0 100644 --- a/IPython/html/static/custom/custom.js +++ b/IPython/html/static/custom/custom.js @@ -11,16 +11,20 @@ * It will be executed by the ipython notebook at load time. * * Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook. - * - * Classes and functions are available at load time and may be accessed plainly: - * + * + * Classes and functions are available at load time and may be accessed plainly: + * * IPython.Cell.options_default.cm_config.extraKeys['Home'] = 'goLineLeft'; * IPython.Cell.options_default.cm_config.extraKeys['End'] = 'goLineRight'; - * + * * Instances are created later however and must be accessed using events: - * - * $([IPython.events]).on("app_initialized.NotebookApp", function () { - * IPython.keyboard_manager.... + * require([ + * 'base/js/namespace', + * 'base/js/events' + * ], function(IPython, events) { + * events.on("app_initialized.NotebookApp", function () { + * IPython.keyboard_manager.... + * }); * }); * * __Example 1:__ @@ -28,26 +32,35 @@ * Create a custom button in toolbar that execute `%qtconsole` in kernel * and hence open a qtconsole attached to the same kernel as the current notebook * - * IPython.events.on('app_initialized.NotebookApp', function(){ - * IPython.toolbar.add_buttons_group([ - * { - * 'label' : 'run qtconsole', - * 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons - * 'callback': function () { - * IPython.notebook.kernel.execute('%qtconsole') - * } - * } - * // add more button here if needed. - * ]); + * require([ + * 'base/js/namespace', + * 'base/js/events' + * ], function(IPython, events) { + * events.on('app_initialized.NotebookApp', function(){ + * IPython.toolbar.add_buttons_group([ + * { + * 'label' : 'run qtconsole', + * 'icon' : 'icon-terminal', // select your icon from http://fortawesome.github.io/Font-Awesome/icons + * 'callback': function () { + * IPython.notebook.kernel.execute('%qtconsole') + * } + * } + * // add more button here if needed. + * ]); + * }); * }); * * __Example 2:__ * * At the completion of the dashboard loading, load an unofficial javascript extension - * that is installed in profile/static/custom/ + * that is installed in profile/static/custom/ * - * IPython.events.on('app_initialized.DashboardApp', function(){ - * require(['custom/unofficial_extension.js']) + * require([ + * 'base/js/events' + * ], function(events) { + * events.on('app_initialized.DashboardApp', function(){ + * require(['custom/unofficial_extension.js']) + * }); * }); * * __Example 3:__