##// END OF EJS Templates
Merge pull request #8429 from Carreau/backport-notebook-89...
Merge pull request #8429 from Carreau/backport-notebook-89 Backport jupyter/notebook#89

File last commit:

r20425:c45162aa
r21379:78b7cfd9 merge
Show More
main.js
160 lines | 5.1 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192 // Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
Brian E. Granger
Splitting notebook.js into muliple files for development ease.
r4349
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192 require([
'base/js/namespace',
Jonathan Frederic
MWE,...
r17200 'jquery',
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192 'notebook/js/notebook',
Jeff Hemmelgarn
Move contentmanager to contents
r18643 'contents',
Thomas Kluyver
Load nbextensions from config
r19081 'services/config',
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192 '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',
Jonathan Frederic
Almost done!...
r17198 'notebook/js/savewidget',
Matthias Bussonnier
Add notion of action that differs from shortcuts....
r18390 'notebook/js/actions',
Jonathan Frederic
Pager
r17197 'notebook/js/keyboardmanager',
Thomas Kluyver
Allow switching kernel from the notebook UI
r17370 'notebook/js/kernelselector',
Matthias BUSSONNIER
Update to codemirror 4...
r18280 'codemirror/lib/codemirror',
Matthias Bussonnier
Add about dialog in Notebook Help Menu....
r18359 'notebook/js/about',
Matthias BUSSONNIER
Update to codemirror 4...
r18280 // only loaded, not used, please keep sure this is loaded last
'custom/custom'
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192 ], function(
IPython,
Jonathan Frederic
Progress...
r17196 $,
Jonathan Frederic
Fix all the bugs!
r17203 notebook,
Jeff Hemmelgarn
Move contentmanager to contents
r18643 contents,
Thomas Kluyver
Load nbextensions from config
r19081 configmod,
Jonathan Frederic
Almost done!...
r17198 utils,
Jonathan Frederic
Fix all the bugs!
r17203 page,
events,
loginwidget,
maintoolbar,
pager,
quickhelp,
menubar,
notificationarea,
Matthias Bussonnier
Add notion of action that differs from shortcuts....
r18390 savewidget,
actions,
Jonathan Frederic
Fix all the bugs!
r17203 keyboardmanager,
Matthias BUSSONNIER
Update to codemirror 4...
r18280 kernelselector,
CodeMirror,
Matthias Bussonnier
Add about dialog in Notebook Help Menu....
r18359 about,
Matthias BUSSONNIER
Update to codemirror 4...
r18280 // please keep sure that even if not used, this is loaded last
custom
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192 ) {
MinRK
various unicode fixes...
r15234 "use strict";
Matthias BUSSONNIER
Inject requirejs in notebook and start using it.
r10758
Matthias Bussonnier
cleanup style fixed in separate PR and few other things
r18290 // compat with old IPython, remove for IPython > 3.0
Matthias BUSSONNIER
Update to codemirror 4...
r18280 window.CodeMirror = CodeMirror;
jon
In person review with @ellisonbg
r17210 var common_options = {
Matthias Bussonnier
cleanup style fixed in separate PR and few other things
r18290 ws_url : utils.get_body_data("wsUrl"),
Jonathan Frederic
Almost done!...
r17198 base_url : utils.get_body_data("baseUrl"),
notebook_path : utils.get_body_data("notebookPath"),
notebook_name : utils.get_body_data('notebookName')
MinRK
various unicode fixes...
r15234 };
Matthias BUSSONNIER
pass baseUrl as option
r9505
Bussonnier Matthias
pass config to contentsManager
r19583 var config_section = new configmod.ConfigSection('notebook', common_options);
config_section.load();
Thomas Kluyver
Load common_config, and load extensions specified therein
r19633 var common_config = new configmod.ConfigSection('common', common_options);
common_config.load();
Jonathan Frederic
Fix imports of "modules",...
r17202 var page = new page.Page();
Jonathan Frederic
Kill the layout manager
r19179 var pager = new pager.Pager('div#pager', {
jon
In person review with @ellisonbg
r17210 events: events});
Matthias Bussonnier
Add notion of action that differs from shortcuts....
r18390 var acts = new actions.init();
jon
In person review with @ellisonbg
r17210 var keyboard_manager = new keyboardmanager.KeyboardManager({
pager: pager,
Matthias Bussonnier
Add notion of action that differs from shortcuts....
r18390 events: events,
actions: acts });
Jonathan Frederic
Fix some dialog keyboard_manager problems
r17213 var save_widget = new savewidget.SaveWidget('span#save_widget', {
events: events,
keyboard_manager: keyboard_manager});
Matthias Bussonnier
Pass common_config to content manager.
r20425 var contents = new contents.Contents({
base_url: common_options.base_url,
common_config: common_config
});
jon
In person review with @ellisonbg
r17210 var notebook = new notebook.Notebook('div#notebook', $.extend({
events: events,
keyboard_manager: keyboard_manager,
save_widget: save_widget,
Jeff Hemmelgarn
Move contentmanager to contents
r18643 contents: contents,
Thomas Kluyver
Remove user_config js module
r19529 config: config_section},
jon
In person review with @ellisonbg
r17210 common_options));
var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options);
var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', {
notebook: notebook,
Matthias Bussonnier
Add notion of action that differs from shortcuts....
r18390 events: events,
actions: acts});
jon
In person review with @ellisonbg
r17210 var quick_help = new quickhelp.QuickHelp({
keyboard_manager: keyboard_manager,
Jonathan Frederic
Some JS test fixes
r17212 events: events,
notebook: notebook});
Matthias Bussonnier
Add notion of action that differs from shortcuts....
r18390 keyboard_manager.set_notebook(notebook);
keyboard_manager.set_quickhelp(quick_help);
jon
In person review with @ellisonbg
r17210 var menubar = new menubar.MenuBar('#menubar', $.extend({
notebook: notebook,
Jeff Hemmelgarn
Move contentmanager to contents
r18643 contents: contents,
jon
In person review with @ellisonbg
r17210 events: events,
save_widget: save_widget,
quick_help: quick_help},
common_options));
Thomas Kluyver
Use NotificationArea in the text editor
r19017 var notification_area = new notificationarea.NotebookNotificationArea(
jon
In person review with @ellisonbg
r17210 '#notification_area', {
events: events,
save_widget: save_widget,
Jonathan Frederic
Some JS test fixes
r17212 notebook: notebook,
keyboard_manager: keyboard_manager});
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192 notification_area.init_notification_widgets();
Thomas Kluyver
Allow switching kernel from the notebook UI
r17370 var kernel_selector = new kernelselector.KernelSelector(
Min RK
remove kernel selector from header...
r19596 '#kernel_logo_widget', notebook);
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192
mcelrath
Add bad font detection, and a dialog informing the user.
r7394 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
'<span id="test2" style="font-weight: bold;">x</span>'+
MinRK
various unicode fixes...
r15234 '<span id="test3" style="font-style: italic;">x</span></pre></div>');
mcelrath
Add bad font detection, and a dialog informing the user.
r7394 var nh = $('#test1').innerHeight();
var bh = $('#test2').innerHeight();
var ih = $('#test3').innerHeight();
if(nh != bh || nh != ih) {
mcelrath
Alternative solution: silently apply some CSS instead of a dialog box.
r7446 $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
mcelrath
Add bad font detection, and a dialog informing the user.
r7394 }
mcelrath
Fix spurious appearance of #fontarea at end of document.
r7666 $('#fonttest').remove();
mcelrath
Add bad font detection, and a dialog informing the user.
r7394
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192 page.show();
Brian E. Granger
Massive work on the notebook document format....
r4484
MinRK
add autosave timer...
r10505 var first_load = function () {
MinRK
trigger hash on notebook load...
r10006 var hash = document.location.hash;
if (hash) {
document.location.hash = '';
document.location.hash = hash;
}
Jonathan Frederic
Start of work to make notebook.html requirejs friendly.
r17192 notebook.set_autosave_interval(notebook.minimum_autosave_interval);
MinRK
add autosave timer...
r10505 // only do this once
Jonathan Frederic
Fixed events
r17195 events.off('notebook_loaded.Notebook', first_load);
MinRK
add autosave timer...
r10505 };
Jonathan Frederic
Fixed events
r17195 events.on('notebook_loaded.Notebook', first_load);
Jason Grout
Trigger app_initialized event *after* the 'global' IPython object is initialized
r17319
Jonathan Frederic
Some JS test fixes
r17212 IPython.page = page;
IPython.notebook = notebook;
Jeff Hemmelgarn
Move contentmanager to contents
r18643 IPython.contents = contents;
Jonathan Frederic
Some JS test fixes
r17212 IPython.pager = pager;
IPython.quick_help = quick_help;
IPython.login_widget = login_widget;
IPython.menubar = menubar;
IPython.toolbar = toolbar;
IPython.notification_area = notification_area;
IPython.keyboard_manager = keyboard_manager;
IPython.save_widget = save_widget;
Jonathan Frederic
More requirejs fixes
r17215 IPython.tooltip = notebook.tooltip;
Jason Grout
Trigger app_initialized event *after* the 'global' IPython object is initialized
r17319
events.trigger('app_initialized.NotebookApp');
Thomas Kluyver
Refactor out load_extensions_from_config function
r19632 utils.load_extensions_from_config(config_section);
Thomas Kluyver
Load common_config, and load extensions specified therein
r19633 utils.load_extensions_from_config(common_config);
Min RK
update frontend with path/name changes...
r18752 notebook.load_notebook(common_options.notebook_path);
Jason Grout
Trigger app_initialized event *after* the 'global' IPython object is initialized
r17319
MinRK
various unicode fixes...
r15234 });