mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-09 03:50:45 +08:00
Almost working 100%
This commit is contained in:
parent
a719e19b39
commit
6258f542dd
@ -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'
|
||||
},
|
||||
|
@ -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;
|
||||
|
@ -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; };
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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) {
|
||||
/**
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
/**
|
||||
|
@ -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');
|
||||
|
@ -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
|
||||
|
@ -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');
|
||||
|
@ -3,7 +3,7 @@
|
||||
"use strict";
|
||||
|
||||
var $ = require('jquery');
|
||||
var Tour = require('bootstraptour');
|
||||
|
||||
|
||||
var tour_style = "<div class='popover tour'>\n" +
|
||||
"<div class='arrow'></div>\n" +
|
||||
@ -114,21 +114,24 @@
|
||||
}
|
||||
];
|
||||
|
||||
this.tour = new Tour({
|
||||
storage: false, // start tour from beginning every time
|
||||
debug: true,
|
||||
reflex: true, // click on element to continue tour
|
||||
animation: false,
|
||||
duration: this.step_duration,
|
||||
onStart: function() { console.log('tour started'); },
|
||||
// TODO: remove the onPause/onResume logic once pi's patch has been
|
||||
// merged upstream to make this work via data-resume-class and
|
||||
// data-resume-text attributes.
|
||||
onPause: this.toggle_pause_play,
|
||||
onResume: this.toggle_pause_play,
|
||||
steps: this.tour_steps,
|
||||
template: tour_style,
|
||||
orphan: true
|
||||
var that = this;
|
||||
requirejs(['bootstraptour'], function(Tour) {
|
||||
that.tour = new Tour({
|
||||
storage: false, // start tour from beginning every time
|
||||
debug: true,
|
||||
reflex: true, // click on element to continue tour
|
||||
animation: false,
|
||||
duration: that.step_duration,
|
||||
onStart: function() { console.log('tour started'); },
|
||||
// TODO: remove the onPause/onResume logic once pi's patch has been
|
||||
// merged upstream to make this work via data-resume-class and
|
||||
// data-resume-text attributes.
|
||||
onPause: that.toggle_pause_play,
|
||||
onResume: that.toggle_pause_play,
|
||||
steps: that.tour_steps,
|
||||
template: tour_style,
|
||||
orphan: true
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
@ -157,3 +160,4 @@
|
||||
};
|
||||
|
||||
exports.Tour = NotebookTour;
|
||||
|
@ -7,7 +7,7 @@
|
||||
var page = require('base/js/page');
|
||||
var configmod = require('services/config');
|
||||
var terminado = require('terminal/js/terminado');
|
||||
require('custom/custom');
|
||||
requirejs(['custom/custom'], function() {});
|
||||
|
||||
page = new page.Page();
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
// Contents must be loaded at runtime.
|
||||
// jQuery must also be loaded at runtime and available globally
|
||||
// in order for bootstrap to work...
|
||||
requirejs(['contents', 'jquery'], function(contents_service) {
|
||||
requirejs(['contents', 'jquery', 'bootstrap'], function(contents_service) {
|
||||
|
||||
var $ = require('jquery');
|
||||
var IPython = require('base/js/namespace');
|
||||
@ -22,8 +22,7 @@ requirejs(['contents', 'jquery'], function(contents_service) {
|
||||
var loginwidget = require('auth/js/loginwidget');
|
||||
|
||||
require('jqueryui');
|
||||
require('bootstrap');
|
||||
require('custom/custom');
|
||||
requirejs(['custom/custom'], function() {});
|
||||
|
||||
IPython.NotebookList = notebooklist.NotebookList;
|
||||
|
||||
|
@ -38,6 +38,8 @@
|
||||
moment: 'components/moment/moment',
|
||||
codemirror: 'components/codemirror',
|
||||
termjs: 'components/term.js/src/term',
|
||||
marked: 'components/marked/marked.min',
|
||||
sanitizer: 'components/google-caja/caja-minified'
|
||||
},
|
||||
shim: {
|
||||
underscore: {
|
||||
|
@ -42,6 +42,7 @@
|
||||
"mkdirp": "^0.5.1",
|
||||
"moment": "~2.8.4",
|
||||
"rimraf": "^2.4.2",
|
||||
"sanitizer": "^0.1.2",
|
||||
"term.js": "~0.0.4",
|
||||
"text-encoding": "~0.1",
|
||||
"underscore": "~1.5"
|
||||
|
Loading…
Reference in New Issue
Block a user