From 06ad682d68fe3f21155a28ec8a0a4fa598e83bc6 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Mon, 12 May 2014 14:04:39 -0700 Subject: [PATCH 01/17] Add scrollmanager --- .../static/notebook/js/keyboardmanager.js | 715 +++++++++--------- IPython/html/static/notebook/js/main.js | 6 +- .../html/static/notebook/js/scrollmanager.js | 78 ++ 3 files changed, 448 insertions(+), 351 deletions(-) create mode 100644 IPython/html/static/notebook/js/scrollmanager.js diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index bf35e0f2d..c5d213ec3 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -1,14 +1,17 @@ -// Copyright (c) IPython Development Team. -// Distributed under the terms of the Modified BSD License. +//---------------------------------------------------------------------------- +// Copyright (C) 2011 The IPython Development Team +// +// Distributed under the terms of the BSD License. The full license is in +// the file COPYING, distributed as part of this software. +//---------------------------------------------------------------------------- -define([ - 'base/js/namespace', - 'jquery', - 'base/js/utils', - 'base/js/keyboard', -], function(IPython, $, utils, keyboard) { +//============================================================================ +// Keyboard management +//============================================================================ + +var IPython = (function (IPython) { "use strict"; - + var browser = utils.browser[0]; var platform = utils.platform; @@ -40,437 +43,449 @@ define([ KeyboardManager.prototype.get_default_common_shortcuts = function() { var that = this; var shortcuts = { - 'shift' : { - help : '', - help_index : '', - handler : function (event) { - // ignore shift keydown - return true; - } - }, - 'shift-enter' : { - help : 'run cell, select below', - help_index : 'ba', - handler : function (event) { + 'shift' : { + help : '', + help_index : '', + handler : function (event) { + // ignore shift keydown + return true; + } + }, + 'shift-enter' : { + help : 'run cell, select below', + help_index : 'ba', + handler : function (event) { that.notebook.execute_cell_and_select_below(); - return false; - } - }, - 'ctrl-enter' : { - help : 'run cell', - help_index : 'bb', - handler : function (event) { + return false; + } + }, + 'ctrl-enter' : { + help : 'run cell', + help_index : 'bb', + handler : function (event) { that.notebook.execute_cell(); - return false; - } - }, - 'alt-enter' : { - help : 'run cell, insert below', - help_index : 'bc', - handler : function (event) { + return false; + } + }, + 'alt-enter' : { + help : 'run cell, insert below', + help_index : 'bc', + handler : function (event) { that.notebook.execute_cell_and_insert_below(); - return false; - } + return false; } - }; + } + }; - if (platform === 'MacOS') { + if (platform === 'MacOS') { shortcuts['cmd-s'] = - { - help : 'save notebook', - help_index : 'fb', - handler : function (event) { + { + help : 'save notebook', + help_index : 'fb', + handler : function (event) { that.notebook.save_checkpoint(); - event.preventDefault(); - return false; - } - }; - } else { + event.preventDefault(); + return false; + } + }; + } else { shortcuts['ctrl-s'] = - { - help : 'save notebook', - help_index : 'fb', - handler : function (event) { + { + help : 'save notebook', + help_index : 'fb', + handler : function (event) { that.notebook.save_checkpoint(); - event.preventDefault(); - return false; - } - }; - } + event.preventDefault(); + return false; + } + }; + } return shortcuts; }; KeyboardManager.prototype.get_default_edit_shortcuts = function() { var that = this; return { - 'esc' : { - help : 'command mode', - help_index : 'aa', - handler : function (event) { + 'esc' : { + help : 'command mode', + help_index : 'aa', + handler : function (event) { that.notebook.command_mode(); - return false; - } - }, - 'ctrl-m' : { - help : 'command mode', - help_index : 'ab', - handler : function (event) { + return false; + } + }, + 'ctrl-m' : { + help : 'command mode', + help_index : 'ab', + handler : function (event) { that.notebook.command_mode(); - return false; - } - }, - 'up' : { - help : '', - help_index : '', - handler : function (event) { + return false; + } + }, + 'up' : { + help : '', + help_index : '', + handler : function (event) { var index = that.notebook.get_selected_index(); var cell = that.notebook.get_cell(index); - if (cell && cell.at_top() && index !== 0) { - event.preventDefault(); + if (cell && cell.at_top() && index !== 0) { + event.preventDefault(); that.notebook.command_mode(); that.notebook.select_prev(); that.notebook.edit_mode(); var cm = that.notebook.get_selected_cell().code_mirror; - cm.setCursor(cm.lastLine(), 0); - return false; - } else if (cell) { - var cm = cell.code_mirror; - cm.execCommand('goLineUp'); - return false; - } + cm.setCursor(cm.lastLine(), 0); + return false; + } else if (cell) { + var cm = cell.code_mirror; + cm.execCommand('goLineUp'); + return false; } - }, - 'down' : { - help : '', - help_index : '', - handler : function (event) { + } + }, + 'down' : { + help : '', + help_index : '', + handler : function (event) { var index = that.notebook.get_selected_index(); var cell = that.notebook.get_cell(index); if (cell.at_bottom() && index !== (that.notebook.ncells()-1)) { - event.preventDefault(); + event.preventDefault(); that.notebook.command_mode(); that.notebook.select_next(); that.notebook.edit_mode(); var cm = that.notebook.get_selected_cell().code_mirror; - cm.setCursor(0, 0); - return false; - } else { - var cm = cell.code_mirror; - cm.execCommand('goLineDown'); - return false; - } - } - }, - 'ctrl-shift--' : { - help : 'split cell', - help_index : 'ea', - handler : function (event) { - that.notebook.split_cell(); + cm.setCursor(0, 0); return false; - } - }, - 'ctrl-shift-subtract' : { - help : '', - help_index : 'eb', - handler : function (event) { - that.notebook.split_cell(); + } else { + var cm = cell.code_mirror; + cm.execCommand('goLineDown'); return false; } - }, - }; + } + }, + 'ctrl-shift--' : { + help : 'split cell', + help_index : 'ea', + handler : function (event) { + that.notebook.split_cell(); + return false; + } + }, + 'ctrl-shift-subtract' : { + help : '', + help_index : 'eb', + handler : function (event) { + that.notebook.split_cell(); + return false; + } + }, + }; }; KeyboardManager.prototype.get_default_command_shortcuts = function() { var that = this; return { - 'enter' : { - help : 'edit mode', - help_index : 'aa', - handler : function (event) { + 'space': { + help: "Scroll down to next H1 cell", + handler: function(event) { + return that.notebook.scrollmanager.scroll(1); + }, + }, + 'shift-space': { + help: "Scroll up to previous H1 cell", + handler: function(event) { + return that.notebook.scrollmanager.scroll(-1); + }, + }, + 'enter' : { + help : 'edit mode', + help_index : 'aa', + handler : function (event) { that.notebook.edit_mode(); - return false; - } - }, - 'up' : { - help : 'select previous cell', - help_index : 'da', - handler : function (event) { + return false; + } + }, + 'up' : { + help : 'select previous cell', + help_index : 'da', + handler : function (event) { var index = that.notebook.get_selected_index(); - if (index !== 0 && index !== null) { + if (index !== 0 && index !== null) { that.notebook.select_prev(); that.notebook.focus_cell(); - } - return false; } - }, - 'down' : { - help : 'select next cell', - help_index : 'db', - handler : function (event) { + return false; + } + }, + 'down' : { + help : 'select next cell', + help_index : 'db', + handler : function (event) { var index = that.notebook.get_selected_index(); if (index !== (that.notebook.ncells()-1) && index !== null) { that.notebook.select_next(); that.notebook.focus_cell(); - } - return false; } - }, - 'k' : { - help : 'select previous cell', - help_index : 'dc', - handler : function (event) { + return false; + } + }, + 'k' : { + help : 'select previous cell', + help_index : 'dc', + handler : function (event) { var index = that.notebook.get_selected_index(); - if (index !== 0 && index !== null) { + if (index !== 0 && index !== null) { that.notebook.select_prev(); that.notebook.focus_cell(); - } - return false; } - }, - 'j' : { - help : 'select next cell', - help_index : 'dd', - handler : function (event) { + return false; + } + }, + 'j' : { + help : 'select next cell', + help_index : 'dd', + handler : function (event) { var index = that.notebook.get_selected_index(); if (index !== (that.notebook.ncells()-1) && index !== null) { that.notebook.select_next(); that.notebook.focus_cell(); - } - return false; } - }, - 'x' : { - help : 'cut cell', - help_index : 'ee', - handler : function (event) { + return false; + } + }, + 'x' : { + help : 'cut cell', + help_index : 'ee', + handler : function (event) { that.notebook.cut_cell(); - return false; - } - }, - 'c' : { - help : 'copy cell', - help_index : 'ef', - handler : function (event) { + return false; + } + }, + 'c' : { + help : 'copy cell', + help_index : 'ef', + handler : function (event) { that.notebook.copy_cell(); - return false; - } - }, - 'shift-v' : { - help : 'paste cell above', - help_index : 'eg', - handler : function (event) { + return false; + } + }, + 'shift-v' : { + help : 'paste cell above', + help_index : 'eg', + handler : function (event) { that.notebook.paste_cell_above(); - return false; - } - }, - 'v' : { - help : 'paste cell below', - help_index : 'eh', - handler : function (event) { + return false; + } + }, + 'v' : { + help : 'paste cell below', + help_index : 'eh', + handler : function (event) { that.notebook.paste_cell_below(); - return false; - } - }, - 'd' : { - help : 'delete cell (press twice)', - help_index : 'ej', - count: 2, - handler : function (event) { + return false; + } + }, + 'd' : { + help : 'delete cell (press twice)', + help_index : 'ej', + count: 2, + handler : function (event) { that.notebook.delete_cell(); - return false; - } - }, - 'a' : { - help : 'insert cell above', - help_index : 'ec', - handler : function (event) { + return false; + } + }, + 'a' : { + help : 'insert cell above', + help_index : 'ec', + handler : function (event) { that.notebook.insert_cell_above(); that.notebook.select_prev(); that.notebook.focus_cell(); - return false; - } - }, - 'b' : { - help : 'insert cell below', - help_index : 'ed', - handler : function (event) { + return false; + } + }, + 'b' : { + help : 'insert cell below', + help_index : 'ed', + handler : function (event) { that.notebook.insert_cell_below(); that.notebook.select_next(); that.notebook.focus_cell(); - return false; - } - }, - 'y' : { - help : 'to code', - help_index : 'ca', - handler : function (event) { + return false; + } + }, + 'y' : { + help : 'to code', + help_index : 'ca', + handler : function (event) { that.notebook.to_code(); - return false; - } - }, - 'm' : { - help : 'to markdown', - help_index : 'cb', - handler : function (event) { + return false; + } + }, + 'm' : { + help : 'to markdown', + help_index : 'cb', + handler : function (event) { that.notebook.to_markdown(); - return false; - } - }, - 'r' : { - help : 'to raw', - help_index : 'cc', - handler : function (event) { + return false; + } + }, + 'r' : { + help : 'to raw', + help_index : 'cc', + handler : function (event) { that.notebook.to_raw(); - return false; - } - }, - '1' : { - help : 'to heading 1', - help_index : 'cd', - handler : function (event) { + return false; + } + }, + '1' : { + help : 'to heading 1', + help_index : 'cd', + handler : function (event) { that.notebook.to_heading(undefined, 1); - return false; - } - }, - '2' : { - help : 'to heading 2', - help_index : 'ce', - handler : function (event) { + return false; + } + }, + '2' : { + help : 'to heading 2', + help_index : 'ce', + handler : function (event) { that.notebook.to_heading(undefined, 2); - return false; - } - }, - '3' : { - help : 'to heading 3', - help_index : 'cf', - handler : function (event) { + return false; + } + }, + '3' : { + help : 'to heading 3', + help_index : 'cf', + handler : function (event) { that.notebook.to_heading(undefined, 3); - return false; - } - }, - '4' : { - help : 'to heading 4', - help_index : 'cg', - handler : function (event) { + return false; + } + }, + '4' : { + help : 'to heading 4', + help_index : 'cg', + handler : function (event) { that.notebook.to_heading(undefined, 4); - return false; - } - }, - '5' : { - help : 'to heading 5', - help_index : 'ch', - handler : function (event) { + return false; + } + }, + '5' : { + help : 'to heading 5', + help_index : 'ch', + handler : function (event) { that.notebook.to_heading(undefined, 5); - return false; - } - }, - '6' : { - help : 'to heading 6', - help_index : 'ci', - handler : function (event) { + return false; + } + }, + '6' : { + help : 'to heading 6', + help_index : 'ci', + handler : function (event) { that.notebook.to_heading(undefined, 6); - return false; - } - }, - 'o' : { - help : 'toggle output', - help_index : 'gb', - handler : function (event) { + return false; + } + }, + 'o' : { + help : 'toggle output', + help_index : 'gb', + handler : function (event) { that.notebook.toggle_output(); - return false; - } - }, - 'shift-o' : { - help : 'toggle output scrolling', - help_index : 'gc', - handler : function (event) { + return false; + } + }, + 'shift-o' : { + help : 'toggle output scrolling', + help_index : 'gc', + handler : function (event) { that.notebook.toggle_output_scroll(); - return false; - } - }, - 's' : { - help : 'save notebook', - help_index : 'fa', - handler : function (event) { + return false; + } + }, + 's' : { + help : 'save notebook', + help_index : 'fa', + handler : function (event) { that.notebook.save_checkpoint(); - return false; - } - }, - 'ctrl-j' : { - help : 'move cell down', - help_index : 'eb', - handler : function (event) { + return false; + } + }, + 'ctrl-j' : { + help : 'move cell down', + help_index : 'eb', + handler : function (event) { that.notebook.move_cell_down(); - return false; - } - }, - 'ctrl-k' : { - help : 'move cell up', - help_index : 'ea', - handler : function (event) { + return false; + } + }, + 'ctrl-k' : { + help : 'move cell up', + help_index : 'ea', + handler : function (event) { that.notebook.move_cell_up(); - return false; - } - }, - 'l' : { - help : 'toggle line numbers', - help_index : 'ga', - handler : function (event) { + return false; + } + }, + 'l' : { + help : 'toggle line numbers', + help_index : 'ga', + handler : function (event) { that.notebook.cell_toggle_line_numbers(); - return false; - } - }, - 'i' : { - help : 'interrupt kernel (press twice)', - help_index : 'ha', - count: 2, - handler : function (event) { + return false; + } + }, + 'i' : { + help : 'interrupt kernel (press twice)', + help_index : 'ha', + count: 2, + handler : function (event) { that.notebook.kernel.interrupt(); - return false; - } - }, - '0' : { - help : 'restart kernel (press twice)', - help_index : 'hb', - count: 2, - handler : function (event) { + return false; + } + }, + '0' : { + help : 'restart kernel (press twice)', + help_index : 'hb', + count: 2, + handler : function (event) { that.notebook.restart_kernel(); - return false; - } - }, - 'h' : { - help : 'keyboard shortcuts', - help_index : 'ge', - handler : function (event) { + return false; + } + }, + 'h' : { + help : 'keyboard shortcuts', + help_index : 'ge', + handler : function (event) { that.quick_help.show_keyboard_shortcuts(); - return false; - } - }, - 'z' : { - help : 'undo last delete', - help_index : 'ei', - handler : function (event) { + return false; + } + }, + 'z' : { + help : 'undo last delete', + help_index : 'ei', + handler : function (event) { that.notebook.undelete_cell(); - return false; - } - }, - 'shift-m' : { - help : 'merge cell below', - help_index : 'ek', - handler : function (event) { + return false; + } + }, + 'shift-m' : { + help : 'merge cell below', + help_index : 'ek', + handler : function (event) { that.notebook.merge_cell_below(); - return false; - } - }, - 'q' : { - help : 'close pager', - help_index : 'gd', - handler : function (event) { + return false; + } + }, + 'q' : { + help : 'close pager', + help_index : 'gd', + handler : function (event) { that.pager.collapse(); - return false; - } - }, - }; + return false; + } + }, + }; }; KeyboardManager.prototype.bind_events = function () { diff --git a/IPython/html/static/notebook/js/main.js b/IPython/html/static/notebook/js/main.js index 4ddee4b8e..acfa4d531 100644 --- a/IPython/html/static/notebook/js/main.js +++ b/IPython/html/static/notebook/js/main.js @@ -19,6 +19,7 @@ require([ 'notebook/js/keyboardmanager', 'notebook/js/config', 'notebook/js/kernelselector', + 'notebook/js/scrollmanager' // only loaded, not used: 'custom/custom', ], function( @@ -38,7 +39,8 @@ require([ savewidget, keyboardmanager, config, - kernelselector + kernelselector, + scrollmanager ) { "use strict"; @@ -67,6 +69,7 @@ require([ save_widget: save_widget, config: user_config}, common_options)); + var scrollmanager = new scrollmanager.ScrollManager(notebook); var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options); var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', { notebook: notebook, @@ -132,6 +135,7 @@ require([ IPython.save_widget = save_widget; IPython.config = user_config; IPython.tooltip = notebook.tooltip; + IPython.scrollmanager = scrollmanager; events.trigger('app_initialized.NotebookApp'); notebook.load_notebook(common_options.notebook_name, common_options.notebook_path); diff --git a/IPython/html/static/notebook/js/scrollmanager.js b/IPython/html/static/notebook/js/scrollmanager.js new file mode 100644 index 000000000..bd3465ad2 --- /dev/null +++ b/IPython/html/static/notebook/js/scrollmanager.js @@ -0,0 +1,78 @@ +// Copyright (c) IPython Development Team. +// Distributed under the terms of the Modified BSD License. +define([], function(){ + "use strict"; + + var ScrollManager = function (notebook) { + // Public constructor. + this.notebook = notebook; + }; + + ScrollManager.prototype.scroll = function (delta) { + // Scroll the document. + // + // Parameters + // ---------- + // delta: integer + // direction to scroll the document. Positive is downwards. + + // If one or more slides exist, scroll to the slide. + var $slide_cells = $('.slideshow-slide'); + if ($slide_cells.length > 0) { + var i, cell; + + // Get the active slide cell index. + var selected_index = this.notebook.find_cell_index(this.notebook.get_selected_cell()); + var active_slide = -1; + var cells = this.notebook.get_cells(); + for (i = selected_index; i >= 0; i--) { + cell = cells[i]; + var ns = cell.metadata.slideshow; + if (ns && ns.slide_type == 'slide') { + active_slide = i; + break; + } + } + + // Translate cell index into slide cell index. + if (active_slide != -1) { + for (i = 0; i < $slide_cells.length; i++) { + if (cells[active_slide].element[0] == $slide_cells[i]) { + active_slide = i; + break; + } + } + } + + // Scroll. + if (active_slide != -1 || delta > 0) { + active_slide += delta; + active_slide = Math.max(0, Math.min($slide_cells.length-1, active_slide)); + + var cell_element = $slide_cells[active_slide]; + cell = $(cell_element).data('cell'); + this.notebook.select(this.notebook.find_cell_index(cell)); + + this.scroll_to(cell_element); + //cell_element.scrollIntoView(true); + } + + // Cancel browser keyboard scroll. + return false; + + // No slides exist, default browser scroll + } else { + return true; + } + }; + + ScrollManager.prototype.scroll_to = function(destination) { + $('html, body').animate({'scrollTop': element.offset().top}, 'slow', 'swing'); + }; + + // For convinience, add the ScrollManager class to the global namespace + IPython.ScrollManager = ScrollManager; + // Return naemspace for require.js loads + return ScrollManager; + +}); From 617f078165f258f1bf8415d3bd3a90b2b2adbf1c Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Mon, 12 May 2014 14:33:24 -0700 Subject: [PATCH 02/17] Make slideshow toolbar add classes to modified cells. --- .../js/celltoolbarpresets/slideshow.js | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/IPython/html/static/notebook/js/celltoolbarpresets/slideshow.js b/IPython/html/static/notebook/js/celltoolbarpresets/slideshow.js index 6b2b35e87..1baffcb9a 100644 --- a/IPython/html/static/notebook/js/celltoolbarpresets/slideshow.js +++ b/IPython/html/static/notebook/js/celltoolbarpresets/slideshow.js @@ -11,6 +11,24 @@ define([ var CellToolbar = celltoolbar.CellToolbar; var slideshow_preset = []; + var _update_cell = function(cell, old_slide_class) { + // Remove the old slide DOM class if set. + if (old_slide_class && old_slide_class != '-') { + cell.element.removeClass('slideshow-'+old_slide_class); + } + // add a DOM class to the cell + var value = _get_cell_type(cell); + if (value != '-') { cell.element.addClass('slideshow-'+value); } + }; + + var _get_cell_type = function(cell) { + var ns = cell.metadata.slideshow; + // if the slideshow namespace does not exist return `undefined` + // (will be interpreted as `false` by checkbox) otherwise + // return the value + return (ns === undefined)? undefined: ns.slide_type; + }; + var select_type = CellToolbar.utils.select_ui_generator([ ["-" ,"-" ], ["Slide" ,"slide" ], @@ -24,15 +42,13 @@ define([ // we check that the slideshow namespace exist and create it if needed if (cell.metadata.slideshow === undefined){cell.metadata.slideshow = {};} // set the value + var old = cell.metadata.slideshow.slide_type; cell.metadata.slideshow.slide_type = value; + // update the slideshow class set on the cell + _update_cell(cell, old); }, //geter - function(cell){ var ns = cell.metadata.slideshow; - // if the slideshow namespace does not exist return `undefined` - // (will be interpreted as `false` by checkbox) otherwise - // return the value - return (ns === undefined)? undefined: ns.slide_type; - }, + _get_cell_type, "Slide Type"); var register = function (notebook) { From c2d72353a2a4c7f5d9074bbcdde2b6aea05db917 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Mon, 12 May 2014 14:50:07 -0700 Subject: [PATCH 03/17] Fixed bug --- IPython/html/static/notebook/js/keyboardmanager.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index c5d213ec3..fba065336 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -1,13 +1,5 @@ -//---------------------------------------------------------------------------- -// Copyright (C) 2011 The IPython Development Team -// -// Distributed under the terms of the BSD License. The full license is in -// the file COPYING, distributed as part of this software. -//---------------------------------------------------------------------------- - -//============================================================================ -// Keyboard management -//============================================================================ +// Copyright (c) IPython Development Team. +// Distributed under the terms of the Modified BSD License. var IPython = (function (IPython) { "use strict"; From 5c5025f3b623ca7205f229307fd94674016e6c02 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Mon, 12 May 2014 14:50:19 -0700 Subject: [PATCH 04/17] Added smooth scroll to replace std browser behavior. --- IPython/html/static/notebook/js/scrollmanager.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/IPython/html/static/notebook/js/scrollmanager.js b/IPython/html/static/notebook/js/scrollmanager.js index bd3465ad2..912d3aad5 100644 --- a/IPython/html/static/notebook/js/scrollmanager.js +++ b/IPython/html/static/notebook/js/scrollmanager.js @@ -6,6 +6,7 @@ define([], function(){ var ScrollManager = function (notebook) { // Public constructor. this.notebook = notebook; + this.animation_speed = 250; //ms }; ScrollManager.prototype.scroll = function (delta) { @@ -60,14 +61,22 @@ define([], function(){ // Cancel browser keyboard scroll. return false; - // No slides exist, default browser scroll + // No slides exist, scroll up or down one page height. Instead of using + // the browser's built in method to do this, animate it using jQuery. } else { - return true; + this.scroll_some(delta); + return false; } }; ScrollManager.prototype.scroll_to = function(destination) { - $('html, body').animate({'scrollTop': element.offset().top}, 'slow', 'swing'); + // Scroll to an element in the notebook. + $('#notebook').animate({'scrollTop': $(destination).offset().top + $('#notebook').scrollTop() - $('#notebook').offset().top}, this.animation_speed); + }; + + ScrollManager.prototype.scroll_some = function(pages) { + // Scroll up or down a given number of pages. + $('#notebook').animate({'scrollTop': $('#notebook').scrollTop() + pages * $('#notebook').height()}, this.animation_speed); }; // For convinience, add the ScrollManager class to the global namespace From 62a21b0e6f3d2d7a9214e4d17503cc9242cbb6b5 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Mon, 2 Jun 2014 14:02:44 -0700 Subject: [PATCH 05/17] Add ScrollManager to global ipy namespace in main.js instead of, in the bottom of the scroll manager js file. --- IPython/html/static/notebook/js/scrollmanager.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/IPython/html/static/notebook/js/scrollmanager.js b/IPython/html/static/notebook/js/scrollmanager.js index 912d3aad5..cbc7d4b8e 100644 --- a/IPython/html/static/notebook/js/scrollmanager.js +++ b/IPython/html/static/notebook/js/scrollmanager.js @@ -79,9 +79,6 @@ define([], function(){ $('#notebook').animate({'scrollTop': $('#notebook').scrollTop() + pages * $('#notebook').height()}, this.animation_speed); }; - // For convinience, add the ScrollManager class to the global namespace - IPython.ScrollManager = ScrollManager; // Return naemspace for require.js loads return ScrollManager; - }); From 7e7683a587904ae077f1d4bdc4c56a10bf22ae7e Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Fri, 25 Jul 2014 17:14:21 -0700 Subject: [PATCH 06/17] Added scroll mode selector, fixed rebase conflicts. --- .../static/notebook/js/keyboardmanager.js | 723 +++++++++--------- IPython/html/static/notebook/js/main.js | 6 +- .../html/static/notebook/js/maintoolbar.js | 9 +- IPython/html/static/notebook/js/notebook.js | 9 +- .../html/static/notebook/js/scrollmanager.js | 122 ++- 5 files changed, 487 insertions(+), 382 deletions(-) diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index fba065336..ccf2198d7 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -1,7 +1,12 @@ // Copyright (c) IPython Development Team. // Distributed under the terms of the Modified BSD License. -var IPython = (function (IPython) { +define([ + 'base/js/namespace', + 'jquery', + 'base/js/utils', + 'base/js/keyboard', +], function(IPython, $, utils, keyboard) { "use strict"; var browser = utils.browser[0]; @@ -98,386 +103,386 @@ var IPython = (function (IPython) { KeyboardManager.prototype.get_default_edit_shortcuts = function() { var that = this; return { - 'esc' : { - help : 'command mode', - help_index : 'aa', - handler : function (event) { - that.notebook.command_mode(); - return false; - } - }, - 'ctrl-m' : { - help : 'command mode', - help_index : 'ab', - handler : function (event) { - that.notebook.command_mode(); - return false; - } - }, - 'up' : { - help : '', - help_index : '', - handler : function (event) { - var index = that.notebook.get_selected_index(); - var cell = that.notebook.get_cell(index); - if (cell && cell.at_top() && index !== 0) { - event.preventDefault(); + 'esc' : { + help : 'command mode', + help_index : 'aa', + handler : function (event) { that.notebook.command_mode(); - that.notebook.select_prev(); - that.notebook.edit_mode(); - var cm = that.notebook.get_selected_cell().code_mirror; - cm.setCursor(cm.lastLine(), 0); - return false; - } else if (cell) { - var cm = cell.code_mirror; - cm.execCommand('goLineUp'); return false; } - } - }, - 'down' : { - help : '', - help_index : '', - handler : function (event) { - var index = that.notebook.get_selected_index(); - var cell = that.notebook.get_cell(index); - if (cell.at_bottom() && index !== (that.notebook.ncells()-1)) { - event.preventDefault(); + }, + 'ctrl-m' : { + help : 'command mode', + help_index : 'ab', + handler : function (event) { that.notebook.command_mode(); - that.notebook.select_next(); - that.notebook.edit_mode(); - var cm = that.notebook.get_selected_cell().code_mirror; - cm.setCursor(0, 0); return false; - } else { - var cm = cell.code_mirror; - cm.execCommand('goLineDown'); + } + }, + 'up' : { + help : '', + help_index : '', + handler : function (event) { + var index = that.notebook.get_selected_index(); + var cell = that.notebook.get_cell(index); + if (cell && cell.at_top() && index !== 0) { + event.preventDefault(); + that.notebook.command_mode(); + that.notebook.select_prev(); + that.notebook.edit_mode(); + var cm = that.notebook.get_selected_cell().code_mirror; + cm.setCursor(cm.lastLine(), 0); + return false; + } else if (cell) { + var cm = cell.code_mirror; + cm.execCommand('goLineUp'); + return false; + } + } + }, + 'down' : { + help : '', + help_index : '', + handler : function (event) { + var index = that.notebook.get_selected_index(); + var cell = that.notebook.get_cell(index); + if (cell.at_bottom() && index !== (that.notebook.ncells()-1)) { + event.preventDefault(); + that.notebook.command_mode(); + that.notebook.select_next(); + that.notebook.edit_mode(); + var cm = that.notebook.get_selected_cell().code_mirror; + cm.setCursor(0, 0); + return false; + } else { + var cm = cell.code_mirror; + cm.execCommand('goLineDown'); + return false; + } + } + }, + 'ctrl-shift--' : { + help : 'split cell', + help_index : 'ea', + handler : function (event) { + that.notebook.split_cell(); return false; } - } - }, - 'ctrl-shift--' : { - help : 'split cell', - help_index : 'ea', - handler : function (event) { - that.notebook.split_cell(); - return false; - } - }, - 'ctrl-shift-subtract' : { - help : '', - help_index : 'eb', - handler : function (event) { - that.notebook.split_cell(); - return false; - } - }, - }; + }, + 'ctrl-shift-subtract' : { + help : '', + help_index : 'eb', + handler : function (event) { + that.notebook.split_cell(); + return false; + } + }, + }; }; KeyboardManager.prototype.get_default_command_shortcuts = function() { var that = this; return { - 'space': { - help: "Scroll down to next H1 cell", - handler: function(event) { - return that.notebook.scrollmanager.scroll(1); + 'space': { + help: "Scroll down to next H1 cell", + handler: function(event) { + return that.notebook.scrollmanager.scroll(1); + }, }, - }, - 'shift-space': { - help: "Scroll up to previous H1 cell", - handler: function(event) { - return that.notebook.scrollmanager.scroll(-1); + 'shift-space': { + help: "Scroll up to previous H1 cell", + handler: function(event) { + return that.notebook.scrollmanager.scroll(-1); + }, }, - }, - 'enter' : { - help : 'edit mode', - help_index : 'aa', - handler : function (event) { - that.notebook.edit_mode(); - return false; - } - }, - 'up' : { - help : 'select previous cell', - help_index : 'da', - handler : function (event) { - var index = that.notebook.get_selected_index(); - if (index !== 0 && index !== null) { - that.notebook.select_prev(); - that.notebook.focus_cell(); + 'enter' : { + help : 'edit mode', + help_index : 'aa', + handler : function (event) { + that.notebook.edit_mode(); + return false; } - return false; - } - }, - 'down' : { - help : 'select next cell', - help_index : 'db', - handler : function (event) { - var index = that.notebook.get_selected_index(); - if (index !== (that.notebook.ncells()-1) && index !== null) { - that.notebook.select_next(); - that.notebook.focus_cell(); + }, + 'up' : { + help : 'select previous cell', + help_index : 'da', + handler : function (event) { + var index = that.notebook.get_selected_index(); + if (index !== 0 && index !== null) { + that.notebook.select_prev(); + that.notebook.focus_cell(); + } + return false; } - return false; - } - }, - 'k' : { - help : 'select previous cell', - help_index : 'dc', - handler : function (event) { - var index = that.notebook.get_selected_index(); - if (index !== 0 && index !== null) { + }, + 'down' : { + help : 'select next cell', + help_index : 'db', + handler : function (event) { + var index = that.notebook.get_selected_index(); + if (index !== (that.notebook.ncells()-1) && index !== null) { + that.notebook.select_next(); + that.notebook.focus_cell(); + } + return false; + } + }, + 'k' : { + help : 'select previous cell', + help_index : 'dc', + handler : function (event) { + var index = that.notebook.get_selected_index(); + if (index !== 0 && index !== null) { + that.notebook.select_prev(); + that.notebook.focus_cell(); + } + return false; + } + }, + 'j' : { + help : 'select next cell', + help_index : 'dd', + handler : function (event) { + var index = that.notebook.get_selected_index(); + if (index !== (that.notebook.ncells()-1) && index !== null) { + that.notebook.select_next(); + that.notebook.focus_cell(); + } + return false; + } + }, + 'x' : { + help : 'cut cell', + help_index : 'ee', + handler : function (event) { + that.notebook.cut_cell(); + return false; + } + }, + 'c' : { + help : 'copy cell', + help_index : 'ef', + handler : function (event) { + that.notebook.copy_cell(); + return false; + } + }, + 'shift-v' : { + help : 'paste cell above', + help_index : 'eg', + handler : function (event) { + that.notebook.paste_cell_above(); + return false; + } + }, + 'v' : { + help : 'paste cell below', + help_index : 'eh', + handler : function (event) { + that.notebook.paste_cell_below(); + return false; + } + }, + 'd' : { + help : 'delete cell (press twice)', + help_index : 'ej', + count: 2, + handler : function (event) { + that.notebook.delete_cell(); + return false; + } + }, + 'a' : { + help : 'insert cell above', + help_index : 'ec', + handler : function (event) { + that.notebook.insert_cell_above(); that.notebook.select_prev(); that.notebook.focus_cell(); + return false; } - return false; - } - }, - 'j' : { - help : 'select next cell', - help_index : 'dd', - handler : function (event) { - var index = that.notebook.get_selected_index(); - if (index !== (that.notebook.ncells()-1) && index !== null) { + }, + 'b' : { + help : 'insert cell below', + help_index : 'ed', + handler : function (event) { + that.notebook.insert_cell_below(); that.notebook.select_next(); that.notebook.focus_cell(); + return false; } - return false; - } - }, - 'x' : { - help : 'cut cell', - help_index : 'ee', - handler : function (event) { - that.notebook.cut_cell(); - return false; - } - }, - 'c' : { - help : 'copy cell', - help_index : 'ef', - handler : function (event) { - that.notebook.copy_cell(); - return false; - } - }, - 'shift-v' : { - help : 'paste cell above', - help_index : 'eg', - handler : function (event) { - that.notebook.paste_cell_above(); - return false; - } - }, - 'v' : { - help : 'paste cell below', - help_index : 'eh', - handler : function (event) { - that.notebook.paste_cell_below(); - return false; - } - }, - 'd' : { - help : 'delete cell (press twice)', - help_index : 'ej', - count: 2, - handler : function (event) { - that.notebook.delete_cell(); - return false; - } - }, - 'a' : { - help : 'insert cell above', - help_index : 'ec', - handler : function (event) { - that.notebook.insert_cell_above(); - that.notebook.select_prev(); - that.notebook.focus_cell(); - return false; - } - }, - 'b' : { - help : 'insert cell below', - help_index : 'ed', - handler : function (event) { - that.notebook.insert_cell_below(); - that.notebook.select_next(); - that.notebook.focus_cell(); - return false; - } - }, - 'y' : { - help : 'to code', - help_index : 'ca', - handler : function (event) { - that.notebook.to_code(); - return false; - } - }, - 'm' : { - help : 'to markdown', - help_index : 'cb', - handler : function (event) { - that.notebook.to_markdown(); - return false; - } - }, - 'r' : { - help : 'to raw', - help_index : 'cc', - handler : function (event) { - that.notebook.to_raw(); - return false; - } - }, - '1' : { - help : 'to heading 1', - help_index : 'cd', - handler : function (event) { - that.notebook.to_heading(undefined, 1); - return false; - } - }, - '2' : { - help : 'to heading 2', - help_index : 'ce', - handler : function (event) { - that.notebook.to_heading(undefined, 2); - return false; - } - }, - '3' : { - help : 'to heading 3', - help_index : 'cf', - handler : function (event) { - that.notebook.to_heading(undefined, 3); - return false; - } - }, - '4' : { - help : 'to heading 4', - help_index : 'cg', - handler : function (event) { - that.notebook.to_heading(undefined, 4); - return false; - } - }, - '5' : { - help : 'to heading 5', - help_index : 'ch', - handler : function (event) { - that.notebook.to_heading(undefined, 5); - return false; - } - }, - '6' : { - help : 'to heading 6', - help_index : 'ci', - handler : function (event) { - that.notebook.to_heading(undefined, 6); - return false; - } - }, - 'o' : { - help : 'toggle output', - help_index : 'gb', - handler : function (event) { - that.notebook.toggle_output(); - return false; - } - }, - 'shift-o' : { - help : 'toggle output scrolling', - help_index : 'gc', - handler : function (event) { - that.notebook.toggle_output_scroll(); - return false; - } - }, - 's' : { - help : 'save notebook', - help_index : 'fa', - handler : function (event) { - that.notebook.save_checkpoint(); - return false; - } - }, - 'ctrl-j' : { - help : 'move cell down', - help_index : 'eb', - handler : function (event) { - that.notebook.move_cell_down(); - return false; - } - }, - 'ctrl-k' : { - help : 'move cell up', - help_index : 'ea', - handler : function (event) { - that.notebook.move_cell_up(); - return false; - } - }, - 'l' : { - help : 'toggle line numbers', - help_index : 'ga', - handler : function (event) { - that.notebook.cell_toggle_line_numbers(); - return false; - } - }, - 'i' : { - help : 'interrupt kernel (press twice)', - help_index : 'ha', - count: 2, - handler : function (event) { - that.notebook.kernel.interrupt(); - return false; - } - }, - '0' : { - help : 'restart kernel (press twice)', - help_index : 'hb', - count: 2, - handler : function (event) { - that.notebook.restart_kernel(); - return false; - } - }, - 'h' : { - help : 'keyboard shortcuts', - help_index : 'ge', - handler : function (event) { - that.quick_help.show_keyboard_shortcuts(); - return false; - } - }, - 'z' : { - help : 'undo last delete', - help_index : 'ei', - handler : function (event) { - that.notebook.undelete_cell(); - return false; - } - }, - 'shift-m' : { - help : 'merge cell below', - help_index : 'ek', - handler : function (event) { - that.notebook.merge_cell_below(); - return false; - } - }, - 'q' : { - help : 'close pager', - help_index : 'gd', - handler : function (event) { - that.pager.collapse(); - return false; - } - }, - }; + }, + 'y' : { + help : 'to code', + help_index : 'ca', + handler : function (event) { + that.notebook.to_code(); + return false; + } + }, + 'm' : { + help : 'to markdown', + help_index : 'cb', + handler : function (event) { + that.notebook.to_markdown(); + return false; + } + }, + 'r' : { + help : 'to raw', + help_index : 'cc', + handler : function (event) { + that.notebook.to_raw(); + return false; + } + }, + '1' : { + help : 'to heading 1', + help_index : 'cd', + handler : function (event) { + that.notebook.to_heading(undefined, 1); + return false; + } + }, + '2' : { + help : 'to heading 2', + help_index : 'ce', + handler : function (event) { + that.notebook.to_heading(undefined, 2); + return false; + } + }, + '3' : { + help : 'to heading 3', + help_index : 'cf', + handler : function (event) { + that.notebook.to_heading(undefined, 3); + return false; + } + }, + '4' : { + help : 'to heading 4', + help_index : 'cg', + handler : function (event) { + that.notebook.to_heading(undefined, 4); + return false; + } + }, + '5' : { + help : 'to heading 5', + help_index : 'ch', + handler : function (event) { + that.notebook.to_heading(undefined, 5); + return false; + } + }, + '6' : { + help : 'to heading 6', + help_index : 'ci', + handler : function (event) { + that.notebook.to_heading(undefined, 6); + return false; + } + }, + 'o' : { + help : 'toggle output', + help_index : 'gb', + handler : function (event) { + that.notebook.toggle_output(); + return false; + } + }, + 'shift-o' : { + help : 'toggle output scrolling', + help_index : 'gc', + handler : function (event) { + that.notebook.toggle_output_scroll(); + return false; + } + }, + 's' : { + help : 'save notebook', + help_index : 'fa', + handler : function (event) { + that.notebook.save_checkpoint(); + return false; + } + }, + 'ctrl-j' : { + help : 'move cell down', + help_index : 'eb', + handler : function (event) { + that.notebook.move_cell_down(); + return false; + } + }, + 'ctrl-k' : { + help : 'move cell up', + help_index : 'ea', + handler : function (event) { + that.notebook.move_cell_up(); + return false; + } + }, + 'l' : { + help : 'toggle line numbers', + help_index : 'ga', + handler : function (event) { + that.notebook.cell_toggle_line_numbers(); + return false; + } + }, + 'i' : { + help : 'interrupt kernel (press twice)', + help_index : 'ha', + count: 2, + handler : function (event) { + that.notebook.kernel.interrupt(); + return false; + } + }, + '0' : { + help : 'restart kernel (press twice)', + help_index : 'hb', + count: 2, + handler : function (event) { + that.notebook.restart_kernel(); + return false; + } + }, + 'h' : { + help : 'keyboard shortcuts', + help_index : 'ge', + handler : function (event) { + that.quick_help.show_keyboard_shortcuts(); + return false; + } + }, + 'z' : { + help : 'undo last delete', + help_index : 'ei', + handler : function (event) { + that.notebook.undelete_cell(); + return false; + } + }, + 'shift-m' : { + help : 'merge cell below', + help_index : 'ek', + handler : function (event) { + that.notebook.merge_cell_below(); + return false; + } + }, + 'q' : { + help : 'close pager', + help_index : 'gd', + handler : function (event) { + that.pager.collapse(); + return false; + } + }, + }; }; KeyboardManager.prototype.bind_events = function () { diff --git a/IPython/html/static/notebook/js/main.js b/IPython/html/static/notebook/js/main.js index acfa4d531..4ddee4b8e 100644 --- a/IPython/html/static/notebook/js/main.js +++ b/IPython/html/static/notebook/js/main.js @@ -19,7 +19,6 @@ require([ 'notebook/js/keyboardmanager', 'notebook/js/config', 'notebook/js/kernelselector', - 'notebook/js/scrollmanager' // only loaded, not used: 'custom/custom', ], function( @@ -39,8 +38,7 @@ require([ savewidget, keyboardmanager, config, - kernelselector, - scrollmanager + kernelselector ) { "use strict"; @@ -69,7 +67,6 @@ require([ save_widget: save_widget, config: user_config}, common_options)); - var scrollmanager = new scrollmanager.ScrollManager(notebook); var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options); var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', { notebook: notebook, @@ -135,7 +132,6 @@ require([ IPython.save_widget = save_widget; IPython.config = user_config; IPython.tooltip = notebook.tooltip; - IPython.scrollmanager = scrollmanager; events.trigger('app_initialized.NotebookApp'); notebook.load_notebook(common_options.notebook_name, common_options.notebook_path); diff --git a/IPython/html/static/notebook/js/maintoolbar.js b/IPython/html/static/notebook/js/maintoolbar.js index 593704a60..54d8e3105 100644 --- a/IPython/html/static/notebook/js/maintoolbar.js +++ b/IPython/html/static/notebook/js/maintoolbar.js @@ -6,7 +6,8 @@ define([ 'jquery', 'notebook/js/toolbar', 'notebook/js/celltoolbar', -], function(IPython, $, toolbar, celltoolbar) { + 'notebook/js/scrollmanager' +], function(IPython, $, toolbar, celltoolbar, scrollmanager) { "use strict"; var MainToolBar = function (selector, options) { @@ -24,6 +25,7 @@ define([ this.construct(); this.add_celltype_list(); this.add_celltoolbar_list(); + this.add_scrollmanager_list(); this.bind_events(); }; @@ -187,6 +189,11 @@ define([ }; + MainToolBar.prototype.add_scrollmanager_list = function () { + this._scrollselector = new scrollmanager.ScrollSelector(this.element, this.notebook); + }; + + MainToolBar.prototype.bind_events = function () { var that = this; diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index 98d6e9a88..776f8914e 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -18,6 +18,7 @@ define([ 'notebook/js/celltoolbarpresets/default', 'notebook/js/celltoolbarpresets/rawcell', 'notebook/js/celltoolbarpresets/slideshow', + 'notebook/js/scrollmanager' ], function ( IPython, $, @@ -34,7 +35,8 @@ define([ tooltip, default_celltoolbar, rawcell_celltoolbar, - slideshow_celltoolbar + slideshow_celltoolbar, + scrollmanager ) { var Notebook = function (selector, options) { @@ -64,6 +66,9 @@ define([ this.ws_url = options.ws_url; this._session_starting = false; this.default_cell_type = this.config.default_cell_type || 'code'; + + // Create and register scroll managers. + this.scrollmanager = new scrollmanager.ScrollManager(this); // default_kernel_name is a temporary measure while we implement proper // kernel selection and delayed start. Do not rely on it. this.default_kernel_name = 'python'; @@ -135,7 +140,7 @@ define([ rawcell_celltoolbar.register(this); slideshow_celltoolbar.register(this); }; - + Notebook.options_default = { // can be any cell type, or the special values of // 'above', 'below', or 'selected' to get the value from another cell. diff --git a/IPython/html/static/notebook/js/scrollmanager.js b/IPython/html/static/notebook/js/scrollmanager.js index cbc7d4b8e..2b8242698 100644 --- a/IPython/html/static/notebook/js/scrollmanager.js +++ b/IPython/html/static/notebook/js/scrollmanager.js @@ -1,9 +1,51 @@ // Copyright (c) IPython Development Team. // Distributed under the terms of the Modified BSD License. -define([], function(){ +define(['jquery'], function($){ "use strict"; - var ScrollManager = function (notebook) { + var ScrollSelector = function(element, notebook) { + // Public constructor. + this.notebook = notebook; + $('') + .addClass('nabar-text') + .text('Scrolling Mode:') + .appendTo(element); + this._combo = $('') @@ -188,12 +187,10 @@ define([ }); }; - MainToolBar.prototype.add_scrollmanager_list = function () { this._scrollselector = new scrollmanager.ScrollSelector(this.element, this.notebook); }; - MainToolBar.prototype.bind_events = function () { var that = this; From 27058f48045cd350526e18a13aa9117279eaf1a4 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Fri, 8 Aug 2014 14:40:26 -0700 Subject: [PATCH 09/17] Removed ScrollManager selector combo. --- .../html/static/notebook/js/maintoolbar.js | 8 +--- IPython/html/static/notebook/js/notebook.js | 5 ++- .../html/static/notebook/js/scrollmanager.js | 43 ------------------- 3 files changed, 4 insertions(+), 52 deletions(-) diff --git a/IPython/html/static/notebook/js/maintoolbar.js b/IPython/html/static/notebook/js/maintoolbar.js index 2c46edd3d..56293b878 100644 --- a/IPython/html/static/notebook/js/maintoolbar.js +++ b/IPython/html/static/notebook/js/maintoolbar.js @@ -6,8 +6,7 @@ define([ 'jquery', 'notebook/js/toolbar', 'notebook/js/celltoolbar', - 'notebook/js/scrollmanager' -], function(IPython, $, toolbar, celltoolbar, scrollmanager) { +], function(IPython, $, toolbar, celltoolbar) { "use strict"; var MainToolBar = function (selector, options) { @@ -25,7 +24,6 @@ define([ this.construct(); this.add_celltype_list(); this.add_celltoolbar_list(); - this.add_scrollmanager_list(); this.bind_events(); }; @@ -187,10 +185,6 @@ define([ }); }; - MainToolBar.prototype.add_scrollmanager_list = function () { - this._scrollselector = new scrollmanager.ScrollSelector(this.element, this.notebook); - }; - MainToolBar.prototype.bind_events = function () { var that = this; diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index fe88317d5..b715cd47d 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -67,8 +67,9 @@ define([ this._session_starting = false; this.default_cell_type = this.config.default_cell_type || 'code'; - // Create and register scroll managers. - this.scrollmanager = new scrollmanager.ScrollManager(this); + // Create default scroll manager. + this.scrollmanager = new scrollmanager.SlideScrollManager(this); + // default_kernel_name is a temporary measure while we implement proper // kernel selection and delayed start. Do not rely on it. this.default_kernel_name = 'python'; diff --git a/IPython/html/static/notebook/js/scrollmanager.js b/IPython/html/static/notebook/js/scrollmanager.js index a4a2b1bce..1a6dad292 100644 --- a/IPython/html/static/notebook/js/scrollmanager.js +++ b/IPython/html/static/notebook/js/scrollmanager.js @@ -3,48 +3,6 @@ define(['jquery'], function($){ "use strict"; - var ScrollSelector = function(element, notebook) { - // Public constructor. - this.notebook = notebook; - $('') - .addClass('nabar-text') - .text('Scrolling Mode:') - .appendTo(element); - this._combo = $('