##// END OF EJS Templates
Rebase fixes
Jonathan Frederic -
Show More
@@ -1,158 +1,156 b''
1 1 // Copyright (c) IPython Development Team.
2 2 // Distributed under the terms of the Modified BSD License.
3 3
4 4 require([
5 'es6promise',
6 5 'base/js/namespace',
7 6 'jquery',
8 7 'notebook/js/notebook',
9 8 'contents',
10 9 'base/js/utils',
11 10 'base/js/page',
12 11 'notebook/js/layoutmanager',
13 12 'base/js/events',
14 13 'auth/js/loginwidget',
15 14 'notebook/js/maintoolbar',
16 15 'notebook/js/pager',
17 16 'notebook/js/quickhelp',
18 17 'notebook/js/menubar',
19 18 'notebook/js/notificationarea',
20 19 'notebook/js/savewidget',
21 20 'notebook/js/keyboardmanager',
22 21 'notebook/js/config',
23 22 'notebook/js/kernelselector',
24 23 'codemirror/lib/codemirror',
25 24 'notebook/js/about',
26 25 // only loaded, not used, please keep sure this is loaded last
27 26 'custom/custom'
28 27 ], function(
29 es6promise,
30 28 IPython,
31 29 $,
32 30 notebook,
33 31 contents,
34 32 utils,
35 33 page,
36 34 layoutmanager,
37 35 events,
38 36 loginwidget,
39 37 maintoolbar,
40 38 pager,
41 39 quickhelp,
42 40 menubar,
43 41 notificationarea,
44 42 savewidget,
45 43 keyboardmanager,
46 44 config,
47 45 kernelselector,
48 46 CodeMirror,
49 47 about,
50 48 // please keep sure that even if not used, this is loaded last
51 49 custom
52 50 ) {
53 51 "use strict";
54 52
55 53 // compat with old IPython, remove for IPython > 3.0
56 54 window.CodeMirror = CodeMirror;
57 55
58 56 var common_options = {
59 57 ws_url : utils.get_body_data("wsUrl"),
60 58 base_url : utils.get_body_data("baseUrl"),
61 59 notebook_path : utils.get_body_data("notebookPath"),
62 60 notebook_name : utils.get_body_data('notebookName')
63 61 };
64 62
65 63 var user_config = $.extend({}, config.default_config);
66 64 var page = new page.Page();
67 65 var layout_manager = new layoutmanager.LayoutManager();
68 66 var pager = new pager.Pager('div#pager', 'div#pager_splitter', {
69 67 layout_manager: layout_manager,
70 68 events: events});
71 69 var keyboard_manager = new keyboardmanager.KeyboardManager({
72 70 pager: pager,
73 71 events: events});
74 72 var save_widget = new savewidget.SaveWidget('span#save_widget', {
75 73 events: events,
76 74 keyboard_manager: keyboard_manager});
77 75 var contents = new contents.Contents($.extend({
78 76 events: events},
79 77 common_options));
80 78 var notebook = new notebook.Notebook('div#notebook', $.extend({
81 79 events: events,
82 80 keyboard_manager: keyboard_manager,
83 81 save_widget: save_widget,
84 82 contents: contents,
85 83 config: user_config},
86 84 common_options));
87 85 var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options);
88 86 var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', {
89 87 notebook: notebook,
90 88 events: events});
91 89 var quick_help = new quickhelp.QuickHelp({
92 90 keyboard_manager: keyboard_manager,
93 91 events: events,
94 92 notebook: notebook});
95 93 var menubar = new menubar.MenuBar('#menubar', $.extend({
96 94 notebook: notebook,
97 95 contents: contents,
98 96 layout_manager: layout_manager,
99 97 events: events,
100 98 save_widget: save_widget,
101 99 quick_help: quick_help},
102 100 common_options));
103 101 var notification_area = new notificationarea.NotificationArea(
104 102 '#notification_area', {
105 103 events: events,
106 104 save_widget: save_widget,
107 105 notebook: notebook,
108 106 keyboard_manager: keyboard_manager});
109 107 notification_area.init_notification_widgets();
110 108 var kernel_selector = new kernelselector.KernelSelector(
111 109 '#kernel_selector_widget', notebook);
112 110
113 111 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
114 112 '<span id="test2" style="font-weight: bold;">x</span>'+
115 113 '<span id="test3" style="font-style: italic;">x</span></pre></div>');
116 114 var nh = $('#test1').innerHeight();
117 115 var bh = $('#test2').innerHeight();
118 116 var ih = $('#test3').innerHeight();
119 117 if(nh != bh || nh != ih) {
120 118 $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
121 119 }
122 120 $('#fonttest').remove();
123 121
124 122 page.show();
125 123
126 124 layout_manager.do_resize();
127 125 var first_load = function () {
128 126 layout_manager.do_resize();
129 127 var hash = document.location.hash;
130 128 if (hash) {
131 129 document.location.hash = '';
132 130 document.location.hash = hash;
133 131 }
134 132 notebook.set_autosave_interval(notebook.minimum_autosave_interval);
135 133 // only do this once
136 134 events.off('notebook_loaded.Notebook', first_load);
137 135 };
138 136 events.on('notebook_loaded.Notebook', first_load);
139 137
140 138 IPython.page = page;
141 139 IPython.layout_manager = layout_manager;
142 140 IPython.notebook = notebook;
143 141 IPython.contents = contents;
144 142 IPython.pager = pager;
145 143 IPython.quick_help = quick_help;
146 144 IPython.login_widget = login_widget;
147 145 IPython.menubar = menubar;
148 146 IPython.toolbar = toolbar;
149 147 IPython.notification_area = notification_area;
150 148 IPython.keyboard_manager = keyboard_manager;
151 149 IPython.save_widget = save_widget;
152 150 IPython.config = user_config;
153 151 IPython.tooltip = notebook.tooltip;
154 152
155 153 events.trigger('app_initialized.NotebookApp');
156 154 notebook.load_notebook(common_options.notebook_path);
157 155
158 156 });
General Comments 0
You need to be logged in to leave comments. Login now