In [4]:
profile_dir = get_ipython().profile_dir.location
profile_dir
Out[4]:
In [5]:
import os
tgt = os.path.join( profile_dir, 'static', 'custom')
!git clone https://github.com/ipython-contrib/IPython-notebook-extensions.git $tgt
In [7]:
%cd $tgt
!ls
In [ ]:
%%writefile custom.js
// we want strict javascript that fails
// on ambiguous syntax
"using strict";
// do not use notebook loaded event as it is re-triggerd on
// revert to checkpoint but this allow extesnsion to be loaded
// late enough to work.
//
$([IPython.events]).on('app_initialized.NotebookApp', function(){
/** Use path to js file relative to /static/ dir without leading slash, or
* js extension.
* Link directly to file is js extension.
*
* first argument of require is a **list** that can contains several modules if needed.
**/
// require(['custom/noscroll']);
// require(['custom/clean_start'])
// require(['custom/toggle_all_line_number'])
// require(['custom/gist_it']);
/**
* Link to entrypoint if extesnsion is a folder.
* to be consistent with commonjs module, the entrypoint is main.js
* here youcan also trigger a custom function on load that will do extra
* action with the module if needed
**/
require(['custom/slidemode/main'],function(slidemode){
// // do stuff
})
});