require.js ES5 -> commonjs ES5

pull/268/head
jdfreder 11 years ago committed by Jonathan Frederic
parent 21f63d4322
commit ff9406f2e3

@ -1,14 +1,14 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['base/js/namespace', 'base/js/page'], function(IPython, page) {
function login_main() {
var page_instance = new page.Page();
$('button#login_submit').addClass("btn btn-default");
page_instance.show();
$('input#password_input').focus();
IPython.page = page_instance;
}
return login_main;
});
var IPython = require('base/js/namespace');
var page = require('base/js/page');
module.exports = function() {
var page_instance = new page.Page();
$('button#login_submit').addClass("btn btn-default");
page_instance.show();
$('input#password_input').focus();
IPython.page = page_instance;
};

@ -1,12 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'base/js/utils',
'jquery',
], function(utils, $){
"use strict";
var utils = require('base/js/utils');
var $ = require('jquery');
var LoginWidget = function (selector, options) {
options = options || {};
this.base_url = options.base_url || utils.get_body_data("baseUrl");
@ -34,5 +33,4 @@ define([
});
};
return {'LoginWidget': LoginWidget};
});
exports.LoginWidget = LoginWidget;

@ -1,12 +1,12 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['base/js/namespace', 'base/js/page'], function(IPython, page) {
function logout_main() {
var IPython = require('base/js/namespace');
var page = require('base/js/page');
module.exports = function () {
var page_instance = new page.Page();
page_instance.show();
IPython.page = page_instance;
}
return logout_main;
});
};

@ -1,9 +1,5 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['./loginmain', './logoutmain'], function (login_main, logout_main) {
return {
login_main: login_main,
logout_main: logout_main
};
});
exports.login_main = require('./login_main');
exports.logout_main = require('./logout_main');

@ -1,12 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(function(require) {
"use strict";
var CodeMirror = require('codemirror/lib/codemirror');
var $ = require('jquery');
/**
* A wrapper around bootstrap modal for easier use
* Pass it an option dictionary with the following properties:
@ -199,12 +198,9 @@ define(function(require) {
modal_obj.on('shown.bs.modal', function(){ editor.refresh(); });
};
var dialog = {
module.exports = {
modal : modal,
kernel_modal : kernel_modal,
edit_metadata : edit_metadata,
};
return dialog;
});

@ -8,17 +8,17 @@
// require(['base/js/events'], function (events) {
// events.on("event.Namespace", function () { do_stuff(); });
// });
"use strict";
var IPython = require('base/js/namespace');
var $ = require('jquery');
define(['base/js/namespace', 'jquery'], function(IPython, $) {
"use strict";
var Events = function () {};
var Events = function () {};
var events = new Events();
// Backwards compatability.
IPython.Events = Events;
IPython.events = events;
return $([events]);
});
var events = new Events();
// Backwards compatability.
IPython.Events = Events;
IPython.events = events;
module.exports = $([events]);

@ -8,13 +8,12 @@
* @class ShortcutManager
*/
define([
'jquery',
'base/js/utils',
'underscore',
], function($, utils, _) {
"use strict";
var utils = require('base/js/utils');
var _ = require('underscore');
var $ = require('jquery');
/**
* Setup global keycodes and inverse keycodes.
@ -45,20 +44,20 @@ define([
'end': 35, 'home': 36, 'left': 37, 'up': 38, 'right': 39, 'down': 40,
'insert': 45, 'delete': 46, 'numlock': 144,
};
// These apply to Firefox and Opera
var _mozilla_keycodes = {
'; :': 59, '= +': 61, '- _': 173, 'meta': 224, 'minus':173
};
// This apply to Webkit and IE
var _ie_keycodes = {
'; :': 186, '= +': 187, '- _': 189, 'minus':189
};
var browser = utils.browser[0];
var platform = utils.platform;
if (browser === 'Firefox' || browser === 'Opera' || browser === 'Netscape') {
$.extend(_keycodes, _mozilla_keycodes);
} else if (browser === 'Safari' || browser === 'Chrome' || browser === 'MSIE') {
@ -455,7 +454,7 @@ define([
return (typeof(action_name) !== 'undefined');
};
var keyboard = {
module.exports = {
keycodes : keycodes,
inv_keycodes : inv_keycodes,
ShortcutManager : ShortcutManager,
@ -464,6 +463,3 @@ define([
shortcut_to_event : shortcut_to_event,
event_to_shortcut : event_to_shortcut,
};
return keyboard;
});

@ -1,38 +1,37 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var Jupyter = Jupyter || {};
var jprop = function(name, module_path){
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'")`');
return require(module_path);
},
enumerable: true,
configurable: false
});
}
var jglobal = function(name, module_path){
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'").'+name+'`');
return require(module_path)[name];
},
enumerable: true,
configurable: false
});
}
define(function(){
"use strict";
var Jupyter = Jupyter || {};
var jprop = function(name, module_path){
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'")`');
return require(module_path);
},
enumerable: true,
configurable: false
});
}
var jglobal = function(name, module_path){
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'").'+name+'`');
return require(module_path)[name];
},
enumerable: true,
configurable: false
});
}
// expose modules
jprop('utils','base/js/utils')
//Jupyter.load_extensions = Jupyter.utils.load_extensions;
//
jprop('security','base/js/security');
@ -75,8 +74,8 @@ define(function(){
Jupyter.version = "4.1.0.dev";
Jupyter._target = '_blank';
return Jupyter;
});
// deprecated since 4.0, remove in 5+
var IPython = Jupyter
module.exports = Jupyter;
// deprecated since 4.0, remove in 5+
window.IPython = Jupyter;

@ -1,12 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/notificationwidget',
], function($, notificationwidget) {
"use strict";
var notificationwidget = require('base/js/notificationwidget');
var $ = require('jquery');
// store reference to the NotificationWidget class
var NotificationWidget = notificationwidget.NotificationWidget;
@ -79,5 +78,4 @@ define([
return this.widget_dict[name];
};
return {'NotificationArea': NotificationArea};
});
exports.NotificationArea = NotificationArea;

@ -1,10 +1,8 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
], function($) {
"use strict";
var $ = require('jquery');
/**
* Construct a NotificationWidget object.
@ -37,7 +35,7 @@ define([
// for this particular combination
this.element.addClass('notification_widget btn btn-xs navbar-btn');
};
/**
* hide the widget and empty the text
**/
@ -166,5 +164,4 @@ define([
return this.inner.html();
};
return {'NotificationWidget': NotificationWidget};
});
exports.NotificationWidget = NotificationWidget;

@ -1,11 +1,10 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/events',
], function($, events){
"use strict";
var events = require('base/js/events');
var $ = require('jquery');
var Page = function () {
this.bind_events();
@ -58,5 +57,4 @@ define([
$('div#site').height($(window).height() - $('#header').height());
};
return {'Page': Page};
});
exports.Page = Page;

@ -1,21 +1,20 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'components/google-caja/html-css-sanitizer-minified',
], function($, sanitize) {
"use strict";
var $ = require('jquery');
var sanitize = require('components/google-caja/html-css-sanitizer-minified');
var noop = function (x) { return x; };
var caja;
if (window && window.html) {
caja = window.html;
caja.html4 = window.html4;
caja.sanitizeStylesheet = window.sanitizeStylesheet;
}
var sanitizeAttribs = function (tagName, attribs, opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger) {
/**
* add trusting data-attributes to the default sanitizeAttribs from caja
@ -33,7 +32,7 @@ define([
}
return caja.sanitizeAttribs(tagName, attribs, opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger);
};
var sanitize_css = function (css, tagPolicy) {
/**
* sanitize CSS
@ -52,7 +51,7 @@ define([
noop
);
};
var sanitize_stylesheets = function (html, tagPolicy) {
/**
* sanitize just the css in style tags in a block of html
@ -69,7 +68,7 @@ define([
});
return h.html();
};
var sanitize_html = function (html, allow_css) {
/**
* sanitize HTML
@ -116,11 +115,8 @@ define([
return sanitized;
};
var security = {
module.exports = {
caja: caja,
sanitize_html: sanitize_html
};
return security;
});

@ -1,15 +1,13 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'codemirror/lib/codemirror',
'moment',
// silently upgrades CodeMirror
'codemirror/mode/meta',
], function($, CodeMirror, moment){
"use strict";
var $ = require('jquery');
var CodeMirror = require('codemirror/lib/codemirror');
var moment = require('moment');
require('codemirror/mode/meta');
/**
* Load a single extension.
* @param {string} extension - extension path.
@ -217,7 +215,7 @@ define([
"46":"ansibgcyan",
"47":"ansibggray"
};
function _process_numbers(attrs, numbers) {
// process ansi escapes
var n = numbers.shift();
@ -374,7 +372,7 @@ define([
test.remove();
return Math.floor(points*pixel_per_point);
};
var always_new = function (constructor) {
/**
* wrapper around contructor to avoid requiring `var a = new constructor()`
@ -407,7 +405,7 @@ define([
url = url.replace(/\/\/+/, '/');
return url;
};
var url_path_split = function (path) {
/**
* Like os.path.split for URLs.
@ -421,7 +419,7 @@ define([
return [ path.slice(0, idx), path.slice(idx + 1) ];
}
};
var parse_url = function (url) {
/**
* an `a` element with an href allows attr-access to the parsed segments of a URL
@ -437,7 +435,7 @@ define([
a.href = url;
return a;
};
var encode_uri_components = function (uri) {
/**
* encode just the components of a multi-segment uri,
@ -445,7 +443,7 @@ define([
*/
return uri.split('/').map(encodeURIComponent).join('/');
};
var url_join_encode = function () {
/**
* join a sequence of url components with '/',
@ -488,7 +486,7 @@ define([
return val;
return decodeURIComponent(val);
};
var to_absolute_cursor_pos = function (cm, cursor) {
/**
* get the absolute cursor position from CodeMirror's col, ch
@ -502,7 +500,7 @@ define([
}
return cursor_pos;
};
var from_absolute_cursor_pos = function (cm, cursor_pos) {
/**
* turn absolute cursor position into CodeMirror col, ch cursor
@ -526,7 +524,7 @@ define([
ch : line.length - 1,
};
};
// http://stackoverflow.com/questions/2400935/browser-detection-in-javascript
var browser = (function() {
if (typeof navigator === 'undefined') {
@ -553,7 +551,7 @@ define([
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
return OSName;
})();
var get_url_param = function (name) {
// get a URL parameter. I cannot believe we actually need this.
// Based on http://stackoverflow.com/a/25359264/938949
@ -562,7 +560,7 @@ define([
return decodeURIComponent(match[1] || '');
}
};
var is_or_has = function (a, b) {
/**
* Is b a child of a or a itself?
@ -586,13 +584,13 @@ define([
return false;
}
};
var mergeopt = function(_class, options, overwrite){
options = options || {};
overwrite = overwrite || {};
return $.extend(true, {}, _class.options_default, options, overwrite);
};
var ajax_error_msg = function (jqXHR) {
/**
* Return a JSON error message if there is one,
@ -651,10 +649,10 @@ define([
}, errback
);
};
/** Error type for wrapped XHR errors. */
var XHR_ERROR = 'XhrError';
/**
* Wraps an AJAX error as an Error object.
*/
@ -667,7 +665,7 @@ define([
wrapped_error.xhr_error = error;
return wrapped_error;
};
var promising_ajax = function(url, settings) {
/**
* Like $.ajax, but returning an ES6 promise. success and error settings
@ -805,14 +803,14 @@ define([
return MathJax.Hub.Queue(["Typeset", MathJax.Hub, this]);
});
};
var time = {};
time.milliseconds = {};
time.milliseconds.s = 1000;
time.milliseconds.m = 60 * time.milliseconds.s;
time.milliseconds.h = 60 * time.milliseconds.m;
time.milliseconds.d = 24 * time.milliseconds.h;
time.thresholds = {
// moment.js thresholds in milliseconds
s: moment.relativeTimeThreshold('s') * time.milliseconds.s,
@ -820,7 +818,7 @@ define([
h: moment.relativeTimeThreshold('h') * time.milliseconds.h,
d: moment.relativeTimeThreshold('d') * time.milliseconds.d,
};
time.timeout_from_dt = function (dt) {
/** compute a timeout based on dt
@ -840,8 +838,8 @@ define([
return time.milliseconds.h;
}
};
var utils = {
module.exports = {
load_extension: load_extension,
load_extensions: load_extensions,
load_extensions_from_config: load_extensions_from_config,
@ -881,6 +879,3 @@ define([
typeset: typeset,
time: time,
};
return utils;
});

@ -1,26 +1,21 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
'codemirror/lib/codemirror',
'codemirror/mode/meta',
'codemirror/addon/comment/comment',
'codemirror/addon/dialog/dialog',
'codemirror/addon/edit/closebrackets',
'codemirror/addon/edit/matchbrackets',
'codemirror/addon/search/searchcursor',
'codemirror/addon/search/search',
'codemirror/keymap/emacs',
'codemirror/keymap/sublime',
'codemirror/keymap/vim',
],
function($,
utils,
CodeMirror
) {
"use strict";
var $ = require('jquery');
var CodeMirror = require('codemirror/lib/codemirror');
var utils = require('base/js/utils');
require('codemirror/mode/meta');
require('codemirror/addon/comment/comment');
require('codemirror/addon/dialog/dialog');
require('codemirror/addon/edit/closebrackets');
require('codemirror/addon/edit/matchbrackets');
require('codemirror/addon/search/searchcursor');
require('codemirror/addon/search/search');
require('codemirror/keymap/emacs');
require('codemirror/keymap/sublime');
require('codemirror/keymap/vim');
var Editor = function(selector, options) {
var that = this;
@ -59,7 +54,7 @@ function($,
$('.last_modified').before(this.clean_sel);
this.clean_sel.addClass('dirty-indicator-dirty');
};
// default CodeMirror options
Editor.default_codemirror_options = {
extraKeys: {
@ -70,7 +65,7 @@ function($,
lineNumbers: true,
lineWrapping: true,
};
Editor.prototype.load = function() {
/** load the file */
var that = this;
@ -141,7 +136,7 @@ function($,
that.events.trigger("mode_changed.Editor", modeinfo);
});
};
Editor.prototype.get_filename = function () {
return utils.url_path_split(this.file_path)[1];
};
@ -160,7 +155,7 @@ function($,
}
);
};
Editor.prototype.save = function () {
/** save the file */
if (!this.save_enabled) {
@ -210,7 +205,7 @@ function($,
});
var that = this;
};
Editor.prototype.update_codemirror_options = function (options) {
/** update codemirror options locally and save changes in config */
var that = this;
@ -224,5 +219,4 @@ function($,
);
};
return {Editor: Editor};
});
exports.Editor = Editor;

