Permalink
Browse files

Clean up javascript based on js2-mode feedback.

  • Loading branch information...
1 parent f15123a commit 0168dc2190d91888756dced4e71b597d62b66e68 @stefanv committed Nov 23, 2011
@@ -45,16 +45,16 @@ var IPython = (function (IPython) {
Cell.prototype.bind_events = function () {
var that = this;
- var nb = that.notebook
+ var nb = that.notebook;
that.element.click(function (event) {
if (that.selected === false) {
nb.select(nb.find_cell_index(that));
- };
+ }
});
that.element.focusin(function (event) {
if (that.selected === false) {
nb.select(nb.find_cell_index(that));
- };
+ }
});
};
@@ -44,7 +44,7 @@ var IPython = (function (IPython) {
var output = $('<div></div>').addClass('output vbox');
cell.append(input).append(output);
this.element = cell;
- this.collapse()
+ this.collapse();
};
//TODO, try to diminish the number of parameters.
@@ -123,7 +123,7 @@ var IPython = (function (IPython) {
return true;
} else {
return false;
- };
+ }
} else if (event.keyCode === 76 && event.ctrlKey && event.shiftKey
&& event.type == 'keydown') {
// toggle line numbers with Ctrl-Shift-L
@@ -138,10 +138,11 @@ var IPython = (function (IPython) {
if (ed_cur.line !== cc_cur.line || ed_cur.ch !== cc_cur.ch) {
this.is_completing = false;
this.completion_cursor = null;
- };
- };
+ }
+ }
return false;
};
+ return false;
};
CodeCell.prototype.remove_and_cancell_tooltip = function(timeout)
@@ -345,7 +346,7 @@ var IPython = (function (IPython) {
} else {
this.code_mirror.setOption('lineNumbers', false);
}
- this.code_mirror.refresh()
+ this.code_mirror.refresh();
};
CodeCell.prototype.select = function () {
@@ -447,7 +448,7 @@ var IPython = (function (IPython) {
CodeCell.prototype.append_display_data = function (json) {
var toinsert = this.create_output_area();
- this.append_mime_type(json, toinsert)
+ this.append_mime_type(json, toinsert);
this.element.find('div.output').append(toinsert);
// If we just output latex, typeset it.
if ( (json.latex !== undefined) || (json.html !== undefined) ) {
@@ -477,7 +478,7 @@ var IPython = (function (IPython) {
var toinsert = $("<div/>").addClass("box_flex1 output_subarea output_html rendered_html");
toinsert.append(html);
element.append(toinsert);
- }
+ };
CodeCell.prototype.append_text = function (data, element, extra_class) {
@@ -517,7 +518,7 @@ var IPython = (function (IPython) {
var toinsert = $("<div/>").addClass("box_flex1 output_subarea output_latex");
toinsert.append(latex);
element.append(toinsert);
- }
+ };
CodeCell.prototype.clear_output = function (stdout, stderr, other) {
@@ -589,7 +590,7 @@ var IPython = (function (IPython) {
CodeCell.prototype.set_input_prompt = function (number) {
var n = number || '&nbsp;';
- this.input_prompt_number = n
+ this.input_prompt_number = n;
this.element.find('div.input_prompt').html('In&nbsp;[' + n + ']:');
};
@@ -653,7 +654,7 @@ var IPython = (function (IPython) {
data.input = this.get_code();
data.cell_type = 'code';
if (this.input_prompt_number !== ' ') {
- data.prompt_number = this.input_prompt_number
+ data.prompt_number = this.input_prompt_number;
};
var outputs = [];
var len = this.outputs.length;
@@ -23,9 +23,9 @@ var IPython = (function (IPython) {
this.session_id = utils.uuid();
if (typeof(WebSocket) !== 'undefined') {
- this.WebSocket = WebSocket
+ this.WebSocket = WebSocket;
} else if (typeof(MozWebSocket) !== 'undefined') {
- this.WebSocket = MozWebSocket
+ this.WebSocket = MozWebSocket;
} else {
alert('Your browser does not have WebSocket support, please try Chrome, Safari or Firefox ≥ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config.');
};
@@ -44,13 +44,13 @@ var IPython = (function (IPython) {
parent_header : {}
};
return msg;
- }
+ };
Kernel.prototype.start = function (notebook_id, callback) {
var that = this;
if (!this.running) {
var qs = $.param({notebook:notebook_id});
- var url = this.base_url + '?' + qs
+ var url = this.base_url + '?' + qs;
$.post(url,
function (kernel_id) {
that._handle_start_kernel(kernel_id, callback);
@@ -95,10 +95,10 @@ var IPython = (function (IPython) {
" You will NOT be able to run code.<br/>" +
" Your browser may not be compatible with the websocket version in the server," +
" or if the url does not look right, there could be an error in the" +
- " server's configuration."
+ " server's configuration.";
} else {
msg = "Websocket connection closed unexpectedly.<br/>" +
- " The kernel will no longer be responsive."
+ " The kernel will no longer be responsive.";
}
var dialog = $('<div/>');
dialog.html(msg);
@@ -114,7 +114,7 @@ var IPython = (function (IPython) {
}
});
- }
+ };
Kernel.prototype.start_channels = function () {
var that = this;
@@ -125,7 +125,7 @@ var IPython = (function (IPython) {
this.iopub_channel = new this.WebSocket(ws_url + "/iopub");
send_cookie = function(){
this.send(document.cookie);
- }
+ };
var already_called_onclose = false; // only alert once
ws_closed_early = function(evt){
if (already_called_onclose){
@@ -135,7 +135,7 @@ var IPython = (function (IPython) {
if ( ! evt.wasClean ){
that._websocket_closed(ws_url, true);
}
- }
+ };
ws_closed_late = function(evt){
if (already_called_onclose){
return;
@@ -144,7 +144,7 @@ var IPython = (function (IPython) {
if ( ! evt.wasClean ){
that._websocket_closed(ws_url, false);
}
- }
+ };
this.shell_channel.onopen = send_cookie;
this.shell_channel.onclose = ws_closed_early;
this.iopub_channel.onopen = send_cookie;
@@ -159,12 +159,12 @@ var IPython = (function (IPython) {
Kernel.prototype.stop_channels = function () {
if (this.shell_channel !== null) {
- this.shell_channel.onclose = function (evt) {null};
+ this.shell_channel.onclose = function (evt) {};
this.shell_channel.close();
this.shell_channel = null;
};
if (this.iopub_channel !== null) {
- this.iopub_channel.onclose = function (evt) {null};
+ this.iopub_channel.onclose = function (evt) {};
this.iopub_channel.close();
this.iopub_channel = null;
};
@@ -189,12 +189,12 @@ var IPython = (function (IPython) {
silent : false,
user_variables : [],
user_expressions : {},
- allow_stdin : false,
+ allow_stdin : false
};
var msg = this.get_msg("execute_request", content);
this.shell_channel.send(JSON.stringify(msg));
return msg.header.msg_id;
- }
+ };
Kernel.prototype.complete = function (line, cursor_pos) {
@@ -206,7 +206,7 @@ var IPython = (function (IPython) {
var msg = this.get_msg("complete_request", content);
this.shell_channel.send(JSON.stringify(msg));
return msg.header.msg_id;
- }
+ };
Kernel.prototype.interrupt = function () {
@@ -221,7 +221,7 @@ var IPython = (function (IPython) {
this.running = false;
var settings = {
cache : false,
- type : "DELETE",
+ type : "DELETE"
};
$.ajax(this.kernel_url, settings);
};
@@ -26,7 +26,7 @@ var IPython = (function (IPython) {
this.element.addClass('ui-widget');
this.element.attr('title', "The kernel execution status." +
" If 'Busy', the kernel is currently running code." +
- " If 'Idle', it is available for execution.")
+ " If 'Idle', it is available for execution.");
};
@@ -54,7 +54,7 @@ var IPython = (function (IPython) {
}
};
- IPython.LayoutManager = LayoutManager
+ IPython.LayoutManager = LayoutManager;
return IPython;
@@ -71,7 +71,7 @@ var IPython = (function (IPython) {
this.kernel_section = new IPython.KernelSection('div#kernel_section');
}
this.help_section = new IPython.HelpSection('div#help_section');
- }
+ };
LeftPanel.prototype.collapse = function () {
if (this.expanded === true) {
@@ -20,7 +20,7 @@ IPython.namespace = function (ns_string) {
for (i=0; i<parts.length; i+=1) {
// Create property if it doesn't exist
if (typeof parent[parts[i]] === "undefined") {
- parent[parts[i]] == {};
+ parent[parts[i]] = {};
}
}
return parent;
Oops, something went wrong.

0 comments on commit 0168dc2

Please sign in to comment.