forked from facebookarchive/iTorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom.js
32 lines (26 loc) · 1013 Bytes
/
custom.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$([IPython.events]).on('notebook_loaded.Notebook', function(){
// add here logic that should be run once per **notebook load**
// (!= page load), like restarting a checkpoint
var md = IPython.notebook.metadata
if(md.language){
console.log('language already defined and is :', md.language);
} else {
md.language = 'lua' ;
console.log('add metadata hint that language is lua');
}
});
// logic per page-refresh
$([IPython.events]).on("app_initialized.NotebookApp", function () {
$('head').append('<link rel="stylesheet" type="text/css" href="custom.css">');
IPython.CodeCell.options_default['cm_config']['mode'] = 'lua';
CodeMirror.requireMode('lua', function(){
IPython.OutputArea.prototype._should_scroll = function(){return false}
cells = IPython.notebook.get_cells();
for(var i in cells){
c = cells[i];
if (c.cell_type === 'code'){
c.auto_highlight()
}
}
});
});