3 highlight_cells = function(IPython, mime) {
4 IPython.CodeCell.options_default.cm_config.mode = mime;
5 var cells = IPython.notebook.get_cells();
6 for (i = 0; i < cells.length; i++) {
8 if (cell.cell_type == "code") {
9 cell.code_mirror.setOption('mode', mime);
10 cell.cm_config.mode = mime;
15 // Configure C++ syntax highlighting for magics and C++-only notebooks
16 require(['base/js/namespace', 'base/js/events', 'codemirror/mode/clike/clike'],
17 function(IPython, events, clike) {
18 var cppMIME = 'text/x-c++src';
19 events.on("kernel_ready.Kernel", function() {
20 var kernel_name = IPython.notebook.kernel.name;
21 if (kernel_name == "ipyroot") {
22 IPython.CodeCell.config_defaults.highlight_modes['magic_' + cppMIME] = {'reg':[/^%%cpp|^%%dcl/]};
23 console.log("ROOTaaS - C++ magics highlighting configured");
25 else if (kernel_name == "root") {
26 highlight_cells(IPython, cppMIME);
27 $('body').one('keydown.wysiwyg', function() {
28 highlight_cells(IPython, cppMIME);
30 events.one("edit_mode.Notebook", function() {
31 highlight_cells(IPython, cppMIME);
33 console.log("ROOTaaS - C++ highlighting ON");
39 $(document).ready(function() {
40 if (document.title == "Home") {
41 $('div#header-container').append("<a href='terminals/1' class='btn btn-default btn-sm navbar-btn pull-right' style='margin-right: 4px; margin-left: 2px;'>Terminal</a>");