@ -1,33 +1,20 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
require([
'jquery',
'base/js/namespace',
'base/js/utils',
'base/js/page',
'base/js/events',
'contents',
'services/config',
'edit/js/editor',
'edit/js/menubar',
'edit/js/savewidget',
'edit/js/notificationarea',
'custom/custom',
], function(
$,
IPython,
utils,
page,
events,
contents,
configmod,
editmod,
menubar,
savewidget,
notificationarea
){
"use strict";
var $ = require('jquery');
var IPython = require('base/js/namespace');
var utils = require('base/js/utils');
var page = require('base/js/page');
var events = require('base/js/events');
var contents = require('contents');
var configmod = require('services/config');
var editmod = require('edit/js/editor');
var menubar = require('edit/js/menubar');
var savewidget = require('edit/js/savewidget');
var notificationarea = require('edit/js/notificationarea');
require('custom/custom');
page = new page.Page();
var base_url = utils.get_body_data('baseUrl');
@ -40,7 +27,7 @@ require([
base_url: base_url,
common_config: common_config
});
var editor = new editmod.Editor('#texteditor-container', {
base_url: base_url,
events: events,
@ -48,22 +35,22 @@ require([
file_path: file_path,
config: config,
});
// Make it available for debugging
IPython.editor = editor;
var save_widget = new savewidget.SaveWidget('span#save_widget', {
editor: editor,
events: events,
});
var menus = new menubar.MenuBar('#menubar', {
base_url: base_url,
editor: editor,
events: events,
save_widget: save_widget,
});
var notification_area = new notificationarea.EditorNotificationArea(
'#notification_area', {
events: events,
@ -94,4 +81,3 @@ require([
// On document ready, resize codemirror.
$(document).ready(_handle_resize);
});

@ -1,17 +1,15 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/namespace',
'base/js/utils',
'base/js/dialog',
'codemirror/lib/codemirror',
'codemirror/mode/meta',
'bootstrap',
], function($, IPython, utils, dialog, CodeMirror) {
"use strict";
var $ = require('jquery');
var IPython = require('base/js/namespace');
var utils = require('base/js/utils');
var dialog = require('base/js/dialog');
var CodeMirror = require('codemirror/lib/codemirror');
require('codemirror/mode/meta');
require('bootstrap');
var MenuBar = function (selector, options) {
/**
* Constructor
@ -134,7 +132,7 @@ define([
);
});
};
MenuBar.prototype._load_mode_menu = function () {
var list = this.element.find("#mode-menu");
var editor = this.editor;
@ -156,5 +154,4 @@ define([
}
};
return {'MenuBar': MenuBar};
});
exports.MenuBar = MenuBar;

@ -1,15 +1,15 @@
define([
'base/js/notificationarea'
], function(notificationarea) {
"use strict";
var notificationarea = require('base/js/notificationarea');
var NotificationArea = notificationarea.NotificationArea;
var EditorNotificationArea = function(selector, options) {
NotificationArea.apply(this, [selector, options]);
}
EditorNotificationArea.prototype = Object.create(NotificationArea.prototype);
/**
* Initialize the default set of notification widgets.
*
@ -23,7 +23,5 @@ define([
savew.set_message("File saved", 2000);
});
};
return {EditorNotificationArea: EditorNotificationArea};
});
exports.EditorNotificationArea = EditorNotificationArea;

@ -1,15 +1,13 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
'base/js/dialog',
'base/js/keyboard',
'moment',
], function($, utils, dialog, keyboard, moment) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var dialog = require('base/js/dialog');
var keyboard = require('base/js/keyboard');
var moment = require('moment');
var SaveWidget = function (selector, options) {
this.editor = undefined;
this.selector = selector;
@ -134,7 +132,7 @@ define([
}
this._render_last_modified();
};
SaveWidget.prototype._render_last_modified = function () {
/** actually set the text in the element, from our _last_modified value
@ -160,7 +158,7 @@ define([
}
el.text(human_date).attr('title', long_date);
};
SaveWidget.prototype._schedule_render_last_modified = function () {
/** schedule the next update to relative date
@ -179,6 +177,4 @@ define([
);
};
return {'SaveWidget': SaveWidget};
});
exports.SaveWidget = SaveWidget;

@ -1,12 +1,12 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
require([
'jquery',
'base/js/dialog',
'underscore',
'base/js/namespace'
], function ($, dialog, _, IPython) {
'use strict';
var $ = require('jquery');
var dialog = require('base/js/dialog');
var _ = require('underscore');
var IPython = require('base/js/namespace');
$('#notebook_about').click(function () {
// use underscore template to auto html escape
var text = 'You are using Jupyter notebook.<br/><br/>';
@ -35,4 +35,3 @@ require([
kinfo.html($('<p/>').text('unable to contact kernel'));
}
});
});

@ -1,7 +1,5 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(function(require){
"use strict";
@ -575,6 +573,4 @@ define(function(require){
return (typeof(this._actions[name]) !== 'undefined');
};
return {init:ActionHandler};
});
exports.init = ActionHandler;

@ -8,20 +8,17 @@
* @namespace cell
* @class Cell
*/
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var CodeMirror = require('codemirror/lib/codemirror');
var cm_match = require('codemirror/addon/edit/matchbrackets');
var cm_closeb = require('codemirror/addon/edit/closebrackets');
var cm_comment = require('codemirror/addon/comment/comment');
define([
'jquery',
'base/js/utils',
'codemirror/lib/codemirror',
'codemirror/addon/edit/matchbrackets',
'codemirror/addon/edit/closebrackets',
'codemirror/addon/comment/comment'
], function($, utils, CodeMirror, cm_match, cm_closeb, cm_comment) {
"use strict";
var overlayHack = CodeMirror.scrollbarModel.native.prototype.overlayHack;
CodeMirror.scrollbarModel.native.prototype.overlayHack = function () {
overlayHack.apply(this, arguments);
// Reverse `min-height: 18px` scrollbar hack on OS X
@ -34,7 +31,7 @@ define([
this.horiz.style.minHeight = "";
}
};
var Cell = function (options) {
/* Constructor
*
@ -122,7 +119,7 @@ define([
}
}
};
// FIXME: Workaround CM Bug #332 (Safari segfault on drag)
// by disabling drag/drop altogether on Safari
// https://github.com/codemirror/CodeMirror/issues/332
@ -201,7 +198,7 @@ define([
}
});
};
/**
* This method gets called in CodeMirror's onKeyDown/onKeyPress
* handlers and is used to provide custom key handling.
@ -397,7 +394,7 @@ define([
this.focus_cell();
}
}
/**
* Focus the cell in the DOM sense
* @method focus_cell
@ -553,7 +550,7 @@ define([
this.user_highlight = mode;
this.auto_highlight();
};
/**
* Trigger autodetection of highlight scheme for current cell
* @method auto_highlight
@ -561,7 +558,7 @@ define([
Cell.prototype.auto_highlight = function () {
this._auto_highlight(this.class_config.get_sync('highlight_modes'));
};
/**
* Try to autodetect cell highlight mode, or use selected mode
* @methods _auto_highlight
@ -659,17 +656,17 @@ define([
};
UnrecognizedCell.prototype = Object.create(Cell.prototype);
// cannot merge or split unrecognized cells
UnrecognizedCell.prototype.is_mergeable = function () {
return false;
};
UnrecognizedCell.prototype.is_splittable = function () {
return false;
};
UnrecognizedCell.prototype.toJSON = function () {
/**
* deepcopy the metadata so copied cells don't share the same object
@ -686,7 +683,7 @@ define([
}
this.element.find('.inner_cell').find("a").text("Unrecognized cell type: " + data.cell_type);
};
UnrecognizedCell.prototype.create_element = function () {
Cell.prototype.create_element.apply(this, arguments);
var cell = this.element = $("<div>").addClass('cell unrecognized_cell');
@ -703,7 +700,7 @@ define([
cell.append(inner_cell);
this.element = cell;
};
UnrecognizedCell.prototype.bind_events = function () {
Cell.prototype.bind_events.apply(this, arguments);
var cell = this;
@ -713,8 +710,7 @@ define([
});
};
return {
module.exports = {
Cell: Cell,
UnrecognizedCell: UnrecognizedCell
};
});

@ -1,13 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'base/js/namespace',
'jquery',
'base/js/events'
], function(IPython, $, events) {
"use strict";
var IPython = require('base/js/namespace');
var $ = require('jquery');
var events = require('base/js/events');
var CellToolbar = function (options) {
/**
* Constructor
@ -464,5 +462,4 @@ define([
// Backwards compatability.
IPython.CellToolbar = CellToolbar;
return {'CellToolbar': CellToolbar};
});
exports.CellToolbar = CellToolbar;

@ -1,13 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'notebook/js/celltoolbar',
'base/js/dialog',
], function($, celltoolbar, dialog) {
"use strict";
var $ = require('jquery');
var celltoolbar = require('notebook/js/celltoolbar');
var dialog = require('base/js/dialog');
var CellToolbar = celltoolbar.CellToolbar;
var raw_edit = function (cell) {
@ -47,5 +45,4 @@ define([
CellToolbar.register_preset('Edit Metadata', example_preset, notebook);
console.log('Default extension for cell metadata editing loaded.');
};
return {'register': register};
});
exports.register = register;

@ -8,17 +8,15 @@
// ```
// $.getScript('/static/js/celltoolbarpresets/example.js');
// ```
define([
'jquery',
'notebook/js/celltoolbar',
], function($, celltoolbar) {
"use strict";
var $ = require('jquery');
var celltoolbar = require('notebook/js/celltoolbar');
var CellToolbar = celltoolbar.CellToolbar;
var example_preset = [];
var simple_button = function(div, cell) {
var simple_button = function(div
cell) {
var button_container = $(div);
var button = $('<div/>').button({icons:{primary:'ui-icon-locked'}});
var fun = function(value){
@ -146,5 +144,4 @@ define([
CellToolbar.register_preset('Example',example_preset, notebook);
console.log('Example extension for metadata editing loaded.');
};
return {'register': register};
});
exports.register = register;

@ -1,18 +1,16 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'notebook/js/celltoolbar',
'base/js/dialog',
'base/js/keyboard',
], function($, celltoolbar, dialog, keyboard) {
"use strict";
var CellToolbar = celltoolbar.CellToolbar;
var raw_cell_preset = [];
var $ = require('jquery');
var celltoolbar = require('notebook/js/celltoolbar');
var dialog = require('base/js/dialog');
var keyboard = require('base/js/keyboard');
var CellToolbar = celltoolbar.CellToolbar;
var raw_cell_preset = [];
var select_type = CellToolbar.utils.select_ui_generator([
var select_type = CellToolbar.utils.select_ui_generator([
["None", "-"],
["LaTeX", "text/latex"],
["reST", "text/restructuredtext"],
@ -72,15 +70,13 @@ define([
},
// name
"Raw NBConvert Format"
);
);
var register = function (notebook) {
var register = function (notebook) {
CellToolbar.register_callback('raw_cell.select', select_type, ['raw']);
raw_cell_preset.push('raw_cell.select');
CellToolbar.register_preset('Raw Cell Format', raw_cell_preset, notebook);
console.log('Raw Cell Format toolbar preset loaded.');
};
return {'register': register};
});
};
exports.register = register;

@ -1,12 +1,9 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'notebook/js/celltoolbar',
], function($, celltoolbar) {
"use strict";
var $ = require('jquery');
var celltoolbar = require('notebook/js/celltoolbar');
var CellToolbar = celltoolbar.CellToolbar;
var slideshow_preset = [];
@ -42,5 +39,4 @@ define([
CellToolbar.register_preset('Slideshow',slideshow_preset, notebook);
console.log('Slideshow extension for metadata editing loaded.');
};
return {'register': register};
});
exports.register = register;

@ -7,36 +7,21 @@
* @namespace codecell
* @class CodeCell
*/
"use strict";
var IPython = require('base/js/namespace');
var $ = require('jquery');
var utils = require('base/js/utils');
var keyboard = require('base/js/keyboard');
var configmod = require('services/config');
var cell = require('notebook/js/cell');
var outputarea = require('notebook/js/outputarea');
var completer = require('notebook/js/completer');
var celltoolbar = require('notebook/js/celltoolbar');
var CodeMirror = require('codemirror/lib/codemirror');
var cmpython = require('codemirror/mode/python/python');
var cmip = require('notebook/js/codemirror-ipython');
define([
'base/js/namespace',
'jquery',
'base/js/utils',
'base/js/keyboard',
'services/config',
'notebook/js/cell',
'notebook/js/outputarea',
'notebook/js/completer',
'notebook/js/celltoolbar',
'codemirror/lib/codemirror',
'codemirror/mode/python/python',
'notebook/js/codemirror-ipython'
], function(IPython,
$,
utils,
keyboard,
configmod,
cell,
outputarea,
completer,
celltoolbar,
CodeMirror,
cmpython,
cmip
) {
"use strict";
var Cell = cell.Cell;
/* local util for codemirror */
@ -144,7 +129,7 @@ define([
CodeCell.msg_cells = {};
CodeCell.prototype = Object.create(Cell.prototype);
/** @method create_element */
CodeCell.prototype.create_element = function () {
Cell.prototype.create_element.apply(this, arguments);
@ -331,7 +316,7 @@ define([
this.render();
this.events.trigger('execute.CodeCell', {cell: this});
};
/**
* Construct the default callbacks for
* @method get_callbacks
@ -357,7 +342,7 @@ define([
input : $.proxy(this._handle_input_request, this)
};
};
CodeCell.prototype._open_with_pager = function (payload) {
this.events.trigger('open_with_text.Pager', payload);
};
@ -406,7 +391,7 @@ define([
// Always execute, even if we are already in the rendered state
return cont;
};
CodeCell.prototype.select_all = function () {
var start = {line: 0, ch: 0};
var nlines = this.code_mirror.lineCount();
@ -555,5 +540,4 @@ define([
// Backwards compatability.
IPython.CodeCell = CodeCell;
return {'CodeCell': CodeCell};
});
exports.CodeCell = CodeCell;

@ -1,15 +1,13 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
'base/js/keyboard',
'notebook/js/contexthint',
'codemirror/lib/codemirror',
], function($, utils, keyboard, CodeMirror) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var keyboard = require('base/js/keyboard');
var CodeMirror = require('codemirror/lib/codemirror');
require('notebook/js/contexthint');
// easier key mapping
var keycodes = keyboard.keycodes;
@ -408,5 +406,4 @@ define([
}, 50);
};
return {'Completer': Completer};
});
exports.Completer = Completer;

@ -2,8 +2,8 @@
// Distributed under the terms of the Modified BSD License.
// highly adapted for codemiror jshint
define(['codemirror/lib/codemirror'], function(CodeMirror) {
"use strict";
var CodeMirror = require('codemirror/lib/codemirror');
var forEach = function(arr, f) {
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
@ -94,5 +94,4 @@ define(['codemirror/lib/codemirror'], function(CodeMirror) {
return filterd;
};
return {'contextHint': CodeMirror.contextHint};
});
exports.contextHint = CodeMirror.contextHint;

@ -1,14 +1,10 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/namespace',
'base/js/dialog',
'base/js/utils',
], function($, IPython, dialog, utils) {
"use strict";
var $ = require('jquery');
var IPython = require('base/js/namespace');
var dialog = require('base/js/dialog');
var utils = require('base/js/utils');
var KernelSelector = function(selector, notebook) {
var that = this;
this.selector = selector;
@ -32,14 +28,14 @@ define([
Object.seal(this);
};
KernelSelector.prototype.request_kernelspecs = function() {
// Preliminary documentation for kernelspecs api is at
// https://github.com/ipython/ipython/wiki/IPEP-25%3A-Registry-of-installed-kernels#rest-api
var url = utils.url_join_encode(this.notebook.base_url, 'api/kernelspecs');
utils.promising_ajax(url).then($.proxy(this._got_kernelspecs, this));
};
var _sorted_names = function(kernelspecs) {
// sort kernel names
return Object.keys(kernelspecs).sort(function (a, b) {
@ -55,7 +51,7 @@ define([
}
});
};
KernelSelector.prototype._got_kernelspecs = function(data) {
var that = this;
this.kernelspecs = data.kernelspecs;
@ -93,7 +89,7 @@ define([
this._loaded = true;
this._finish_load();
};
KernelSelector.prototype._spec_changed = function (event, ks) {
/** event handler for spec_changed */
var that = this;
@ -238,7 +234,7 @@ define([
this.current_selection = ks.name;
this.events.trigger('spec_changed.Kernel', ks);
};
KernelSelector.prototype._spec_not_found = function (event, data) {
var that = this;
var select = $("<select>").addClass('form-control');
@ -333,5 +329,4 @@ define([
});
};
return {'KernelSelector': KernelSelector};
});
exports.KernelSelector = KernelSelector;

@ -7,14 +7,11 @@
* @namespace keyboardmanager
* @class KeyboardManager
*/
define([
'jquery',
'base/js/utils',
'base/js/keyboard',
], function($, utils, keyboard) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var keyboard = require('base/js/keyboard');
// Main keyboard manager for the notebook
var keycodes = keyboard.keycodes;
@ -139,7 +136,7 @@ define([
this.notebook = notebook;
this.actions.extend_env({notebook:notebook});
};
KeyboardManager.prototype.set_quickhelp = function (notebook) {
this.actions.extend_env({quick_help:notebook});
};
@ -226,5 +223,4 @@ define([
});
};
return {'KeyboardManager': KeyboardManager};
});
exports.KeyboardManager = KeyboardManager;

@ -1,6 +1,29 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
require([
'base/js/namespace',
'jquery',
'notebook/js/notebook',
'contents',
'services/config',
'base/js/utils',
'base/js/page',
'base/js/events',
'auth/js/loginwidget',
'notebook/js/maintoolbar',
'notebook/js/pager',
'notebook/js/quickhelp',
'notebook/js/menubar',
'notebook/js/notificationarea',
'notebook/js/savewidget',
'notebook/js/actions',
'notebook/js/keyboardmanager',
'notebook/js/kernelselector',
'codemirror/lib/codemirror',
'notebook/js/about',
'typeahead',
require([
'base/js/namespace',
'jquery',
@ -24,35 +47,32 @@ require([
'notebook/js/about',
'typeahead',
'notebook/js/searchandreplace',
// only loaded, not used, please keep sure this is loaded last
'custom/custom'
], function(
IPython,
$,
notebook,
contents,
configmod,
utils,
page,
events,
loginwidget,
maintoolbar,
pager,
quickhelp,
menubar,
notificationarea,
savewidget,
actions,
keyboardmanager,
kernelselector,
CodeMirror,
about,
typeahead,
searchandreplace,
// please keep sure that even if not used, this is loaded last
custom
) {
"use strict";
var IPython = require('base/js/namespace');
var $ = require('jquery');
var notebook = require('notebook/js/notebook');
var contents = require('contents');
var configmod = require('services/config');
var utils = require('base/js/utils');
var page = require('base/js/page');
var events = require('base/js/events');
var loginwidget = require('auth/js/loginwidget');
var maintoolbar = require('notebook/js/maintoolbar');
var pager = require('notebook/js/pager');
var quickhelp = require('notebook/js/quickhelp');
var menubar = require('notebook/js/menubar');
var notificationarea = require('notebook/js/notificationarea');
var savewidget = require('notebook/js/savewidget');
var actions = require('notebook/js/actions');
var keyboardmanager = require('notebook/js/keyboardmanager');
var kernelselector = require('notebook/js/kernelselector');
var CodeMirror = require('codemirror/lib/codemirror');
var about = require('notebook/js/about');
var typeahead = require('typeahead');
var searchandreplace = 'notebook/js/searchandreplace';
// only loaded, not used, please keep sure this is loaded last
var custom = require('custom/custom');
// BEGIN HARDCODED WIDGETS HACK
utils.load_extension('widgets/notebook/js/extension').catch(function () {
@ -149,7 +169,7 @@ require([
events.off('notebook_loaded.Notebook', first_load);
};
events.on('notebook_loaded.Notebook', first_load);
IPython.page = page;
IPython.notebook = notebook;
IPython.contents = contents;
@ -167,5 +187,3 @@ require([
utils.load_extensions_from_config(config_section);
utils.load_extensions_from_config(common_config);
notebook.load_notebook(common_options.notebook_path);
});

@ -1,14 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'require',
'jquery',
'./toolbar',
'./celltoolbar'
], function(require, $, toolbar, celltoolbar) {
"use strict";
var require = require('require');
var $ = require('jquery');
var toolbar = require('./toolbar');
var celltoolbar = require('./celltoolbar');
var MainToolBar = function (selector, options) {
/**
* Constructor
@ -60,7 +57,7 @@ define([
];
this.construct(grps);
};
// add a cell type drop down to the maintoolbar.
// triggered when the pseudo action `<add_celltype_list>` is
// encountered when building a toolbar.
@ -158,5 +155,4 @@ define([
return wrapper;
};
return {'MainToolBar': MainToolBar};
});
exports.MainToolBar = MainToolBar;

@ -1,13 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
'base/js/dialog',
], function($, utils, dialog) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var dialog = require('base/js/dialog');
var init = function () {
if (window.MathJax) {
// MathJax loaded
@ -202,11 +200,8 @@ define([
return text;
};
var mathjaxutils = {
module.exports = {
init : init,
remove_math : remove_math,
replace_math : replace_math
};
return mathjaxutils;
});

@ -1,17 +1,15 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/namespace',
'base/js/dialog',
'base/js/utils',
'notebook/js/tour',
'bootstrap',
'moment',
], function($, IPython, dialog, utils, tour, bootstrap, moment) {
"use strict";
var $ = require('jquery');
var IPython = require('base/js/namespace');
var dialog = require('base/js/dialog');
var utils = require('base/js/utils');
var tour = require('notebook/js/tour');
var bootstrap = require('bootstrap');
var moment = require('moment');
var MenuBar = function (selector, options) {
/**
* Constructor
@ -365,7 +363,7 @@ define([
);
});
};
MenuBar.prototype.update_nbconvert_script = function(langinfo) {
/**
* Set the 'Download as foo' menu option for the relevant language.
@ -418,5 +416,4 @@ define([
};
return {'MenuBar': MenuBar};
});
exports.MenuBar = MenuBar;

@ -4,8 +4,8 @@
/**
* @module notebook
*/
define(function (require) {
"use strict";
var IPython = require('base/js/namespace');
var $ = require('jquery');
var utils = require('base/js/utils');
@ -319,7 +319,6 @@ define(function (require) {
return;
};
};
Notebook.prototype.show_command_palette = function() {
var x = new commandpalette.CommandPalette(this);
@ -531,7 +530,7 @@ define(function (require) {
}
return result;
};
/**
* Get the numeric index of a given cell.
*
@ -812,7 +811,7 @@ define(function (require) {
cell.focus_editor();
}
};
/**
* Ensure either cell, or codemirror is focused. Is none
* is focused, focus the cell.
@ -1266,7 +1265,7 @@ define(function (require) {
}
}
};
/**
* Warn about heading cell support removal.
*/
@ -1286,7 +1285,7 @@ define(function (require) {
}
});
};
/**
* Turn a cell into a heading containing markdown cell.
*
@ -1700,7 +1699,7 @@ define(function (require) {
var _mode_equal = function(mode1, mode2){
return ((mode1||{}).name||mode1)===((mode2||{}).name||mode2);
};
/**
* Set the codemirror mode for all code cells, including the default for
* new code cells.
@ -1780,7 +1779,7 @@ define(function (require) {
this._session_starting = false;
utils.log_ajax_error(jqxhr, status, error);
};
/**
* Prompt the user to restart the Jupyter kernel.
*/
@ -1811,7 +1810,7 @@ define(function (require) {
}
});
};
/**
* Execute or render cell outputs and go into command mode.
*/
@ -2062,7 +2061,7 @@ define(function (require) {
this.events.trigger("autosave_disabled.Notebook");
}
};
/**
* Save this notebook on the server. This becomes a notebook instance's
* .save_notebook method *after* the entire notebook has been loaded.
@ -2145,7 +2144,7 @@ define(function (require) {
return _save();
}
};
/**
* Success callback for saving a notebook.
*
@ -2186,7 +2185,7 @@ define(function (require) {
this._checkpoint_after_save = false;
}
};
/**
* Update the autosave interval based on the duration of the last save.
*
@ -2274,7 +2273,7 @@ define(function (require) {
}
);
};
/**
* Ensure a filename has the right extension
* Returns the filename with the appropriate extension, appending if necessary.
@ -2516,7 +2515,7 @@ define(function (require) {
};
/********************* checkpoint-related ********************/
/**
* Save the notebook then immediately create a checkpoint.
*/
@ -2524,7 +2523,7 @@ define(function (require) {
this._checkpoint_after_save = true;
this.save_notebook();
};
/**
* Add a checkpoint for this notebook.
*/
@ -2543,7 +2542,7 @@ define(function (require) {
}
this.last_checkpoint = this.checkpoints[this.checkpoints.length - 1];
};
/**
* List checkpoints for this notebook.
*/
@ -2640,7 +2639,7 @@ define(function (require) {
}
});
};
/**
* Restore the notebook to a checkpoint state.
*
@ -2656,7 +2655,7 @@ define(function (require) {
}
);
};
/**
* Success callback for restoring a notebook to a checkpoint.
*/
@ -2680,7 +2679,7 @@ define(function (require) {
}
);
};
/**
* Success callback for deleting a notebook checkpoint.
*/
@ -2689,5 +2688,4 @@ define(function (require) {
this.load_notebook(this.notebook_path);
};
return {'Notebook': Notebook};
});
exports.Notebook = Notebook;

@ -1,22 +1,24 @@
define([
'jquery',
'base/js/utils',
'base/js/dialog',
'base/js/notificationarea',
'moment'
], function($, utils, dialog, notificationarea, moment) {
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var dialog = require('base/js/dialog');
var notificationarea = require('base/js/notificationarea');
var moment = require('moment');
var NotificationArea = notificationarea.NotificationArea;
var NotebookNotificationArea = function(selector, options) {
NotificationArea.apply(this, [selector, options]);
this.save_widget = options.save_widget;
this.notebook = options.notebook;
this.keyboard_manager = options.keyboard_manager;
};
NotebookNotificationArea.prototype = Object.create(NotificationArea.prototype);
/**
* Initialize the default set of notification widgets.
*
@ -339,5 +341,4 @@ define([
});
};
return {'NotebookNotificationArea': NotebookNotificationArea};
});
exports.NotebookNotificationArea = NotebookNotificationArea;

@ -1,16 +1,14 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jqueryui',
'base/js/utils',
'base/js/security',
'base/js/keyboard',
'notebook/js/mathjaxutils',
'components/marked/lib/marked',
], function($, utils, security, keyboard, mathjaxutils, marked) {
"use strict";
var $ = require('jqueryui');
var utils = require('base/js/utils');
var security = require('base/js/security');
var keyboard = require('base/js/keyboard');
var mathjaxutils = require('notebook/js/mathjaxutils');
var marked = require('components/marked/lib/marked');
/**
* @class OutputArea
*
@ -232,8 +230,8 @@ define([
}
this.append_output(json);
};
OutputArea.output_types = [
'application/javascript',
'text/html',
@ -268,7 +266,7 @@ define([
});
return bundle;
};
OutputArea.prototype.append_output = function (json) {
this.expand();
@ -401,7 +399,7 @@ define([
.append($('<div/>').text(err.toString()).addClass('js-error'))
.append($('<div/>').text('See your browser Javascript console for more details.').addClass('js-error'));
};
OutputArea.prototype._safe_append = function (toinsert) {
/**
* safely append an item to the document
@ -548,7 +546,7 @@ define([
'image/png' : true,
'image/jpeg' : true
};
OutputArea.prototype.append_mime_type = function (json, element, handle_inserted) {
for (var i=0; i < OutputArea.display_order.length; i++) {
var type = OutputArea.display_order[i];
@ -685,7 +683,7 @@ define([
}
});
};
var set_width_height = function (img, md, mime) {
/**
* set width and height of an img element from metadata
@ -698,7 +696,7 @@ define([
img.addClass('unconfined');
}
};
var append_png = function (png, md, element, handle_inserted) {
var type = 'image/png';
var toinsert = this.create_output_subarea(md, "output_png", type);
@ -961,5 +959,4 @@ define([
"application/pdf" : append_pdf
};
return {'OutputArea': OutputArea};
});
exports.OutputArea = OutputArea;

@ -1,12 +1,10 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jqueryui',
'base/js/utils',
], function($, utils) {
"use strict";
var $ = require('jqueryui');
var utils = require('base/js/utils');
var Pager = function (pager_selector, options) {
/**
* Constructor
@ -166,5 +164,4 @@ define([
$('.end_space').css('height', Math.max(this.pager_element.height(), this._default_end_space));
};
return {'Pager': Pager};
});
exports.Pager = Pager;

@ -1,12 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
'base/js/dialog',
], function($, utils, dialog) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var dialog = require('base/js/dialog');
var platform = utils.platform;
var QuickHelp = function (options) {
@ -64,7 +63,7 @@ define([
{ shortcut: cmd_ctrl + "Shift-z", help:"redo" },
{ shortcut: cmd_ctrl + "y", help:"redo" },
].concat( platform_specific );
var mac_humanize_map = {
// all these are unicode, will probably display badly on anything except macs.
// these are the standard symbol that are used in MacOS native menus
@ -114,7 +113,7 @@ define([
'space':'Space',
'backspace':'Backspace',
};
var humanize_map;
if (platform === 'MacOS'){
@ -286,8 +285,7 @@ define([
return div;
};
return {'QuickHelp': QuickHelp,
module.exports = {'QuickHelp': QuickHelp,
humanize_shortcut: humanize_shortcut,
humanize_sequence: humanize_sequence
};
});

@ -1,15 +1,13 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
'base/js/dialog',
'base/js/keyboard',
'moment',
], function($, utils, dialog, keyboard, moment) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var dialog = require('base/js/dialog');
var keyboard = require('base/js/keyboard');
var moment = require('moment');
var SaveWidget = function (selector, options) {
/**
* TODO: Remove circular ref.
@ -162,7 +160,7 @@ define([
}
this._render_checkpoint();
};
SaveWidget.prototype._render_checkpoint = function () {
/** actually set the text in the element, from our _checkpoint value
@ -189,7 +187,7 @@ define([
el.text('Last Checkpoint: ' + human_date).attr('title', long_date);
};
SaveWidget.prototype._schedule_render_checkpoint = function () {
/** schedule the next update to relative date
@ -216,6 +214,4 @@ define([
}
};
return {'SaveWidget': SaveWidget};
});
exports.SaveWidget = SaveWidget;

@ -1,8 +1,8 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['jquery'], function($){
"use strict";
var $ = require('jquery');
var ScrollManager = function(notebook, options) {
/**
* Public constructor.
@ -205,10 +205,9 @@ define(['jquery'], function($){
};
// Return naemspace for require.js loads
return {
module.exports = {
'ScrollManager': ScrollManager,
'SlideScrollManager': SlideScrollManager,
'HeadingScrollManager': HeadingScrollManager,
'TargetScrollManager': TargetScrollManager
};
});

@ -1,32 +1,19 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'base/js/utils',
'jquery',
'notebook/js/cell',
'base/js/security',
'services/config',
'notebook/js/mathjaxutils',
'notebook/js/celltoolbar',
'components/marked/lib/marked',
'codemirror/lib/codemirror',
'codemirror/mode/gfm/gfm',
'notebook/js/codemirror-ipythongfm'
], function(
utils,
$,
cell,
security,
configmod,
mathjaxutils,
celltoolbar,
marked,
CodeMirror,
gfm,
ipgfm
) {
"use strict";
var utils = require('base/js/utils');
var $ = require('jquery');
var cell = require('notebook/js/cell');
var security = require('base/js/security');
var configmod = require('services/config');
var mathjaxutils = require('notebook/js/mathjaxutils');
var celltoolbar = require('notebook/js/celltoolbar');
var marked = require('components/marked/lib/marked');
var CodeMirror = require('codemirror/lib/codemirror');
var gfm = require('codemirror/mode/gfm/gfm');
var ipgfm = require('notebook/js/codemirror-ipythongfm');
var Cell = cell.Cell;
var TextCell = function (options) {
@ -116,7 +103,7 @@ define([
// Cell level actions
TextCell.prototype.select = function () {
var cont = Cell.prototype.select.apply(this);
if (cont) {
@ -325,7 +312,7 @@ define([
"It will not be rendered in the notebook. " +
"When passing through nbconvert, a Raw Cell's content is added to the output unmodified."
};
RawCell.config_defaults = {
highlight_modes : {
'diff' :{'reg':[/^diff/]}
@ -359,10 +346,8 @@ define([
return cont;
};
var textcell = {
module.exports = {
TextCell: TextCell,
MarkdownCell: MarkdownCell,
RawCell: RawCell
};
return textcell;
});

@ -1,10 +1,8 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery'
], function($) {
"use strict";
var $ = require('jquery');
/**
* A generic toolbar on which one can add button
@ -132,5 +130,4 @@ define([
this.element.toggle();
};
return {'ToolBar': ToolBar};
});
exports.ToolBar = ToolBar;

@ -1,12 +1,10 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
], function($, utils) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
// tooltip constructor
var Tooltip = function (events) {
var that = this;
@ -318,5 +316,4 @@ define([
this.text.scrollTop(0);
};
return {'Tooltip': Tooltip};
});
exports.Tooltip = Tooltip;

@ -1,12 +1,10 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'bootstraptour',
], function($, Tour) {
"use strict";
var $ = require('jquery');
var Tour = require('bootstraptour');
var tour_style = "<div class='popover tour'>\n" +
"<div class='arrow'></div>\n" +
"<div style='position:absolute; top:7px; right:7px'>\n" +
@ -148,17 +146,14 @@ define([
NotebookTour.prototype.command_icon_hack = function() {
$('#modal_indicator').css('min-height', 20);
};
NotebookTour.prototype.toggle_pause_play = function () {
$('#tour-pause').toggleClass('fa-pause fa-play');
};
NotebookTour.prototype.edit_mode = function() {
this.notebook.focus_cell();
this.notebook.edit_mode();
};
return {'Tour': NotebookTour};
});
exports.Tour = NotebookTour;

@ -1,12 +1,10 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
],
function($, utils) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var ConfigSection = function(section_name, options) {
this.section_name = section_name;
this.base_url = options.base_url;
@ -27,14 +25,14 @@ function($, utils) {
ConfigSection.prototype.api_url = function() {
return utils.url_join_encode(this.base_url, 'api/config', this.section_name);
};
ConfigSection.prototype._load_done = function() {
if (!this._one_load_finished) {
this._one_load_finished = true;
this._finish_firstload();
}
};
ConfigSection.prototype.load = function() {
var that = this;
return utils.promising_ajax(this.api_url(), {
@ -47,7 +45,7 @@ function($, utils) {
return data;
});
};
/**
* Modify the config values stored. Update the local data immediately,
* send the change to the server, and use the updated data from the server
@ -69,14 +67,14 @@ function($, utils) {
return data;
});
};
var ConfigWithDefaults = function(section, defaults, classname) {
this.section = section;
this.defaults = defaults;
this.classname = classname;
};
ConfigWithDefaults.prototype._class_data = function() {
if (this.classname) {
return this.section.data[this.classname] || {};
@ -84,7 +82,7 @@ function($, utils) {
return this.section.data
}
};
/**
* Wait for config to have loaded, then get a value or the default.
* Returns a promise.
@ -95,7 +93,7 @@ function($, utils) {
return this._class_data()[key] || this.defaults[key]
});
};
/**
* Return a config value. If config is not yet loaded, return the default
* instead of waiting for it to load.
@ -103,7 +101,7 @@ function($, utils) {
ConfigWithDefaults.prototype.get_sync = function(key) {
return this._class_data()[key] || this.defaults[key];
};
/**
* Set a config value. Send the update to the server, and change our
* local copy of the data immediately.
@ -121,9 +119,8 @@ function($, utils) {
return this.section.update(d);
}
};
return {ConfigSection: ConfigSection,
ConfigWithDefaults: ConfigWithDefaults,
};
});
module.exports = {
ConfigSection: ConfigSection,
ConfigWithDefaults: ConfigWithDefaults,
};

@ -1,7 +1,5 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(function(require) {
"use strict";
var $ = require('jquery');
@ -36,7 +34,7 @@ define(function(require) {
// directory.
this.message = 'A directory must be empty before being deleted.';
};
Contents.DirectoryNotEmptyError.prototype = Object.create(Error.prototype);
Contents.DirectoryNotEmptyError.prototype.name =
Contents.DIRECTORY_NOT_EMPTY_ERROR;
@ -173,7 +171,7 @@ define(function(require) {
var url = this.api_url(path);
return utils.promising_ajax(url, settings);
};
Contents.prototype.copy = function(from_file, to_dir) {
/**
* Copy a file into a given directory via POST
@ -252,5 +250,4 @@ define(function(require) {
return this.get(path, {type: 'directory'});
};
return {'Contents': Contents};
});
exports.Contents = Contents;

@ -1,16 +1,15 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
], function($, utils) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
//-----------------------------------------------------------------------
// CommManager class
//-----------------------------------------------------------------------
var CommManager = function (kernel) {
this.comms = {};
this.targets = {};
@ -18,7 +17,7 @@ define([
this.init_kernel(kernel);
}
};
CommManager.prototype.init_kernel = function (kernel) {
/**
* connect the kernel, and register message handlers
@ -30,7 +29,7 @@ define([
kernel.register_iopub_handler(msg_type, $.proxy(this[msg_type], this));
}
};
CommManager.prototype.new_comm = function (target_name, data, callbacks, metadata, comm_id) {
/**
* Create a new Comm, register it, and open its Kernel-side counterpart
@ -43,21 +42,21 @@ define([
comm.open(data, callbacks, metadata);
return comm;
};
CommManager.prototype.register_target = function (target_name, f) {
/**
* Register a target function for a given target name
*/
this.targets[target_name] = f;
};
CommManager.prototype.unregister_target = function (target_name, f) {
/**
* Unregister a target function for a given target name
*/
delete this.targets[target_name];
};
CommManager.prototype.register_comm = function (comm) {
/**
* Register a comm in the mapping
@ -66,16 +65,16 @@ define([
comm.kernel = this.kernel;
return comm.comm_id;
};
CommManager.prototype.unregister_comm = function (comm) {
/**
* Remove a comm from the mapping
*/
delete this.comms[comm.comm_id];
};
// comm message handlers
CommManager.prototype.comm_open = function (msg) {
var content = msg.content;
var that = this;
@ -100,7 +99,7 @@ define([
}, utils.reject('Could not open comm', true));
return this.comms[comm_id];
};
CommManager.prototype.comm_close = function(msg) {
var content = msg.content;
if (this.comms[content.comm_id] === undefined) {
@ -120,7 +119,7 @@ define([
});
return this.comms[content.comm_id];
};
CommManager.prototype.comm_msg = function(msg) {
var content = msg.content;
if (this.comms[content.comm_id] === undefined) {
@ -138,17 +137,17 @@ define([
});
return this.comms[content.comm_id];
};
//-----------------------------------------------------------------------
// Comm base class
//-----------------------------------------------------------------------
var Comm = function (target_name, comm_id) {
this.target_name = target_name;
this.comm_id = comm_id || utils.uuid();
this._msg_callback = this._close_callback = null;
};
// methods for sending messages
Comm.prototype.open = function (data, callbacks, metadata) {
var content = {
@ -158,7 +157,7 @@ define([
};
return this.kernel.send_shell_message("comm_open", content, callbacks, metadata);
};
Comm.prototype.send = function (data, callbacks, metadata, buffers) {
var content = {
comm_id : this.comm_id,
@ -166,7 +165,7 @@ define([
};
return this.kernel.send_shell_message("comm_msg", content, callbacks, metadata, buffers);
};
Comm.prototype.close = function (data, callbacks, metadata) {
var content = {
comm_id : this.comm_id,
@ -174,22 +173,22 @@ define([
};
return this.kernel.send_shell_message("comm_close", content, callbacks, metadata);
};
// methods for registering callbacks for incoming messages
Comm.prototype._register_callback = function (key, callback) {
this['_' + key + '_callback'] = callback;
};
Comm.prototype.on_msg = function (callback) {
this._register_callback('msg', callback);
};
Comm.prototype.on_close = function (callback) {
this._register_callback('close', callback);
};
// methods for handling incoming messages
Comm.prototype._callback = function (key, msg) {
var callback = this['_' + key + '_callback'];
if (callback) {
@ -200,17 +199,16 @@ define([
}
}
};
Comm.prototype.handle_msg = function (msg) {
this._callback('msg', msg);
};
Comm.prototype.handle_close = function (msg) {
this._callback('close', msg);
};
return {
module.exports = {
'CommManager': CommManager,
'Comm': Comm
};
});

@ -1,15 +1,13 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
'./comm',
'./serialize',
'base/js/events'
], function($, utils, comm, serialize, events) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var comm = require('./comm');
var serialize = require('./serialize');
var events = require('base/js/events');
/**
* A Kernel class to communicate with the Python kernel. This
* should generally not be constructed directly, but be created
@ -527,7 +525,7 @@ define([
}
this._schedule_reconnect();
};
Kernel.prototype._schedule_reconnect = function () {
/**
* function to call when kernel connection is lost
@ -545,7 +543,7 @@ define([
console.log("Failed to reconnect, giving up.");
}
};
Kernel.prototype.stop_channels = function () {
/**
* Close the websocket. After successful close, the value
@ -599,7 +597,7 @@ define([
*/
return (this.ws === null);
};
Kernel.prototype.send_shell_message = function (msg_type, content, callbacks, metadata, buffers) {
/**
* Send a message on the Kernel's shell channel
@ -806,7 +804,7 @@ define([
delete this._msg_callbacks[msg_id];
}
};
/**
* @function _finish_shell
*/
@ -832,7 +830,7 @@ define([
}
}
};
/**
* Set callbacks for a particular message.
* Callbacks should be a struct of the following form:
@ -856,7 +854,7 @@ define([
this.last_msg_callbacks = {};
}
};
Kernel.prototype._handle_ws_message = function (e) {
var that = this;
this._msg_queue = this._msg_queue.then(function() {
@ -880,7 +878,7 @@ define([
console.error("unrecognized message channel", msg.channel, msg);
}
};
Kernel.prototype._handle_shell_reply = function (reply) {
this.events.trigger('shell_reply.Kernel', {kernel: this, reply:reply});
var that = this;
@ -977,7 +975,7 @@ define([
this._kernel_dead();
}
};
/**
* Handle clear_output message
*
@ -1060,5 +1058,4 @@ define([
}
};
return {'Kernel': Kernel};
});
exports.Kernel = Kernel;

@ -1,11 +1,9 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'underscore',
], function (_) {
"use strict";
var _ = require('underscore');
var _deserialize_array_buffer = function (buf) {
var data = new DataView(buf);
// read the header: 1 + nbufs 32b integers
@ -29,7 +27,7 @@ define([
}
return msg;
};
var _deserialize_binary = function(data) {
/**
* deserialize the binary message format
@ -66,7 +64,7 @@ define([
return Promise.resolve(_deserialize_binary(data));
}
};
var _serialize_binary = function (msg) {
/**
* implement the binary serialization protocol
@ -109,7 +107,7 @@ define([
// return raw ArrayBuffer
return msg_buf.buffer;
};
var serialize = function (msg) {
if (msg.buffers && msg.buffers.length) {
return _serialize_binary(msg);
@ -117,10 +115,8 @@ define([
return JSON.stringify(msg);
}
};
var exports = {
module.exports = {
deserialize : deserialize,
serialize: serialize
};
return exports;
});

@ -1,13 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
'services/kernels/kernel',
], function($, utils, kernel) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var kernel = require('services/kernels/kernel');
/**
* Session object for accessing the session REST api. The session
* should be used to start kernels and then shut them down -- for
@ -311,11 +309,10 @@ define([
this.name = "SessionAlreadyStarting";
this.message = (message || "");
};
SessionAlreadyStarting.prototype = Error.prototype;
return {
module.exports = {
Session: Session,
SessionAlreadyStarting: SessionAlreadyStarting
};
});

@ -1,23 +1,15 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
require([
'jquery',
'termjs',
'base/js/utils',
'base/js/page',
'services/config',
'terminal/js/terminado',
'custom/custom',
], function(
$,
termjs,
utils,
page,
configmod,
terminado
){
"use strict";
var $ = require('jquery');
var termjs = require('termjs');
var utils = require('base/js/utils');
var page = require('base/js/page');
var configmod = require('services/config');
var terminado = require('terminal/js/terminado');
require('custom/custom');
page = new page.Page();
var common_config = new configmod.ConfigSection('common',
@ -33,7 +25,7 @@ require([
var ws_path = utils.get_body_data('wsPath');
var ws_url = location.protocol.replace('http', 'ws') + "//" + location.host
+ base_url + ws_path;
var header = $("#header")[0]
function calculate_size() {
var height = $(window).height() - header.offsetHeight;
@ -43,16 +35,16 @@ require([
console.log("resize to :", rows , 'rows by ', cols, 'columns');
return {rows: rows, cols: cols};
}
page.show_header();
var size = calculate_size();
var terminal = terminado.make_terminal($("#terminado-container")[0], size, ws_url);
page.show_site();
utils.load_extensions_from_config(common_config);
window.onresize = function() {
var geom = calculate_size();
terminal.term.resize(geom.cols, geom.rows);
@ -62,5 +54,3 @@ require([
// Expose terminal for fiddling with in the browser
window.terminal = terminal;
});

@ -1,6 +1,8 @@
define ([], function() {
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
"use strict";
function make_terminal(element, size, ws_url) {
exports.make_terminal = function(element, size, ws_url) {
var ws = new WebSocket(ws_url);
Terminal.brokenBold = true;
var term = new Terminal({
@ -36,6 +38,3 @@ define ([], function() {
};
return {socket: ws, term: term};
}
return {make_terminal: make_terminal};
});

@ -1,13 +1,11 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'base/js/namespace',
'jquery',
'tree/js/notebooklist',
], function(IPython, $, notebooklist) {
"use strict";
var IPython = require('base/js/namespace');
var $ = require('jquery');
var notebooklist = require('tree/js/notebooklist');
var KernelList = function (selector, options) {
/**
* Constructor
@ -32,7 +30,7 @@ define([
* do nothing
*/
};
KernelList.prototype.sessions_loaded = function (d) {
this.sessions = d;
this.clear_list();
@ -68,9 +66,8 @@ define([
})
.appendTo(running_indicator);
};
// Backwards compatability.
IPython.KernelList = KernelList;
return {'KernelList': KernelList};
});
exports.KernelList = KernelList;

@ -1,46 +1,30 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
require([
'jquery',
'base/js/namespace',
'base/js/dialog',
'base/js/events',
'base/js/page',
'base/js/utils',
'services/config',
'contents',
'tree/js/notebooklist',
'tree/js/sessionlist',
'tree/js/kernellist',
'tree/js/terminallist',
'tree/js/newnotebook',
'auth/js/loginwidget',
// only loaded, not used:
'jqueryui',
'bootstrap',
'custom/custom',
], function(
$,
IPython,
dialog,
events,
page,
utils,
config,
contents_service,
notebooklist,
sesssionlist,
kernellist,
terminallist,
newnotebook,
loginwidget){
"use strict";
var $ = require('jquery');
var IPython = require('base/js/namespace');
var dialog = require('base/js/dialog');
var events = require('base/js/events');
var page = require('base/js/page');
var utils = require('base/js/utils');
var config = require('services/config');
var contents_service = require('contents');
var notebooklist = require('tree/js/notebooklist');
var sesssionlist = require('tree/js/sessionlist');
var kernellist = require('tree/js/kernellist');
var terminallist = require('tree/js/terminallist');
var newnotebook = require('tree/js/newnotebook');
var loginwidget = require('auth/js/loginwidget');
require('jqueryui');
require('bootstrap');
require('custom/custom');
IPython.NotebookList = notebooklist.NotebookList;
page = new page.Page();
var common_options = {
base_url: utils.get_body_data("baseUrl"),
notebook_path: utils.get_body_data("notebookPath"),
@ -65,7 +49,7 @@ require([
var kernel_list = new kernellist.KernelList('#running_list', $.extend({
session_list: session_list},
common_options));
var terminal_list;
if (utils.get_body_data("terminalsAvailable") === "True") {
terminal_list = new terminallist.TerminalList('#terminal_list', common_options);
@ -148,12 +132,12 @@ require([
events.trigger('app_initialized.DashboardApp');
utils.load_extensions_from_config(cfg);
utils.load_extensions_from_config(common_config);
// bound the upload method to the on change of the file select list
$("#alternate_upload").change(function (event){
notebook_list.handleFilesUpload(event,'form');
});
// set hash on tab click
$("#tabs").find("a").click(function(e) {
// Prevent the document from jumping when the active tab is changed to a
@ -169,9 +153,8 @@ require([
window.location.hash = hash;
}
});
// load tab if url hash
if (window.location.hash) {
$("#tabs").find("a[href=" + window.location.hash + "]").click();
}
});

@ -1,14 +1,12 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/namespace',
'base/js/utils',
'base/js/dialog',
], function ($, IPython, utils, dialog) {
"use strict";
var $ = require('jquery');
var IPython = require('base/js/namespace');
var utils = require('base/js/utils');
var dialog = require('base/js/dialog');
var NewNotebookWidget = function (selector, options) {
this.selector = selector;
this.base_url = options.base_url;
@ -22,20 +20,20 @@ define([
}
this.bind_events();
};
NewNotebookWidget.prototype.bind_events = function () {
var that = this;
this.element.find('#new_notebook').click(function () {
that.new_notebook();
});
};
NewNotebookWidget.prototype.request_kernelspecs = function () {
/** request and then load kernel specs */
var url = utils.url_join_encode(this.base_url, 'api/kernelspecs');
utils.promising_ajax(url).then($.proxy(this._load_kernelspecs, this));
};
NewNotebookWidget.prototype._load_kernelspecs = function (data) {
/** load kernelspec list */
var that = this;
@ -70,7 +68,7 @@ define([
menu.after(li);
}
};
NewNotebookWidget.prototype.new_notebook = function (kernel_name) {
/** create and open a new notebook */
var that = this;
@ -100,6 +98,5 @@ define([
});
});
};
return {'NewNotebookWidget': NewNotebookWidget};
});
exports.NewNotebookWidget = NewNotebookWidget;

@ -1,16 +1,14 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'base/js/namespace',
'jquery',
'base/js/utils',
'base/js/dialog',
'base/js/events',
'base/js/keyboard',
], function(IPython, $, utils, dialog, events, keyboard) {
"use strict";
var IPython = require('base/js/namespace');
var $ = require('jquery');
var utils = require('base/js/utils');
var dialog = require('base/js/dialog');
var events = require('base/js/events');
var keyboard = require('base/js/keyboard');
var NotebookList = function (selector, options) {
/**
* Constructor
@ -883,5 +881,4 @@ define([
.append(cancel_button);
};
return {'NotebookList': NotebookList};
});
exports.NotebookList = NotebookList;

@ -1,12 +1,10 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
], function($, utils) {
"use strict";
var $ = require('jquery');
var utils = require('base/js/utils');
var SesssionList = function (options) {
/**
* Constructor
@ -51,7 +49,7 @@ define([
});
});
};
SesssionList.prototype.load_sessions = function(){
var that = this;
var settings = {
@ -77,5 +75,4 @@ define([
this.events.trigger('sessions_loaded.Dashboard', this.sessions);
};
return {'SesssionList': SesssionList};
});
exports.SesssionList = SesssionList;

@ -1,14 +1,12 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'base/js/namespace',
'base/js/utils',
'jquery',
'tree/js/notebooklist',
], function(IPython, utils, $, notebooklist) {
"use strict";
var IPython = require('base/js/namespace');
var utils = require('base/js/utils');
var $ = require('jquery');
var notebooklist = require('tree/js/notebooklist');
var TerminalList = function (selector, options) {
/**
* Constructor
@ -62,7 +60,7 @@ define([
);
$.ajax(url, settings);
};
TerminalList.prototype.load_terminals = function() {
var url = utils.url_join_encode(this.base_url, 'api/terminals');
$.ajax(url, {
@ -86,7 +84,7 @@ define([
}
$('#terminal_list_header').toggle(data.length === 0);
};
TerminalList.prototype.add_link = function(name, item) {
item.data('term-name', name);
item.find(".item_name").text("terminals/" + name);
@ -96,7 +94,7 @@ define([
link.attr('target', IPython._target||'_blank');
this.add_shutdown_button(name, item);
};
TerminalList.prototype.add_shutdown_button = function(name, item) {
var that = this;
var shutdown_button = $("<button/>").text("Shutdown").addClass("btn btn-xs btn-warning").
@ -117,5 +115,4 @@ define([
item.find(".item_buttons").text("").append(shutdown_button);
};
return {TerminalList: TerminalList};
});
exports.TerminalList = TerminalList;

Loading…
Cancel
Save