mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Dynamically load contents, also browserify contents.
This commit is contained in:
parent
c180719fa8
commit
81a2998fe0
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,6 +32,7 @@ src
|
|||||||
notebook/static/auth/js/main.bundle.js
|
notebook/static/auth/js/main.bundle.js
|
||||||
notebook/static/edit/js/main.bundle.js
|
notebook/static/edit/js/main.bundle.js
|
||||||
notebook/static/notebook/js/main.bundle.js
|
notebook/static/notebook/js/main.bundle.js
|
||||||
|
notebook/static/services/contents.bundle.js
|
||||||
notebook/static/terminal/js/main.bundle.js
|
notebook/static/terminal/js/main.bundle.js
|
||||||
notebook/static/tree/js/main.bundle.js
|
notebook/static/tree/js/main.bundle.js
|
||||||
|
|
||||||
|
@ -172,8 +172,8 @@ class IPythonHandler(AuthenticatedHandler):
|
|||||||
@property
|
@property
|
||||||
def contents_js_source(self):
|
def contents_js_source(self):
|
||||||
self.log.debug("Using contents: %s", self.settings.get('contents_js_source',
|
self.log.debug("Using contents: %s", self.settings.get('contents_js_source',
|
||||||
'services/contents'))
|
'services/contents.bundle'))
|
||||||
return self.settings.get('contents_js_source', 'services/contents')
|
return self.settings.get('contents_js_source', 'services/contents.bundle')
|
||||||
|
|
||||||
#---------------------------------------------------------------
|
#---------------------------------------------------------------
|
||||||
# Manager objects
|
# Manager objects
|
||||||
|
@ -26,6 +26,5 @@ var b = browserify({
|
|||||||
});
|
});
|
||||||
|
|
||||||
b.transform(aliasify, aliasifyConfig);
|
b.transform(aliasify, aliasifyConfig);
|
||||||
b.exclude('contents');
|
|
||||||
b.add(__dirname + '/static/' + process.argv[2]);
|
b.add(__dirname + '/static/' + process.argv[2]);
|
||||||
b.bundle().pipe(fs.createWriteStream(__dirname + '/static/' + process.argv[3]));
|
b.bundle().pipe(fs.createWriteStream(__dirname + '/static/' + process.argv[3]));
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
var load_extension = function (extension) {
|
var load_extension = function (extension) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
require(["nbextensions/" + extension], function(module) {
|
requirejs(["nbextensions/" + extension], function(module) {
|
||||||
console.log("Loaded extension: " + extension);
|
console.log("Loaded extension: " + extension);
|
||||||
try {
|
try {
|
||||||
module.load_ipython_extension();
|
module.load_ipython_extension();
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
// Copyright (c) Jupyter Development Team.
|
// Copyright (c) Jupyter Development Team.
|
||||||
// Distributed under the terms of the Modified BSD License.
|
// Distributed under the terms of the Modified BSD License.
|
||||||
|
"use strict";
|
||||||
"use strict";
|
|
||||||
|
// Contents must be loaded at runtime.
|
||||||
|
requirejs(['contents'], function(contents_service) {
|
||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
var IPython = require('base/js/namespace');
|
var IPython = require('base/js/namespace');
|
||||||
var utils = require('base/js/utils');
|
var utils = require('base/js/utils');
|
||||||
var page = require('base/js/page');
|
var page = require('base/js/page');
|
||||||
var events = require('base/js/events');
|
var events = require('base/js/events');
|
||||||
var contents = require('contents');
|
|
||||||
var configmod = require('services/config');
|
var configmod = require('services/config');
|
||||||
var editmod = require('edit/js/editor');
|
var editmod = require('edit/js/editor');
|
||||||
var menubar = require('edit/js/menubar');
|
var menubar = require('edit/js/menubar');
|
||||||
@ -81,3 +82,4 @@
|
|||||||
|
|
||||||
// On document ready, resize codemirror.
|
// On document ready, resize codemirror.
|
||||||
$(document).ready(_handle_resize);
|
$(document).ready(_handle_resize);
|
||||||
|
});
|
||||||
|
@ -1,58 +1,12 @@
|
|||||||
// Copyright (c) Jupyter Development Team.
|
// Copyright (c) Jupyter Development Team.
|
||||||
// Distributed under the terms of the Modified BSD License.
|
// Distributed under the terms of the Modified BSD License.
|
||||||
|
"use strict";
|
||||||
|
|
||||||
require([
|
// Contents must be loaded at runtime.
|
||||||
'base/js/namespace',
|
requirejs(['contents'], function(contents_service) {
|
||||||
'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',
|
|
||||||
'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',
|
|
||||||
'notebook/js/searchandreplace',
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var IPython = require('base/js/namespace');
|
var IPython = require('base/js/namespace');
|
||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
var notebook = require('notebook/js/notebook');
|
var notebook = require('notebook/js/notebook');
|
||||||
var contents = require('contents');
|
|
||||||
var configmod = require('services/config');
|
var configmod = require('services/config');
|
||||||
var utils = require('base/js/utils');
|
var utils = require('base/js/utils');
|
||||||
var page = require('base/js/page');
|
var page = require('base/js/page');
|
||||||
@ -187,3 +141,4 @@ require([
|
|||||||
utils.load_extensions_from_config(config_section);
|
utils.load_extensions_from_config(config_section);
|
||||||
utils.load_extensions_from_config(common_config);
|
utils.load_extensions_from_config(common_config);
|
||||||
notebook.load_notebook(common_options.notebook_path);
|
notebook.load_notebook(common_options.notebook_path);
|
||||||
|
});
|
||||||
|
@ -251,3 +251,5 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.Contents = Contents;
|
exports.Contents = Contents;
|
||||||
|
|
||||||
|
window.define([], function() { return {Contents: Contents}; })
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
// Copyright (c) Jupyter Development Team.
|
// Copyright (c) Jupyter Development Team.
|
||||||
// Distributed under the terms of the Modified BSD License.
|
// Distributed under the terms of the Modified BSD License.
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
// Contents must be loaded at runtime.
|
||||||
|
requirejs(['contents'], function(contents_service) {
|
||||||
|
|
||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
var IPython = require('base/js/namespace');
|
var IPython = require('base/js/namespace');
|
||||||
@ -9,7 +12,6 @@
|
|||||||
var page = require('base/js/page');
|
var page = require('base/js/page');
|
||||||
var utils = require('base/js/utils');
|
var utils = require('base/js/utils');
|
||||||
var config = require('services/config');
|
var config = require('services/config');
|
||||||
var contents_service = require('contents');
|
|
||||||
var notebooklist = require('tree/js/notebooklist');
|
var notebooklist = require('tree/js/notebooklist');
|
||||||
var sesssionlist = require('tree/js/sessionlist');
|
var sesssionlist = require('tree/js/sessionlist');
|
||||||
var kernellist = require('tree/js/kernellist');
|
var kernellist = require('tree/js/kernellist');
|
||||||
@ -20,7 +22,7 @@
|
|||||||
require('jqueryui');
|
require('jqueryui');
|
||||||
require('bootstrap');
|
require('bootstrap');
|
||||||
require('custom/custom');
|
require('custom/custom');
|
||||||
|
|
||||||
IPython.NotebookList = notebooklist.NotebookList;
|
IPython.NotebookList = notebooklist.NotebookList;
|
||||||
|
|
||||||
page = new page.Page();
|
page = new page.Page();
|
||||||
@ -158,3 +160,4 @@
|
|||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
$("#tabs").find("a[href=" + window.location.hash + "]").click();
|
$("#tabs").find("a[href=" + window.location.hash + "]").click();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
"build:css": "concurrent \"npm run build:css:ipython\" \"npm run build:css:style\"",
|
"build:css": "concurrent \"npm run build:css:ipython\" \"npm run build:css:style\"",
|
||||||
"build:css:ipython": "lessc --source-map --include-path=./notebook/static/ ./notebook/static/style/ipython.less ./notebook/static/style/ipython.min.css",
|
"build:css:ipython": "lessc --source-map --include-path=./notebook/static/ ./notebook/static/style/ipython.less ./notebook/static/style/ipython.min.css",
|
||||||
"build:css:style": "lessc --source-map --include-path=./notebook/static/ ./notebook/static/style/style.less ./notebook/static/style/style.min.css",
|
"build:css:style": "lessc --source-map --include-path=./notebook/static/ ./notebook/static/style/style.less ./notebook/static/style/style.min.css",
|
||||||
"build:js": "concurrent \"npm run build:js:tree\" \"npm run build:js:terminal\" \"npm run build:js:notebook\" \"npm run build:js:edit\" \"npm run build:js:auth\"",
|
"build:js": "concurrent \"npm run build:js:tree\" \"npm run build:js:terminal\" \"npm run build:js:notebook\" \"npm run build:js:edit\" \"npm run build:js:auth\" \"npm run build:js:contents\"",
|
||||||
"build:js:notebook": "node ./notebook/build.js notebook/js/main.js notebook/js/main.bundle.js",
|
"build:js:notebook": "node ./notebook/build.js notebook/js/main.js notebook/js/main.bundle.js",
|
||||||
|
"build:js:contents": "node ./notebook/build.js services/contents.js services/contents.bundle.js",
|
||||||
"build:js:edit": "node ./notebook/build.js edit/js/main.js edit/js/main.bundle.js",
|
"build:js:edit": "node ./notebook/build.js edit/js/main.js edit/js/main.bundle.js",
|
||||||
"build:js:tree": "node ./notebook/build.js tree/js/main.js tree/js/main.bundle.js",
|
"build:js:tree": "node ./notebook/build.js tree/js/main.js tree/js/main.bundle.js",
|
||||||
"build:js:auth": "node ./notebook/build.js auth/js/main.js auth/js/main.bundle.js",
|
"build:js:auth": "node ./notebook/build.js auth/js/main.js auth/js/main.bundle.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user