Added comments to kbm and shrunk focus_cell lines

This commit is contained in:
Jonathan Frederic 2014-02-28 15:11:21 -08:00
parent 69e760841a
commit 3bcee30e8c

View File

@ -264,8 +264,7 @@ var IPython = (function (IPython) {
var index = IPython.notebook.get_selected_index(); var index = IPython.notebook.get_selected_index();
if (index !== 0 && index !== null) { if (index !== 0 && index !== null) {
IPython.notebook.select_prev(); IPython.notebook.select_prev();
var cell = IPython.notebook.get_selected_cell(); IPython.notebook.focus_cell();
cell.focus_cell();
} }
return false; return false;
} }
@ -277,8 +276,7 @@ var IPython = (function (IPython) {
var index = IPython.notebook.get_selected_index(); var index = IPython.notebook.get_selected_index();
if (index !== (IPython.notebook.ncells()-1) && index !== null) { if (index !== (IPython.notebook.ncells()-1) && index !== null) {
IPython.notebook.select_next(); IPython.notebook.select_next();
var cell = IPython.notebook.get_selected_cell(); IPython.notebook.focus_cell();
cell.focus_cell();
} }
return false; return false;
} }
@ -290,8 +288,7 @@ var IPython = (function (IPython) {
var index = IPython.notebook.get_selected_index(); var index = IPython.notebook.get_selected_index();
if (index !== 0 && index !== null) { if (index !== 0 && index !== null) {
IPython.notebook.select_prev(); IPython.notebook.select_prev();
var cell = IPython.notebook.get_selected_cell(); IPython.notebook.focus_cell();
cell.focus_cell();
} }
return false; return false;
} }
@ -303,8 +300,7 @@ var IPython = (function (IPython) {
var index = IPython.notebook.get_selected_index(); var index = IPython.notebook.get_selected_index();
if (index !== (IPython.notebook.ncells()-1) && index !== null) { if (index !== (IPython.notebook.ncells()-1) && index !== null) {
IPython.notebook.select_next(); IPython.notebook.select_next();
var cell = IPython.notebook.get_selected_cell(); IPython.notebook.focus_cell();
cell.focus_cell();
} }
return false; return false;
} }
@ -752,7 +748,9 @@ var IPython = (function (IPython) {
e.on('focusin', handle_focus); e.on('focusin', handle_focus);
e.on('focusout', handle_blur); e.on('focusout', handle_blur);
// TODO: Very strange. The focusout event does not seem fire for the // TODO: Very strange. The focusout event does not seem fire for the
// bootstrap textboxes on FF25&26... // bootstrap textboxes on FF25&26... This works around that by
// registering focus and blur events recursively on all inputs within
// registered element.
e.find('input').blur(handle_blur); e.find('input').blur(handle_blur);
e.on('DOMNodeInserted', function (event) { e.on('DOMNodeInserted', function (event) {
var target = $(event.target); var target = $(event.target);
@ -765,6 +763,8 @@ var IPython = (function (IPython) {
// There are times (raw_input) where we remove the element from the DOM before // There are times (raw_input) where we remove the element from the DOM before
// focusout is called. In this case we bind to the remove event of jQueryUI, // focusout is called. In this case we bind to the remove event of jQueryUI,
// which gets triggered upon removal, iff it is focused at the time. // which gets triggered upon removal, iff it is focused at the time.
// is_focused must be used to check for the case where an element within
// the element being removed is focused.
e.on('remove', function () { e.on('remove', function () {
if (IPython.utils.is_focused(e[0])) { if (IPython.utils.is_focused(e[0])) {
that.enable(); that.enable();