diff --git a/notebook/build.js b/notebook/build.js index f958bd91d..70350ab0d 100644 --- a/notebook/build.js +++ b/notebook/build.js @@ -4,16 +4,6 @@ var browserify = require('browserify'); var aliasifyConfig = { aliases: { - // underscore : 'components/underscore/underscore-min', - // backbone : 'components/backbone/backbone-min', - // jquery: 'components/jquery/jquery.min', - bootstrap: 'components/bootstrap/js/bootstrap.min', - bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min', - // jqueryui: 'components/jquery-ui/ui/minified/jquery-ui.min', - // moment: 'components/moment/moment', - // codemirror: 'components/codemirror', - // termjs: 'components/term.js/src/term' - jqueryui: 'jquery-ui', termjs: 'term.js' }, diff --git a/notebook/static-src/base/js/namespace.js b/notebook/static-src/base/js/namespace.js index e4604a063..37a4a84fa 100644 --- a/notebook/static-src/base/js/namespace.js +++ b/notebook/static-src/base/js/namespace.js @@ -3,34 +3,42 @@ "use strict"; - var Jupyter = Jupyter || {}; + var Jupyter = window.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 jprop = function(name, module_path) { + requirejs([module_path], function(loaded) { + if (!Jupyter.hasOwnProperty(name)) { + Object.defineProperty(Jupyter, name, { + get: function() { + console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'")`'); + return loaded; + }, + 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 + requirejs([module_path], function(loaded) { + if (!Jupyter.hasOwnProperty(name)) { + Object.defineProperty(Jupyter, name, { + get: function() { + console.warn('accessing `'+name+'` is deprecated. Use `require("'+module_path+'").'+name+'`'); + return loaded[name]; + }, + enumerable: true, + configurable: false + }); + } }); } // expose modules - jprop('utils','base/js/utils') + jprop('utils','base/js/utils'); //Jupyter.load_extensions = Jupyter.utils.load_extensions; // @@ -41,8 +49,8 @@ //// exposed constructors - jglobal('CommManager','services/kernels/comm') - jglobal('Comm','services/kernels/comm') + jglobal('CommManager','services/kernels/comm'); + jglobal('Comm','services/kernels/comm'); jglobal('NotificationWidget','base/js/notificationwidget'); jglobal('Kernel','services/kernels/kernel'); @@ -76,6 +84,7 @@ Jupyter._target = '_blank'; module.exports = Jupyter; - + window.Jupyter = Jupyter; + // deprecated since 4.0, remove in 5+ window.IPython = Jupyter; diff --git a/notebook/static-src/base/js/security.js b/notebook/static-src/base/js/security.js index 68e10c3f2..d1cb3f81d 100644 --- a/notebook/static-src/base/js/security.js +++ b/notebook/static-src/base/js/security.js @@ -4,7 +4,7 @@ "use strict"; var $ = require('jquery'); - var sanitize = require('components/google-caja/html-css-sanitizer-minified'); + var sanitize = require('sanitizer'); var noop = function (x) { return x; }; diff --git a/notebook/static-src/edit/js/main.js b/notebook/static-src/edit/js/main.js index 934f440b1..d3af4cfd0 100644 --- a/notebook/static-src/edit/js/main.js +++ b/notebook/static-src/edit/js/main.js @@ -16,7 +16,7 @@ requirejs(['contents', 'bootstrap'], function(contents_service) { var menubar = require('edit/js/menubar'); var savewidget = require('edit/js/savewidget'); var notificationarea = require('edit/js/notificationarea'); - require('custom/custom'); + requirejs(['custom/custom'], function() {}); page = new page.Page(); diff --git a/notebook/static-src/edit/js/menubar.js b/notebook/static-src/edit/js/menubar.js index 20af744fa..43ab8474b 100644 --- a/notebook/static-src/edit/js/menubar.js +++ b/notebook/static-src/edit/js/menubar.js @@ -8,7 +8,7 @@ var dialog = require('base/js/dialog'); var CodeMirror = require('codemirror/lib/codemirror'); require('codemirror/mode/meta'); - require('bootstrap'); + requirejs(['bootstrap'], function() {}); var MenuBar = function (selector, options) { /** diff --git a/notebook/static-src/notebook/js/main.js b/notebook/static-src/notebook/js/main.js index 534b7fc3d..8aa997fe1 100644 --- a/notebook/static-src/notebook/js/main.js +++ b/notebook/static-src/notebook/js/main.js @@ -28,13 +28,7 @@ requirejs(['contents', 'jquery'], function(contents_service) { 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 () { - console.warn('ipywidgets package not installed. Widgets are not available.'); - }); - // END HARDCODED WIDGETS HACK + requirejs(['custom/custom'], function() {}); // compat with old IPython, remove for IPython > 3.0 window.CodeMirror = CodeMirror; @@ -139,6 +133,12 @@ requirejs(['contents', 'jquery'], function(contents_service) { IPython.save_widget = save_widget; IPython.tooltip = notebook.tooltip; + // BEGIN HARDCODED WIDGETS HACK + utils.load_extension('widgets/notebook/js/extension').catch(function (err) { + console.warn('ipywidgets package not loaded. Widgets are not available. (Maybe they aren\'t installed)', err); + }); + // END HARDCODED WIDGETS HACK + events.trigger('app_initialized.NotebookApp'); utils.load_extensions_from_config(config_section); utils.load_extensions_from_config(common_config); diff --git a/notebook/static-src/notebook/js/menubar.js b/notebook/static-src/notebook/js/menubar.js index 8ead382fd..819fe689c 100644 --- a/notebook/static-src/notebook/js/menubar.js +++ b/notebook/static-src/notebook/js/menubar.js @@ -7,8 +7,8 @@ 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'); + requirejs(['bootstrap'], function() {}); var MenuBar = function (selector, options) { /** diff --git a/notebook/static-src/notebook/js/notebook.js b/notebook/static-src/notebook/js/notebook.js index 7a3ba36a3..235a708b0 100644 --- a/notebook/static-src/notebook/js/notebook.js +++ b/notebook/static-src/notebook/js/notebook.js @@ -17,7 +17,7 @@ var configmod = require('services/config'); var session = require('services/sessions/session'); var celltoolbar = require('notebook/js/celltoolbar'); - var marked = require('components/marked/lib/marked'); + var marked = require('marked'); var CodeMirror = require('codemirror/lib/codemirror'); var runMode = require('codemirror/addon/runmode/runmode'); var mathjaxutils = require('notebook/js/mathjaxutils'); diff --git a/notebook/static-src/notebook/js/outputarea.js b/notebook/static-src/notebook/js/outputarea.js index 0d0256876..915b90093 100644 --- a/notebook/static-src/notebook/js/outputarea.js +++ b/notebook/static-src/notebook/js/outputarea.js @@ -8,7 +8,7 @@ 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'); + var marked = require('marked'); /** * @class OutputArea diff --git a/notebook/static-src/notebook/js/textcell.js b/notebook/static-src/notebook/js/textcell.js index 4c2a904c4..19ece9b27 100644 --- a/notebook/static-src/notebook/js/textcell.js +++ b/notebook/static-src/notebook/js/textcell.js @@ -9,7 +9,7 @@ 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 marked = require('marked'); var CodeMirror = require('codemirror/lib/codemirror'); var gfm = require('codemirror/mode/gfm/gfm'); var ipgfm = require('notebook/js/codemirror-ipythongfm'); diff --git a/notebook/static-src/notebook/js/tour.js b/notebook/static-src/notebook/js/tour.js index 7b4fc223f..b2c823a92 100644 --- a/notebook/static-src/notebook/js/tour.js +++ b/notebook/static-src/notebook/js/tour.js @@ -3,7 +3,7 @@ "use strict"; var $ = require('jquery'); - var Tour = require('bootstraptour'); + var tour_style = "