diff --git a/IPython/html/static/notebook/js/cell.js b/IPython/html/static/notebook/js/cell.js index 237c9e7..05562a1 100644 --- a/IPython/html/static/notebook/js/cell.js +++ b/IPython/html/static/notebook/js/cell.js @@ -560,5 +560,4 @@ define([ IPython.Cell = Cell; return {'Cell': Cell}; - }); diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js index d7cef5d..b5a63ef 100644 --- a/IPython/html/static/notebook/js/codecell.js +++ b/IPython/html/static/notebook/js/codecell.js @@ -11,8 +11,9 @@ define([ 'notebook/js/outputarea', 'notebook/js/completer', 'notebook/js/celltoolbar', -], function(IPython, $, utils, Tooltip, keyboard, Cell, OutputArea, Completer, CellToolbar) { +], function(IPython, $, utils, tooltip, keyboard, cell, outputarea, completer, celltoolbar) { "use strict"; + var Cell = cell.Cell; /* local util for codemirror */ var posEq = function(a, b) {return a.line == b.line && a.ch == b.ch;}; @@ -76,7 +77,7 @@ define([ options = this.mergeopt(CodeCell, options, {cm_config:cm_overwrite_options}); - cell.Cell.apply(this,[options, keyboard_manager, events]); + Cell.apply(this,[options, keyboard_manager, events]); // Attributes we want to override in this subclass. this.cell_type = "code"; @@ -106,7 +107,7 @@ define([ CodeCell.msg_cells = {}; - CodeCell.prototype = new cell.Cell(); + CodeCell.prototype = new Cell(); /** * @method auto_highlight @@ -117,7 +118,7 @@ define([ /** @method create_element */ CodeCell.prototype.create_element = function () { - cell.Cell.prototype.create_element.apply(this, arguments); + Cell.prototype.create_element.apply(this, arguments); var cell = $('
').addClass('cell border-box-sizing code_cell'); cell.attr('tabindex','2'); @@ -161,7 +162,7 @@ define([ /** @method bind_events */ CodeCell.prototype.bind_events = function () { - cell.Cell.prototype.bind_events.apply(this); + Cell.prototype.bind_events.apply(this); var that = this; this.element.focusout( @@ -243,7 +244,7 @@ define([ // keyboard event wasn't one of those unique to code cells, let's see // if it's one of the generic ones (i.e. check edit mode shortcuts) - return cell.Cell.prototype.handle_codemirror_keyevent.apply(this, [editor, event]); + return Cell.prototype.handle_codemirror_keyevent.apply(this, [editor, event]); }; // Kernel related calls. @@ -336,7 +337,7 @@ define([ // Basic cell manipulation. CodeCell.prototype.select = function () { - var cont = cell.Cell.prototype.select.apply(this); + var cont = Cell.prototype.select.apply(this); if (cont) { this.code_mirror.refresh(); this.auto_highlight(); @@ -345,7 +346,7 @@ define([ }; CodeCell.prototype.render = function () { - var cont = cell.Cell.prototype.render.apply(this); + var cont = Cell.prototype.render.apply(this); // Always execute, even if we are already in the rendered state return cont; }; @@ -448,7 +449,7 @@ define([ // JSON serialization CodeCell.prototype.fromJSON = function (data) { - cell.Cell.prototype.fromJSON.apply(this, arguments); + Cell.prototype.fromJSON.apply(this, arguments); if (data.cell_type === 'code') { if (data.input !== undefined) { this.set_text(data.input); @@ -476,7 +477,7 @@ define([ CodeCell.prototype.toJSON = function () { - var data = cell.Cell.prototype.toJSON.apply(this); + var data = Cell.prototype.toJSON.apply(this); data.input = this.get_text(); // is finite protect against undefined and '*' value if (isFinite(this.input_prompt_number)) { @@ -496,7 +497,7 @@ define([ * @return is the action being taken */ CodeCell.prototype.unselect = function () { - var cont = cell.Cell.prototype.unselect.apply(this); + var cont = Cell.prototype.unselect.apply(this); if (cont) { // When a code cell is usnelected, make sure that the corresponding // tooltip and completer to that cell is closed. diff --git a/IPython/html/static/notebook/js/main.js b/IPython/html/static/notebook/js/main.js index 41b8b9f..d6c9300 100644 --- a/IPython/html/static/notebook/js/main.js +++ b/IPython/html/static/notebook/js/main.js @@ -22,19 +22,19 @@ require([ ], function( IPython, $, - Notebook, + notebook, utils, - Page, - LayoutManager, - Events, - LoginWidget, - MainToolBar, - Pager, - QuickHelp, - MenuBar, - NotificationArea, - SaveWidget, - KeyboardManager, + page, + layoutmanager, + events, + loginwidget, + maintoolbar, + pager, + quickhelp, + menubar, + notificationarea, + savewidget, + keyboardmanager, config ) { "use strict"; diff --git a/IPython/html/static/notebook/js/maintoolbar.js b/IPython/html/static/notebook/js/maintoolbar.js index 8b84065..f899f7d 100644 --- a/IPython/html/static/notebook/js/maintoolbar.js +++ b/IPython/html/static/notebook/js/maintoolbar.js @@ -6,11 +6,11 @@ define([ 'jquery', 'notebook/js/toolbar', 'notebook/js/celltoolbar', -], function(IPython, $, Toolbar, CellToolbar) { +], function(IPython, $, toolbar, celltoolbar) { "use strict"; var MainToolBar = function (selector, layout_manager, notebook, events) { - toolbar.Toolbar.apply(this, arguments); + toolbar.ToolBar.apply(this, arguments); this.events = events; this.notebook = notebook; this.construct(); @@ -19,16 +19,17 @@ define([ this.bind_events(); }; - MainToolBar.prototype = new toolbar.Toolbar(); + MainToolBar.prototype = new toolbar.ToolBar(); MainToolBar.prototype.construct = function () { + var that = this; this.add_buttons_group([ { id : 'save_b', label : 'Save and Checkpoint', icon : 'icon-save', callback : function () { - this.notebook.save_checkpoint(); + that.notebook.save_checkpoint(); } } ]); @@ -39,9 +40,9 @@ define([ label : 'Insert Cell Below', icon : 'icon-plus-sign', callback : function () { - this.notebook.insert_cell_below('code'); - this.notebook.select_next(); - this.notebook.focus_cell(); + that.notebook.insert_cell_below('code'); + that.notebook.select_next(); + that.notebook.focus_cell(); } } ],'insert_above_below'); @@ -52,7 +53,7 @@ define([ label : 'Cut Cell', icon : 'icon-cut', callback : function () { - this.notebook.cut_cell(); + that.notebook.cut_cell(); } }, { @@ -60,7 +61,7 @@ define([ label : 'Copy Cell', icon : 'icon-copy', callback : function () { - this.notebook.copy_cell(); + that.notebook.copy_cell(); } }, { @@ -68,7 +69,7 @@ define([ label : 'Paste Cell Below', icon : 'icon-paste', callback : function () { - this.notebook.paste_cell_below(); + that.notebook.paste_cell_below(); } } ],'cut_copy_paste'); @@ -79,7 +80,7 @@ define([ label : 'Move Cell Up', icon : 'icon-arrow-up', callback : function () { - this.notebook.move_cell_up(); + that.notebook.move_cell_up(); } }, { @@ -87,7 +88,7 @@ define([ label : 'Move Cell Down', icon : 'icon-arrow-down', callback : function () { - this.notebook.move_cell_down(); + that.notebook.move_cell_down(); } } ],'move_up_down'); @@ -100,7 +101,7 @@ define([ icon : 'icon-play', callback : function () { // emulate default shift-enter behavior - this.notebook.execute_cell_and_select_below(); + that.notebook.execute_cell_and_select_below(); } }, { @@ -108,7 +109,7 @@ define([ label : 'Interrupt', icon : 'icon-stop', callback : function () { - this.notebook.session.interrupt_kernel(); + that.notebook.session.interrupt_kernel(); } }, { @@ -116,7 +117,7 @@ define([ label : 'Restart Kernel', icon : 'icon-repeat', callback : function () { - this.notebook.restart_kernel(); + that.notebook.restart_kernel(); } } ],'run_int'); @@ -153,11 +154,11 @@ define([ var val = $(this).val(); if (val ==='') { celltoolbar.CellToolbar.global_hide(); - delete this.notebook.metadata.celltoolbar; + delete that.notebook.metadata.celltoolbar; } else { celltoolbar.CellToolbar.global_show(); celltoolbar.CellToolbar.activate_preset(val); - this.notebook.metadata.celltoolbar = val; + that.notebook.metadata.celltoolbar = val; } }); // Setup the currently registered presets. @@ -185,23 +186,23 @@ define([ this.element.find('#cell_type').change(function () { var cell_type = $(this).val(); if (cell_type === 'code') { - this.notebook.to_code(); + that.notebook.to_code(); } else if (cell_type === 'markdown') { - this.notebook.to_markdown(); + that.notebook.to_markdown(); } else if (cell_type === 'raw') { - this.notebook.to_raw(); + that.notebook.to_raw(); } else if (cell_type === 'heading1') { - this.notebook.to_heading(undefined, 1); + that.notebook.to_heading(undefined, 1); } else if (cell_type === 'heading2') { - this.notebook.to_heading(undefined, 2); + that.notebook.to_heading(undefined, 2); } else if (cell_type === 'heading3') { - this.notebook.to_heading(undefined, 3); + that.notebook.to_heading(undefined, 3); } else if (cell_type === 'heading4') { - this.notebook.to_heading(undefined, 4); + that.notebook.to_heading(undefined, 4); } else if (cell_type === 'heading5') { - this.notebook.to_heading(undefined, 5); + that.notebook.to_heading(undefined, 5); } else if (cell_type === 'heading6') { - this.notebook.to_heading(undefined, 6); + that.notebook.to_heading(undefined, 6); } }); this.events.on('selected_cell_type_changed.Notebook', function (event, data) { diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index abf10e6..7f01426 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -810,11 +810,11 @@ define([ cell = new codecell.CodeCell(this.kernel, this.options, this.events, this.config, this.keyboard_manager, this); cell.set_input_prompt(); } else if (type === 'markdown') { - cell = new cells.Cells.MarkdownCell(this.options, this.events, this.config, this.keyboard_manager, this); + cell = new cells.MarkdownCell(this.options, this.events, this.config, this.keyboard_manager, this); } else if (type === 'raw') { - cell = new cells.Cells.RawCell(this.options, this.events, this.config, this.keyboard_manager, this); + cell = new cells.RawCell(this.options, this.events, this.config, this.keyboard_manager, this); } else if (type === 'heading') { - cell = new cells.Cells.HeadingCell(this.options, this.events, this.config, this.keyboard_manager, this); + cell = new cells.HeadingCell(this.options, this.events, this.config, this.keyboard_manager, this); } if(this._insert_element_at_index(cell.element,index)) { @@ -929,7 +929,7 @@ define([ if (this.is_valid_cell_index(i)) { var source_element = this.get_cell_element(i); var source_cell = source_element.data("cell"); - if (!(source_cell instanceof CodeCell)) { + if (!(source_cell instanceof codecell.CodeCell)) { var target_cell = this.insert_cell_below('code',i); var text = source_cell.get_text(); if (text === source_cell.placeholder) { @@ -959,7 +959,7 @@ define([ if (this.is_valid_cell_index(i)) { var source_element = this.get_cell_element(i); var source_cell = source_element.data("cell"); - if (!(source_cell instanceof cells.Cells.MarkdownCell)) { + if (!(source_cell instanceof cells.MarkdownCell)) { var target_cell = this.insert_cell_below('markdown',i); var text = source_cell.get_text(); if (text === source_cell.placeholder) { @@ -973,7 +973,7 @@ define([ target_cell.code_mirror.clearHistory(); source_element.remove(); this.select(i); - if ((source_cell instanceof cells.Cells.TextCell) && source_cell.rendered) { + if ((source_cell instanceof cells.TextCell) && source_cell.rendered) { target_cell.render(); } var cursor = source_cell.code_mirror.getCursor(); @@ -995,7 +995,7 @@ define([ var source_element = this.get_cell_element(i); var source_cell = source_element.data("cell"); var target_cell = null; - if (!(source_cell instanceof cells.Cells.RawCell)) { + if (!(source_cell instanceof cells.RawCell)) { target_cell = this.insert_cell_below('raw',i); var text = source_cell.get_text(); if (text === source_cell.placeholder) { @@ -1030,7 +1030,7 @@ define([ var source_element = this.get_cell_element(i); var source_cell = source_element.data("cell"); var target_cell = null; - if (source_cell instanceof cells.Cells.HeadingCell) { + if (source_cell instanceof cells.HeadingCell) { source_cell.set_level(level); } else { target_cell = this.insert_cell_below('heading',i); @@ -1049,7 +1049,7 @@ define([ this.select(i); var cursor = source_cell.code_mirror.getCursor(); target_cell.code_mirror.setCursor(cursor); - if ((source_cell instanceof cells.Cells.TextCell) && source_cell.rendered) { + if ((source_cell instanceof cells.TextCell) && source_cell.rendered) { target_cell.render(); } } @@ -1168,13 +1168,13 @@ define([ * @method split_cell */ Notebook.prototype.split_cell = function () { - var mdc = cells.Cells.MarkdownCell; - var rc = cells.Cells.RawCell; + var mdc = cells.MarkdownCell; + var rc = cells.RawCell; var cell = this.get_selected_cell(); if (cell.is_splittable()) { var texta = cell.get_pre_cursor(); var textb = cell.get_post_cursor(); - if (cell instanceof CodeCell) { + if (cell instanceof codecell.CodeCell) { // In this case the operations keep the notebook in its existing mode // so we don't need to do any post-op mode changes. cell.set_text(textb); @@ -1197,8 +1197,8 @@ define([ * @method merge_cell_above */ Notebook.prototype.merge_cell_above = function () { - var mdc = cells.Cells.MarkdownCell; - var rc = cells.Cells.RawCell; + var mdc = cells.MarkdownCell; + var rc = cells.RawCell; var index = this.get_selected_index(); var cell = this.get_cell(index); var render = cell.rendered; @@ -1212,7 +1212,7 @@ define([ } var upper_text = upper_cell.get_text(); var text = cell.get_text(); - if (cell instanceof CodeCell) { + if (cell instanceof codecell.CodeCell) { cell.set_text(upper_text+'\n'+text); } else if ((cell instanceof mdc) || (cell instanceof rc)) { cell.unrender(); // Must unrender before we set_text. @@ -1234,8 +1234,8 @@ define([ * @method merge_cell_below */ Notebook.prototype.merge_cell_below = function () { - var mdc = cells.Cells.MarkdownCell; - var rc = cells.Cells.RawCell; + var mdc = cells.MarkdownCell; + var rc = cells.RawCell; var index = this.get_selected_index(); var cell = this.get_cell(index); var render = cell.rendered; @@ -1249,7 +1249,7 @@ define([ } var lower_text = lower_cell.get_text(); var text = cell.get_text(); - if (cell instanceof CodeCell) { + if (cell instanceof codecell.CodeCell) { cell.set_text(text+'\n'+lower_text); } else if ((cell instanceof mdc) || (cell instanceof rc)) { cell.unrender(); // Must unrender before we set_text. @@ -1277,7 +1277,7 @@ define([ Notebook.prototype.collapse_output = function (index) { var i = this.index_or_selected(index); var cell = this.get_cell(i); - if (cell !== null && (cell instanceof CodeCell)) { + if (cell !== null && (cell instanceof codecell.CodeCell)) { cell.collapse_output(); this.set_dirty(true); } @@ -1290,7 +1290,7 @@ define([ */ Notebook.prototype.collapse_all_output = function () { $.map(this.get_cells(), function (cell, i) { - if (cell instanceof CodeCell) { + if (cell instanceof codecell.CodeCell) { cell.collapse_output(); } }); @@ -1307,7 +1307,7 @@ define([ Notebook.prototype.expand_output = function (index) { var i = this.index_or_selected(index); var cell = this.get_cell(i); - if (cell !== null && (cell instanceof CodeCell)) { + if (cell !== null && (cell instanceof codecell.CodeCell)) { cell.expand_output(); this.set_dirty(true); } @@ -1320,7 +1320,7 @@ define([ */ Notebook.prototype.expand_all_output = function () { $.map(this.get_cells(), function (cell, i) { - if (cell instanceof CodeCell) { + if (cell instanceof codecell.CodeCell) { cell.expand_output(); } }); @@ -1337,7 +1337,7 @@ define([ Notebook.prototype.clear_output = function (index) { var i = this.index_or_selected(index); var cell = this.get_cell(i); - if (cell !== null && (cell instanceof CodeCell)) { + if (cell !== null && (cell instanceof codecell.CodeCell)) { cell.clear_output(); this.set_dirty(true); } @@ -1350,7 +1350,7 @@ define([ */ Notebook.prototype.clear_all_output = function () { $.map(this.get_cells(), function (cell, i) { - if (cell instanceof CodeCell) { + if (cell instanceof codecell.CodeCell) { cell.clear_output(); } }); @@ -1366,7 +1366,7 @@ define([ Notebook.prototype.scroll_output = function (index) { var i = this.index_or_selected(index); var cell = this.get_cell(i); - if (cell !== null && (cell instanceof CodeCell)) { + if (cell !== null && (cell instanceof codecell.CodeCell)) { cell.scroll_output(); this.set_dirty(true); } @@ -1379,7 +1379,7 @@ define([ */ Notebook.prototype.scroll_all_output = function () { $.map(this.get_cells(), function (cell, i) { - if (cell instanceof CodeCell) { + if (cell instanceof codecell.CodeCell) { cell.scroll_output(); } }); @@ -1395,7 +1395,7 @@ define([ Notebook.prototype.toggle_output = function (index) { var i = this.index_or_selected(index); var cell = this.get_cell(i); - if (cell !== null && (cell instanceof CodeCell)) { + if (cell !== null && (cell instanceof codecell.CodeCell)) { cell.toggle_output(); this.set_dirty(true); } @@ -1408,7 +1408,7 @@ define([ */ Notebook.prototype.toggle_all_output = function () { $.map(this.get_cells(), function (cell, i) { - if (cell instanceof CodeCell) { + if (cell instanceof codecell.CodeCell) { cell.toggle_output(); } }); @@ -1425,7 +1425,7 @@ define([ Notebook.prototype.toggle_output_scroll = function (index) { var i = this.index_or_selected(index); var cell = this.get_cell(i); - if (cell !== null && (cell instanceof CodeCell)) { + if (cell !== null && (cell instanceof codecell.CodeCell)) { cell.toggle_output_scroll(); this.set_dirty(true); } @@ -1438,7 +1438,7 @@ define([ */ Notebook.prototype.toggle_all_output_scroll = function () { $.map(this.get_cells(), function (cell, i) { - if (cell instanceof CodeCell) { + if (cell instanceof codecell.CodeCell) { cell.toggle_output_scroll(); } }); @@ -1480,7 +1480,7 @@ define([ var ncells = this.ncells(); for (var i=0; iEsc
to enable)Enter
to enable)Enter
or clicking in the input text area of the cell switches to Edit Mode."
}, {
element: '.selected',
title: "Edit Mode",
placement: 'bottom',
- onShow: function(tour) { edit_mode(); },
+ onShow: function(tour) { that.edit_mode(); },
content: "Notice that the border around the currently active cell changed color. Typing will insert text into the currently active cell."
}, {
element: '.selected',
title: "Back to Command Mode",
placement: 'bottom',
- onShow: function(tour) { that.notebook.command_mode(); },
+ onShow: function(tour) { notebook.command_mode(); },
onHide: function(tour) { $('#help_menu').parent().children('a').click(); },
content: "Pressing Esc
or clicking outside of the input text area takes you back to Command Mode."
}, {
diff --git a/IPython/html/static/tree/js/kernellist.js b/IPython/html/static/tree/js/kernellist.js
index 520e598..b2e4e70 100644
--- a/IPython/html/static/tree/js/kernellist.js
+++ b/IPython/html/static/tree/js/kernellist.js
@@ -12,7 +12,7 @@ define([
notebooklist.NotebookList.call(this, selector, options, 'running', session_list);
};
- KernelList.prototype = Object.create(NotebookList.prototype);
+ KernelList.prototype = Object.create(notebooklist.NotebookList.prototype);
KernelList.prototype.sessions_loaded = function (d) {
this.sessions = d;
diff --git a/IPython/html/static/tree/js/notebooklist.js b/IPython/html/static/tree/js/notebooklist.js
index c132f89..e5e3765 100644
--- a/IPython/html/static/tree/js/notebooklist.js
+++ b/IPython/html/static/tree/js/notebooklist.js
@@ -82,10 +82,10 @@ define([
that.add_upload_button(nbitem);
};
} else {
- var dialog = 'Uploaded notebooks must be .ipynb files';
+ var dialog_body = 'Uploaded notebooks must be .ipynb files';
dialog.modal({
title : 'Invalid file type',
- body : dialog,
+ body : dialog_body,
buttons : {'OK' : {'class' : 'btn-primary'}}
});
}
diff --git a/IPython/html/static/widgets/js/init.js b/IPython/html/static/widgets/js/init.js
index 36f0a8f..1d92668 100644
--- a/IPython/html/static/widgets/js/init.js
+++ b/IPython/html/static/widgets/js/init.js
@@ -12,16 +12,16 @@ define([
"widgets/js/widget_selection",
"widgets/js/widget_selectioncontainer",
"widgets/js/widget_string",
-], function(WidgetManager) {
+], function(widgetmanager) {
// Register all of the loaded views with the widget manager.
for (var i = 1; i < arguments.length; i++) {
for (var target_name in arguments[i]) {
if (arguments[i].hasOwnProperty(target_name)) {
- WidgetManager.register_widget_view(target_name, arguments[i][target_name]);
+ widgetmanager.WidgetManager.register_widget_view(target_name, arguments[i][target_name]);
}
}
}
- return {'WidgetManager': WidgetManager};
+ return {'WidgetManager': widgetmanager.WidgetManager};
});
diff --git a/IPython/html/static/widgets/js/manager.js b/IPython/html/static/widgets/js/manager.js
index 64a48cc..13f4c86 100644
--- a/IPython/html/static/widgets/js/manager.js
+++ b/IPython/html/static/widgets/js/manager.js
@@ -193,5 +193,5 @@ define([
this._models[model_id] = widget_model;
};
- return WidgetManager;
+ return {'WidgetManager': WidgetManager};
});