Merge pull request #864 from Carreau/js-cleanup

A bunch of js cleanup
This commit is contained in:
Min RK 2015-12-15 20:19:47 +01:00
commit ae2fb41bad
3 changed files with 18 additions and 18 deletions

View File

@ -399,7 +399,7 @@ define(function(require){
help : 'merge selected cells, or current cell with cell below if only one cell selected',
help_index: 'el',
handler: function(env) {
var l = env.notebook.get_selected_cells_indices().length
var l = env.notebook.get_selected_cells_indices().length;
if(l == 1){
env.notebook.merge_cell_below();
} else {

View File

@ -282,7 +282,7 @@ define([
// if anchor is true, remove also the anchor
moveanchor = (moveanchor === undefined)? true:moveanchor;
if (moveanchor){
this.anchor = false
this.anchor = false;
}
if (this.selected) {
this.element.addClass('unselected');
@ -410,7 +410,7 @@ define([
if(this.element !== document.activeElement && !this.code_mirror.hasFocus()){
this.focus_cell();
}
}
};
/**
* Focus the cell in the DOM sense
@ -611,7 +611,7 @@ define([
// in a later version of Jupyter.
var re = regs[i];
if(typeof(re) === 'string'){
re = new RegExp(re)
re = new RegExp(re);
}
if(first_line.match(re) !== null) {
if(current_mode == mode){
@ -634,7 +634,7 @@ define([
CodeMirror.defineMode(magic_mode, function(config) {
var magicOverlay = {
startState: function() {
return {firstMatched : false, inMagicLine: false}
return {firstMatched : false, inMagicLine: false};
},
token: function(stream, state) {
if(!state.firstMatched) {

View File

@ -586,7 +586,7 @@ define(function (require) {
Notebook.prototype.get_selected_cells = function () {
return this.get_cells().filter(function(cell, index){ return cell.selected || soft_selected(cell) || cell.anchor});
return this.get_cells().filter(function(cell, index){ return cell.selected || soft_selected(cell) || cell.anchor;});
};
Notebook.prototype.get_selected_cells_indices = function () {
@ -718,7 +718,7 @@ define(function (require) {
this.update_soft_selection();
if (cell.cell_type === 'heading') {
this.events.trigger('selected_cell_type_changed.Notebook',
{'cell_type':cell.cell_type,level:cell.level}
{'cell_type':cell.cell_type, level:cell.level}
);
} else {
this.events.trigger('selected_cell_type_changed.Notebook',
@ -1043,7 +1043,7 @@ define(function (require) {
}
// Check if the cells were after the cursor
for (var i=0; i < indices.length; i++) {
for (i=0; i < indices.length; i++) {
if (indices[i] > cursor_ix_before) {
this.undelete_below = true;
}
@ -1504,7 +1504,7 @@ define(function (require) {
Notebook.prototype.paste_cell_replace = function () {
if (!(this.clipboard !== null && this.paste_enabled)) {
return
return;
}
var selected = this.get_selected_cells_indices();
@ -1729,13 +1729,13 @@ define(function (require) {
*/
Notebook.prototype.clear_cells_outputs = function(indices) {
if (!indices) {
var indices = this.get_selected_cells_indices();
indices = this.get_selected_cells_indices();
}
for (var i = 0; i < indices.length; i++){
this.clear_output(indices[i]);
}
}
};
/**
* Clear each code cell's output area.
@ -1797,13 +1797,13 @@ define(function (require) {
*/
Notebook.prototype.toggle_cells_outputs = function(indices) {
if (!indices) {
var indices = this.get_selected_cells_indices();
indices = this.get_selected_cells_indices();
}
for (var i = 0; i < indices.length; i++){
this.toggle_output(indices[i]);
}
}
};
/**
* Toggle the output of all cells.
@ -1839,13 +1839,13 @@ define(function (require) {
*/
Notebook.prototype.toggle_cells_outputs_scroll = function(indices) {
if (!indices) {
var indices = this.get_selected_cells_indices();
indices = this.get_selected_cells_indices();
}
for (var i = 0; i < indices.length; i++){
this.toggle_output_scroll(indices[i]);
}
}
};
/**
* Toggle the scrolling of long output on all cells.
@ -1866,7 +1866,7 @@ define(function (require) {
* Toggle line numbers in the selected cell's input area.
*/
Notebook.prototype.cell_toggle_line_numbers = function() {
this.get_selected_cells().map(function(cell, i){cell.toggle_line_numbers()});
this.get_selected_cells().map(function(cell, i){cell.toggle_line_numbers();});
};
@ -2430,7 +2430,7 @@ define(function (require) {
var last_modified = new Date(data.last_modified);
if (last_modified > that.last_modified) {
console.warn("Last saving was done on `"+that.last_modified+"`("+that._last_modified+"), "+
"while the current file seem to have been saved on `"+data.last_modified+"`")
"while the current file seem to have been saved on `"+data.last_modified+"`");
dialog.modal({
notebook: that,
keyboard_manager: that.keyboard_manager,
@ -2726,7 +2726,7 @@ define(function (require) {
this.writable = data.writable || false;
this.last_modified = new Date(data.last_modified);
// debug 484
this._last_modified = 'load-success:'+data.last_modified
this._last_modified = 'load-success:'+data.last_modified;
var nbmodel = data.content;
var orig_nbformat = nbmodel.metadata.orig_nbformat;
var orig_nbformat_minor = nbmodel.metadata.orig_nbformat_minor;