diff --git a/notebook/static/auth/js/loginmain.js b/notebook/static/auth/js/loginmain.js
index 1e312ee69..49372a2ca 100644
--- a/notebook/static/auth/js/loginmain.js
+++ b/notebook/static/auth/js/loginmain.js
@@ -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;
+ };
diff --git a/notebook/static/auth/js/loginwidget.js b/notebook/static/auth/js/loginwidget.js
index 00d154dde..093af451e 100644
--- a/notebook/static/auth/js/loginwidget.js
+++ b/notebook/static/auth/js/loginwidget.js
@@ -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;
diff --git a/notebook/static/auth/js/logoutmain.js b/notebook/static/auth/js/logoutmain.js
index 7b3f6b4da..cbc3a5d8a 100644
--- a/notebook/static/auth/js/logoutmain.js
+++ b/notebook/static/auth/js/logoutmain.js
@@ -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;
-});
+ };
diff --git a/notebook/static/auth/js/main.js b/notebook/static/auth/js/main.js
index 7be82388e..2bb07023f 100644
--- a/notebook/static/auth/js/main.js
+++ b/notebook/static/auth/js/main.js
@@ -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');
diff --git a/notebook/static/base/js/dialog.js b/notebook/static/base/js/dialog.js
index d07315429..164a7540a 100644
--- a/notebook/static/base/js/dialog.js
+++ b/notebook/static/base/js/dialog.js
@@ -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;
-});
diff --git a/notebook/static/base/js/events.js b/notebook/static/base/js/events.js
index 4cab05db2..5d20a16c9 100644
--- a/notebook/static/base/js/events.js
+++ b/notebook/static/base/js/events.js
@@ -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]);
diff --git a/notebook/static/base/js/keyboard.js b/notebook/static/base/js/keyboard.js
index bc6a33d90..b8adf90f6 100644
--- a/notebook/static/base/js/keyboard.js
+++ b/notebook/static/base/js/keyboard.js
@@ -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;
-});
diff --git a/notebook/static/base/js/namespace.js b/notebook/static/base/js/namespace.js
index 38056dbe1..e4604a063 100644
--- a/notebook/static/base/js/namespace.js
+++ b/notebook/static/base/js/namespace.js
@@ -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;
diff --git a/notebook/static/base/js/notificationarea.js b/notebook/static/base/js/notificationarea.js
index 94b764998..c69fa3b82 100644
--- a/notebook/static/base/js/notificationarea.js
+++ b/notebook/static/base/js/notificationarea.js
@@ -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;
diff --git a/notebook/static/base/js/notificationwidget.js b/notebook/static/base/js/notificationwidget.js
index 660143743..8c42462b4 100644
--- a/notebook/static/base/js/notificationwidget.js
+++ b/notebook/static/base/js/notificationwidget.js
@@ -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;
diff --git a/notebook/static/base/js/page.js b/notebook/static/base/js/page.js
index 9ec72786f..df3ef1794 100644
--- a/notebook/static/base/js/page.js
+++ b/notebook/static/base/js/page.js
@@ -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;
diff --git a/notebook/static/base/js/security.js b/notebook/static/base/js/security.js
index 71130fc4b..68e10c3f2 100644
--- a/notebook/static/base/js/security.js
+++ b/notebook/static/base/js/security.js
@@ -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;
-});
diff --git a/notebook/static/base/js/utils.js b/notebook/static/base/js/utils.js
index fc3da3edf..67a090403 100644
--- a/notebook/static/base/js/utils.js
+++ b/notebook/static/base/js/utils.js
@@ -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;
-});
diff --git a/notebook/static/edit/js/editor.js b/notebook/static/edit/js/editor.js
index ddbc2ded2..e65af3441 100644
--- a/notebook/static/edit/js/editor.js
+++ b/notebook/static/edit/js/editor.js
@@ -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;
diff --git a/notebook/static/edit/js/main.js b/notebook/static/edit/js/main.js
index 3b8ea77a6..8ff17620a 100644
--- a/notebook/static/edit/js/main.js
+++ b/notebook/static/edit/js/main.js
@@ -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);
-});
diff --git a/notebook/static/edit/js/menubar.js b/notebook/static/edit/js/menubar.js
index fbf7e8043..20af744fa 100644
--- a/notebook/static/edit/js/menubar.js
+++ b/notebook/static/edit/js/menubar.js
@@ -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;
diff --git a/notebook/static/edit/js/notificationarea.js b/notebook/static/edit/js/notificationarea.js
index 73f7077d5..935ff9b09 100644
--- a/notebook/static/edit/js/notificationarea.js
+++ b/notebook/static/edit/js/notificationarea.js
@@ -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;
diff --git a/notebook/static/edit/js/savewidget.js b/notebook/static/edit/js/savewidget.js
index d3ce9aaad..eb3da2cf2 100644
--- a/notebook/static/edit/js/savewidget.js
+++ b/notebook/static/edit/js/savewidget.js
@@ -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;
diff --git a/notebook/static/notebook/js/about.js b/notebook/static/notebook/js/about.js
index 50ef7ad3d..6cbbb1f48 100644
--- a/notebook/static/notebook/js/about.js
+++ b/notebook/static/notebook/js/about.js
@@ -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.
';
@@ -35,4 +35,3 @@ require([
kinfo.html($('
').text('unable to contact kernel'));
}
});
-});
diff --git a/notebook/static/notebook/js/actions.js b/notebook/static/notebook/js/actions.js
index a6a3eb1ed..5800c6963 100644
--- a/notebook/static/notebook/js/actions.js
+++ b/notebook/static/notebook/js/actions.js
@@ -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;
diff --git a/notebook/static/notebook/js/cell.js b/notebook/static/notebook/js/cell.js
index a2f1a6e7f..6a46b141a 100644
--- a/notebook/static/notebook/js/cell.js
+++ b/notebook/static/notebook/js/cell.js
@@ -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 = $("").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
};
-});
diff --git a/notebook/static/notebook/js/celltoolbar.js b/notebook/static/notebook/js/celltoolbar.js
index 654bcc0e0..76d6736fa 100644
--- a/notebook/static/notebook/js/celltoolbar.js
+++ b/notebook/static/notebook/js/celltoolbar.js
@@ -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;
diff --git a/notebook/static/notebook/js/celltoolbarpresets/default.js b/notebook/static/notebook/js/celltoolbarpresets/default.js
index fe457f6c9..d1c181c8f 100644
--- a/notebook/static/notebook/js/celltoolbarpresets/default.js
+++ b/notebook/static/notebook/js/celltoolbarpresets/default.js
@@ -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;
diff --git a/notebook/static/notebook/js/celltoolbarpresets/example.js b/notebook/static/notebook/js/celltoolbarpresets/example.js
index 0e631706e..b9550cfc6 100644
--- a/notebook/static/notebook/js/celltoolbarpresets/example.js
+++ b/notebook/static/notebook/js/celltoolbarpresets/example.js
@@ -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 = $('
').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;
diff --git a/notebook/static/notebook/js/celltoolbarpresets/rawcell.js b/notebook/static/notebook/js/celltoolbarpresets/rawcell.js
index f3e23453e..0c03782b2 100644
--- a/notebook/static/notebook/js/celltoolbarpresets/rawcell.js
+++ b/notebook/static/notebook/js/celltoolbarpresets/rawcell.js
@@ -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;
diff --git a/notebook/static/notebook/js/celltoolbarpresets/slideshow.js b/notebook/static/notebook/js/celltoolbarpresets/slideshow.js
index 50dc96db2..3272cc763 100644
--- a/notebook/static/notebook/js/celltoolbarpresets/slideshow.js
+++ b/notebook/static/notebook/js/celltoolbarpresets/slideshow.js
@@ -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;
diff --git a/notebook/static/notebook/js/codecell.js b/notebook/static/notebook/js/codecell.js
index 6f5ebc19b..20ae3dd6c 100644
--- a/notebook/static/notebook/js/codecell.js
+++ b/notebook/static/notebook/js/codecell.js
@@ -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;
diff --git a/notebook/static/notebook/js/completer.js b/notebook/static/notebook/js/completer.js
index 47d5bef7b..146962b65 100644
--- a/notebook/static/notebook/js/completer.js
+++ b/notebook/static/notebook/js/completer.js
@@ -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;
diff --git a/notebook/static/notebook/js/contexthint.js b/notebook/static/notebook/js/contexthint.js
index 22fdbcd8f..5603f1546 100644
--- a/notebook/static/notebook/js/contexthint.js
+++ b/notebook/static/notebook/js/contexthint.js
@@ -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;
diff --git a/notebook/static/notebook/js/kernelselector.js b/notebook/static/notebook/js/kernelselector.js
index 40b6b0f3d..a2d3fe2c9 100644
--- a/notebook/static/notebook/js/kernelselector.js
+++ b/notebook/static/notebook/js/kernelselector.js
@@ -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 = $("