Some cleanup unused code and missig use-strict

This commit is contained in:
Matthias Bussonnier 2014-10-20 21:19:24 +02:00 committed by Bussonnier Matthias
parent 295050060e
commit 9ae62c21b8
3 changed files with 13 additions and 27 deletions

View File

@ -3,6 +3,7 @@
var IPython = IPython || {};
define([], function(){
"use strict";
IPython.version = "3.0.0-dev";
return IPython;
});

View File

@ -40,6 +40,7 @@ define([
slideshow_celltoolbar,
scrollmanager
) {
"use strict";
var Notebook = function (selector, options) {
// Constructor
@ -149,14 +150,18 @@ define([
this.codemirror_mode = 'ipython';
this.create_elements();
this.bind_events();
this.save_notebook = function() { // don't allow save until notebook_loaded
this.save_notebook_error(null, null, "Load failed, save is disabled");
};
this.kernel_selector = null;
this.dirty = null;
this.trusted = null;
this._fully_loaded = false;
// Trigger cell toolbar registration.
default_celltoolbar.register(this);
rawcell_celltoolbar.register(this);
slideshow_celltoolbar.register(this);
// prevent assign to miss-typed properties.
Object.seal(this);
};
Notebook.options_default = {
@ -1913,6 +1918,9 @@ define([
* @method save_notebook
*/
Notebook.prototype.save_notebook = function () {
if(!this._fully_loaded){
return this.save_notebook_error(null, null, "Load failed, save is disabled");
}
// Create a JSON model to be sent to the server.
var model = {
type : "notebook",
@ -2240,7 +2248,7 @@ define([
}
// now that we're fully loaded, it is safe to restore save functionality
delete(this.save_notebook);
this._fully_loaded = true;
this.events.trigger('notebook_loaded.Notebook');
};

View File

@ -179,29 +179,6 @@ define([
// easy access for julia monkey patching.
Tooltip.last_token_re = /[a-z_][0-9a-z._]*$/gi;
Tooltip.prototype.extract_oir_token = function(line){
// use internally just to make the request to the kernel
// Feel free to shorten this logic if you are better
// than me in regEx
// basicaly you shoul be able to get xxx.xxx.xxx from
// something(range(10), kwarg=smth) ; xxx.xxx.xxx( firstarg, rand(234,23), kwarg1=2,
// remove everything between matchin bracket (need to iterate)
var matchBracket = /\([^\(\)]+\)/g;
var endBracket = /\([^\(]*$/g;
var oldline = line;
line = line.replace(matchBracket, "");
while (oldline != line) {
oldline = line;
line = line.replace(matchBracket, "");
}
// remove everything after last open bracket
line = line.replace(endBracket, "");
// reset the regex object
Tooltip.last_token_re.lastIndex = 0;
return Tooltip.last_token_re.exec(line);
};
Tooltip.prototype._request_tooltip = function (cell, text, cursor_pos) {
var callbacks = $.proxy(this._show, this);
var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);