diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js
index 63449f8..bca8846 100644
--- a/IPython/html/static/notebook/js/notebook.js
+++ b/IPython/html/static/notebook/js/notebook.js
@@ -145,7 +145,7 @@ var IPython = (function (IPython) {
};
this.element.bind('collapse_pager', function (event, extrap) {
- var time = (extrap != undefined) ? ((extrap.duration != undefined ) ? extrap.duration : 'fast') : 'fast';
+ var time = (extrap !== undefined) ? ((extrap.duration !== undefined ) ? extrap.duration : 'fast') : 'fast';
collapse_time(time);
});
@@ -158,7 +158,7 @@ var IPython = (function (IPython) {
};
this.element.bind('expand_pager', function (event, extrap) {
- var time = (extrap != undefined) ? ((extrap.duration != undefined ) ? extrap.duration : 'fast') : 'fast';
+ var time = (extrap !== undefined) ? ((extrap.duration !== undefined ) ? extrap.duration : 'fast') : 'fast';
expand_time(time);
});
@@ -187,7 +187,7 @@ var IPython = (function (IPython) {
} else {
return "Unsaved changes will be lost.";
}
- };
+ }
// Null is the *only* return value that will make the browser not
// pop up the "don't leave" dialog.
return null;
@@ -219,7 +219,7 @@ var IPython = (function (IPython) {
*/
Notebook.prototype.scroll_to_cell = function (cell_number, time) {
var cells = this.get_cells();
- var time = time || 0;
+ time = time || 0;
cell_number = Math.min(cells.length-1,cell_number);
cell_number = Math.max(0 ,cell_number);
var scroll_value = cells[cell_number].element.position().top-cells[0].element.position().top ;
@@ -331,7 +331,7 @@ var IPython = (function (IPython) {
result = ce.data('cell');
}
return result;
- }
+ };
/**
* Get the cell below a given cell.
@@ -347,7 +347,7 @@ var IPython = (function (IPython) {
result = this.get_cell(index+1);
}
return result;
- }
+ };
/**
* Get the cell above a given cell.
@@ -365,7 +365,7 @@ var IPython = (function (IPython) {
result = this.get_cell(index-1);
}
return result;
- }
+ };
/**
* Get the numeric index of a given cell.
@@ -379,7 +379,7 @@ var IPython = (function (IPython) {
this.get_cell_elements().filter(function (index) {
if ($(this).data("cell") === cell) {
result = index;
- };
+ }
});
return result;
};
@@ -426,8 +426,8 @@ var IPython = (function (IPython) {
return true;
} else {
return false;
- };
- }
+ }
+ };
/**
* Get the index of the currently selected cell.
@@ -440,7 +440,7 @@ var IPython = (function (IPython) {
this.get_cell_elements().filter(function (index) {
if ($(this).data("cell").selected === true) {
result = index;
- };
+ }
});
return result;
};
@@ -457,11 +457,11 @@ var IPython = (function (IPython) {
*/
Notebook.prototype.select = function (index) {
if (this.is_valid_cell_index(index)) {
- var sindex = this.get_selected_index()
+ var sindex = this.get_selected_index();
if (sindex !== null && index !== sindex) {
this.command_mode();
this.get_cell(sindex).unselect();
- };
+ }
var cell = this.get_cell(index);
cell.select();
if (cell.cell_type === 'heading') {
@@ -472,8 +472,8 @@ var IPython = (function (IPython) {
$([IPython.events]).trigger('selected_cell_type_changed.Notebook',
{'cell_type':cell.cell_type}
);
- };
- };
+ }
+ }
return this;
};
@@ -509,7 +509,7 @@ var IPython = (function (IPython) {
this.get_cell_elements().filter(function (index) {
if ($(this).data("cell").mode === 'edit') {
result = index;
- };
+ }
});
return result;
};
@@ -521,10 +521,10 @@ var IPython = (function (IPython) {
var cell = this.get_cell(index);
if (cell) {
cell.command_mode();
- };
+ }
this.mode = 'command';
IPython.keyboard_manager.command_mode();
- };
+ }
};
Notebook.prototype.edit_mode = function () {
@@ -537,7 +537,7 @@ var IPython = (function (IPython) {
this.mode = 'edit';
IPython.keyboard_manager.edit_mode();
cell.edit_mode();
- };
+ }
};
Notebook.prototype.focus_cell = function () {
@@ -566,9 +566,9 @@ var IPython = (function (IPython) {
this.select(i-1);
var cell = this.get_selected_cell();
cell.focus_cell();
- };
+ }
this.set_dirty(true);
- };
+ }
return this;
};
@@ -591,8 +591,8 @@ var IPython = (function (IPython) {
this.select(i+1);
var cell = this.get_selected_cell();
cell.focus_cell();
- };
- };
+ }
+ }
this.set_dirty();
return this;
};
@@ -632,10 +632,10 @@ var IPython = (function (IPython) {
this.select(i);
this.undelete_index = i;
this.undelete_below = false;
- };
+ }
$([IPython.events]).trigger('delete.Cell', {'cell': cell, 'index': i});
this.set_dirty(true);
- };
+ }
return this;
};
@@ -673,7 +673,7 @@ var IPython = (function (IPython) {
this.undelete_index = null;
}
$('#undelete_cell').addClass('disabled');
- }
+ };
/**
* Insert a cell so that after insertion the cell is at given index.
@@ -691,8 +691,8 @@ var IPython = (function (IPython) {
Notebook.prototype.insert_cell_at_index = function(type, index){
var ncells = this.ncells();
- var index = Math.min(index,ncells);
- index = Math.max(index,0);
+ index = Math.min(index,ncells);
+ index = Math.max(index,0);
var cell = null;
if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) {
@@ -832,8 +832,8 @@ var IPython = (function (IPython) {
source_element.remove();
this.select(i);
this.set_dirty(true);
- };
- };
+ }
+ }
};
/**
@@ -852,7 +852,7 @@ var IPython = (function (IPython) {
var text = source_cell.get_text();
if (text === source_cell.placeholder) {
text = '';
- };
+ }
// We must show the editor before setting its contents
target_cell.unrender();
target_cell.set_text(text);
@@ -865,8 +865,8 @@ var IPython = (function (IPython) {
target_cell.render();
}
this.set_dirty(true);
- };
- };
+ }
+ }
};
/**
@@ -886,7 +886,7 @@ var IPython = (function (IPython) {
var text = source_cell.get_text();
if (text === source_cell.placeholder) {
text = '';
- };
+ }
// We must show the editor before setting its contents
target_cell.unrender();
target_cell.set_text(text);
@@ -896,8 +896,8 @@ var IPython = (function (IPython) {
source_element.remove();
this.select(i);
this.set_dirty(true);
- };
- };
+ }
+ }
};
/**
@@ -921,7 +921,7 @@ var IPython = (function (IPython) {
var text = source_cell.get_text();
if (text === source_cell.placeholder) {
text = '';
- };
+ }
// We must show the editor before setting its contents
target_cell.set_level(level);
target_cell.unrender();
@@ -934,12 +934,12 @@ var IPython = (function (IPython) {
if ((source_cell instanceof IPython.TextCell) && source_cell.rendered) {
target_cell.render();
}
- };
+ }
this.set_dirty(true);
$([IPython.events]).trigger('selected_cell_type_changed.Notebook',
{'cell_type':'heading',level:level}
);
- };
+ }
};
@@ -960,7 +960,7 @@ var IPython = (function (IPython) {
$('#paste_cell_below').removeClass('disabled')
.on('click', function () {that.paste_cell_below();});
this.paste_enabled = true;
- };
+ }
};
/**
@@ -974,7 +974,7 @@ var IPython = (function (IPython) {
$('#paste_cell_above').addClass('disabled').off('click');
$('#paste_cell_below').addClass('disabled').off('click');
this.paste_enabled = false;
- };
+ }
};
/**
@@ -985,7 +985,7 @@ var IPython = (function (IPython) {
Notebook.prototype.cut_cell = function () {
this.copy_cell();
this.delete_cell();
- }
+ };
/**
* Copy a cell.
@@ -1011,7 +1011,7 @@ var IPython = (function (IPython) {
var old_cell = this.get_next_cell(new_cell);
this.delete_cell(this.find_cell_index(old_cell));
this.select(this.find_cell_index(new_cell));
- };
+ }
};
/**
@@ -1025,7 +1025,7 @@ var IPython = (function (IPython) {
var new_cell = this.insert_cell_above(cell_data.cell_type);
new_cell.fromJSON(cell_data);
new_cell.focus_cell();
- };
+ }
};
/**
@@ -1039,7 +1039,7 @@ var IPython = (function (IPython) {
var new_cell = this.insert_cell_below(cell_data.cell_type);
new_cell.fromJSON(cell_data);
new_cell.focus_cell();
- };
+ }
};
// Split/merge
@@ -1070,7 +1070,7 @@ var IPython = (function (IPython) {
new_cell.unrender();
new_cell.set_text(texta);
}
- };
+ }
};
/**
@@ -1104,10 +1104,10 @@ var IPython = (function (IPython) {
// that of the original selected cell;
cell.render();
}
- };
+ }
this.delete_cell(index-1);
this.select(this.find_cell_index(cell));
- };
+ }
};
/**
@@ -1141,10 +1141,10 @@ var IPython = (function (IPython) {
// that of the original selected cell;
cell.render();
}
- };
+ }
this.delete_cell(index+1);
this.select(this.find_cell_index(cell));
- };
+ }
};
@@ -1364,8 +1364,8 @@ var IPython = (function (IPython) {
var cell = this.get_cell(i);
if (cell instanceof IPython.CodeCell) {
cell.set_kernel(this.session.kernel);
- };
- };
+ }
+ }
};
/**
@@ -1406,7 +1406,7 @@ var IPython = (function (IPython) {
this.command_mode();
cell.focus_cell();
this.set_dirty(true);
- }
+ };
/**
* Execute or render cell outputs and insert a new cell below.
@@ -1502,7 +1502,7 @@ var IPython = (function (IPython) {
for (var i=start; i0) {
+ if (nbname.length>0 && !this.notebook_name_blacklist_re.test(nbname)) {
return true;
} else {
return false;
- };
+ }
};
/**
@@ -1559,7 +1559,7 @@ var IPython = (function (IPython) {
for (i=0; i 1) {
IPython.dialog.modal({
title : "Multiple worksheets",
@@ -1612,7 +1612,7 @@ var IPython = (function (IPython) {
var cell_array = new Array(ncells);
for (var i=0; i').append(
$("").addClass("rename-message")
.text('This notebook name already exists.')
- )
+ );
$([IPython.events]).trigger('notebook_rename_failed.Notebook', [xhr, status, error]);
IPython.dialog.modal({
title: "Notebook Rename Error!",
@@ -1878,7 +1877,7 @@ var IPython = (function (IPython) {
that.find('input[type="text"]').focus();
}
});
- }
+ };
/**
* Request a notebook's data from the server.
@@ -1928,7 +1927,7 @@ var IPython = (function (IPython) {
} else {
this.select(0);
this.command_mode();
- };
+ }
this.set_dirty(false);
this.scroll_to_top();
if (data.orig_nbformat !== undefined && data.nbformat !== data.orig_nbformat) {
@@ -1953,7 +1952,7 @@ var IPython = (function (IPython) {
var this_vs = 'v' + data.nbformat + '.' + this.nbformat_minor;
var msg = "This notebook is version " + orig_vs + ", but we only fully support up to " +
this_vs + ". You can still work with this notebook, but some features " +
- "introduced in later notebook versions may not be available."
+ "introduced in later notebook versions may not be available.";
IPython.dialog.modal({
title : "Newer Notebook",
@@ -1969,7 +1968,7 @@ var IPython = (function (IPython) {
// Create the session after the notebook is completely loaded to prevent
// code execution upon loading, which is a security risk.
- if (this.session == null) {
+ if (this.session === null) {
this.start_session();
}
// load our checkpoint list
@@ -1994,10 +1993,11 @@ var IPython = (function (IPython) {
*/
Notebook.prototype.load_notebook_error = function (xhr, status, error) {
$([IPython.events]).trigger('notebook_load_failed.Notebook', [xhr, status, error]);
+ var msg;
if (xhr.status === 400) {
- var msg = error;
+ msg = error;
} else if (xhr.status === 500) {
- var msg = "An unknown error occurred while loading this notebook. " +
+ msg = "An unknown error occurred while loading this notebook. " +
"This version can load notebook formats " +
"v" + this.nbformat + " or earlier.";
}
@@ -2008,7 +2008,7 @@ var IPython = (function (IPython) {
"OK": {}
}
});
- }
+ };
/********************* checkpoint-related *********************/
@@ -2073,7 +2073,7 @@ var IPython = (function (IPython) {
* @param {jqXHR} xhr jQuery Ajax object
*/
Notebook.prototype.list_checkpoints_success = function (data, status, xhr) {
- var data = $.parseJSON(data);
+ data = $.parseJSON(data);
this.checkpoints = data;
if (data.length) {
this.last_checkpoint = data[data.length - 1];
@@ -2124,7 +2124,7 @@ var IPython = (function (IPython) {
* @param {jqXHR} xhr jQuery Ajax object
*/
Notebook.prototype.create_checkpoint_success = function (data, status, xhr) {
- var data = $.parseJSON(data);
+ data = $.parseJSON(data);
this.add_checkpoint(data);
$([IPython.events]).trigger('checkpoint_created.Notebook', data);
};
@@ -2143,7 +2143,7 @@ var IPython = (function (IPython) {
Notebook.prototype.restore_checkpoint_dialog = function (checkpoint) {
var that = this;
- var checkpoint = checkpoint || this.last_checkpoint;
+ checkpoint = checkpoint || this.last_checkpoint;
if ( ! checkpoint ) {
console.log("restore dialog, but no checkpoint to restore to!");
return;
@@ -2178,7 +2178,7 @@ var IPython = (function (IPython) {
Cancel : {}
}
});
- }
+ };
/**
* Restore the notebook to a checkpoint state.