From 48db79fc3cd1164baeabffed58d11926aeb86b4a 2014-06-24 19:03:29 From: Jean-Christophe Jaskula Date: 2014-06-24 19:03:29 Subject: [PATCH] Creating an entry point for notebook manager extensions - Firing app_initialized.DashboardApp event when loaded the notebook manager - Updating tree.html template to load nbextensions through custom.js --- diff --git a/IPython/html/static/custom/custom.js b/IPython/html/static/custom/custom.js index f8d1afe..efa70e8 100644 --- a/IPython/html/static/custom/custom.js +++ b/IPython/html/static/custom/custom.js @@ -12,7 +12,7 @@ * * Same thing with `profile/static/custom/custom.css` to inject custom css into the notebook. * - * Example : + * __Example 1:__ * * 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 @@ -30,7 +30,16 @@ * ]); * }); * - * Example : + * __Example 2:__ + * + * At the completion of the dashboard loading, load an unofficial javascript extension + * that is installed in profile/static/custom/ + * + * $([IPython.events]).on('app_initialized.DashboardApp', function(){ + * require(['custom/unofficial_extension.js']) + * }); + * + * __Example 3:__ * * Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );` * to load custom script into the notebook. diff --git a/IPython/html/static/tree/js/main.js b/IPython/html/static/tree/js/main.js index 92e400d..acd647d 100644 --- a/IPython/html/static/tree/js/main.js +++ b/IPython/html/static/tree/js/main.js @@ -70,7 +70,8 @@ $(document).ready(function () { enable_autorefresh(); IPython.page.show(); - + $([IPython.events]).trigger('app_initialized.DashboardApp'); + // bound the upload method to the on change of the file select list $("#alternate_upload").change(function (event){ IPython.notebook_list.handleFilesUpload(event,'form');