##// END OF EJS Templates
Use es6-promise polyfill
Jonathan Frederic -
Show More
@@ -1,157 +1,158 b''
1 // Copyright (c) IPython Development Team.
1 // Copyright (c) IPython Development Team.
2 // Distributed under the terms of the Modified BSD License.
2 // Distributed under the terms of the Modified BSD License.
3
3
4 require([
4 require([
5 'es6promise',
5 'base/js/namespace',
6 'base/js/namespace',
6 'jquery',
7 'jquery',
7 'notebook/js/notebook',
8 'notebook/js/notebook',
8 'contents',
9 'contents',
9 'base/js/utils',
10 'base/js/utils',
10 'base/js/page',
11 'base/js/page',
11 'notebook/js/layoutmanager',
12 'notebook/js/layoutmanager',
12 'base/js/events',
13 'base/js/events',
13 'auth/js/loginwidget',
14 'auth/js/loginwidget',
14 'notebook/js/maintoolbar',
15 'notebook/js/maintoolbar',
15 'notebook/js/pager',
16 'notebook/js/pager',
16 'notebook/js/quickhelp',
17 'notebook/js/quickhelp',
17 'notebook/js/menubar',
18 'notebook/js/menubar',
18 'notebook/js/notificationarea',
19 'notebook/js/notificationarea',
19 'notebook/js/savewidget',
20 'notebook/js/savewidget',
20 'notebook/js/keyboardmanager',
21 'notebook/js/keyboardmanager',
21 'notebook/js/config',
22 'notebook/js/config',
22 'notebook/js/kernelselector',
23 'notebook/js/kernelselector',
23 'codemirror/lib/codemirror',
24 'codemirror/lib/codemirror',
24 'notebook/js/about',
25 'notebook/js/about',
25 // only loaded, not used, please keep sure this is loaded last
26 // only loaded, not used, please keep sure this is loaded last
26 'custom/custom'
27 'custom/custom'
27 ], function(
28 ], function(
29 es6promise,
28 IPython,
30 IPython,
29 $,
31 $,
30 notebook,
32 notebook,
31 contents,
33 contents,
32 utils,
34 utils,
33 page,
35 page,
34 layoutmanager,
36 layoutmanager,
35 events,
37 events,
36 loginwidget,
38 loginwidget,
37 maintoolbar,
39 maintoolbar,
38 pager,
40 pager,
39 quickhelp,
41 quickhelp,
40 menubar,
42 menubar,
41 notificationarea,
43 notificationarea,
42 savewidget,
44 savewidget,
43 keyboardmanager,
45 keyboardmanager,
44 config,
46 config,
45 kernelselector,
47 kernelselector,
46 CodeMirror,
48 CodeMirror,
47 about,
49 about,
48 // please keep sure that even if not used, this is loaded last
50 // please keep sure that even if not used, this is loaded last
49 custom
51 custom
50 ) {
52 ) {
51 "use strict";
53 "use strict";
52 console.log(promise);
53
54
54 // compat with old IPython, remove for IPython > 3.0
55 // compat with old IPython, remove for IPython > 3.0
55 window.CodeMirror = CodeMirror;
56 window.CodeMirror = CodeMirror;
56
57
57 var common_options = {
58 var common_options = {
58 ws_url : utils.get_body_data("wsUrl"),
59 ws_url : utils.get_body_data("wsUrl"),
59 base_url : utils.get_body_data("baseUrl"),
60 base_url : utils.get_body_data("baseUrl"),
60 notebook_path : utils.get_body_data("notebookPath"),
61 notebook_path : utils.get_body_data("notebookPath"),
61 notebook_name : utils.get_body_data('notebookName')
62 notebook_name : utils.get_body_data('notebookName')
62 };
63 };
63
64
64 var user_config = $.extend({}, config.default_config);
65 var user_config = $.extend({}, config.default_config);
65 var page = new page.Page();
66 var page = new page.Page();
66 var layout_manager = new layoutmanager.LayoutManager();
67 var layout_manager = new layoutmanager.LayoutManager();
67 var pager = new pager.Pager('div#pager', 'div#pager_splitter', {
68 var pager = new pager.Pager('div#pager', 'div#pager_splitter', {
68 layout_manager: layout_manager,
69 layout_manager: layout_manager,
69 events: events});
70 events: events});
70 var keyboard_manager = new keyboardmanager.KeyboardManager({
71 var keyboard_manager = new keyboardmanager.KeyboardManager({
71 pager: pager,
72 pager: pager,
72 events: events});
73 events: events});
73 var save_widget = new savewidget.SaveWidget('span#save_widget', {
74 var save_widget = new savewidget.SaveWidget('span#save_widget', {
74 events: events,
75 events: events,
75 keyboard_manager: keyboard_manager});
76 keyboard_manager: keyboard_manager});
76 var contents = new contents.Contents($.extend({
77 var contents = new contents.Contents($.extend({
77 events: events},
78 events: events},
78 common_options));
79 common_options));
79 var notebook = new notebook.Notebook('div#notebook', $.extend({
80 var notebook = new notebook.Notebook('div#notebook', $.extend({
80 events: events,
81 events: events,
81 keyboard_manager: keyboard_manager,
82 keyboard_manager: keyboard_manager,
82 save_widget: save_widget,
83 save_widget: save_widget,
83 contents: contents,
84 contents: contents,
84 config: user_config},
85 config: user_config},
85 common_options));
86 common_options));
86 var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options);
87 var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options);
87 var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', {
88 var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', {
88 notebook: notebook,
89 notebook: notebook,
89 events: events});
90 events: events});
90 var quick_help = new quickhelp.QuickHelp({
91 var quick_help = new quickhelp.QuickHelp({
91 keyboard_manager: keyboard_manager,
92 keyboard_manager: keyboard_manager,
92 events: events,
93 events: events,
93 notebook: notebook});
94 notebook: notebook});
94 var menubar = new menubar.MenuBar('#menubar', $.extend({
95 var menubar = new menubar.MenuBar('#menubar', $.extend({
95 notebook: notebook,
96 notebook: notebook,
96 contents: contents,
97 contents: contents,
97 layout_manager: layout_manager,
98 layout_manager: layout_manager,
98 events: events,
99 events: events,
99 save_widget: save_widget,
100 save_widget: save_widget,
100 quick_help: quick_help},
101 quick_help: quick_help},
101 common_options));
102 common_options));
102 var notification_area = new notificationarea.NotificationArea(
103 var notification_area = new notificationarea.NotificationArea(
103 '#notification_area', {
104 '#notification_area', {
104 events: events,
105 events: events,
105 save_widget: save_widget,
106 save_widget: save_widget,
106 notebook: notebook,
107 notebook: notebook,
107 keyboard_manager: keyboard_manager});
108 keyboard_manager: keyboard_manager});
108 notification_area.init_notification_widgets();
109 notification_area.init_notification_widgets();
109 var kernel_selector = new kernelselector.KernelSelector(
110 var kernel_selector = new kernelselector.KernelSelector(
110 '#kernel_selector_widget', notebook);
111 '#kernel_selector_widget', notebook);
111
112
112 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
113 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
113 '<span id="test2" style="font-weight: bold;">x</span>'+
114 '<span id="test2" style="font-weight: bold;">x</span>'+
114 '<span id="test3" style="font-style: italic;">x</span></pre></div>');
115 '<span id="test3" style="font-style: italic;">x</span></pre></div>');
115 var nh = $('#test1').innerHeight();
116 var nh = $('#test1').innerHeight();
116 var bh = $('#test2').innerHeight();
117 var bh = $('#test2').innerHeight();
117 var ih = $('#test3').innerHeight();
118 var ih = $('#test3').innerHeight();
118 if(nh != bh || nh != ih) {
119 if(nh != bh || nh != ih) {
119 $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
120 $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
120 }
121 }
121 $('#fonttest').remove();
122 $('#fonttest').remove();
122
123
123 page.show();
124 page.show();
124
125
125 layout_manager.do_resize();
126 layout_manager.do_resize();
126 var first_load = function () {
127 var first_load = function () {
127 layout_manager.do_resize();
128 layout_manager.do_resize();
128 var hash = document.location.hash;
129 var hash = document.location.hash;
129 if (hash) {
130 if (hash) {
130 document.location.hash = '';
131 document.location.hash = '';
131 document.location.hash = hash;
132 document.location.hash = hash;
132 }
133 }
133 notebook.set_autosave_interval(notebook.minimum_autosave_interval);
134 notebook.set_autosave_interval(notebook.minimum_autosave_interval);
134 // only do this once
135 // only do this once
135 events.off('notebook_loaded.Notebook', first_load);
136 events.off('notebook_loaded.Notebook', first_load);
136 };
137 };
137 events.on('notebook_loaded.Notebook', first_load);
138 events.on('notebook_loaded.Notebook', first_load);
138
139
139 IPython.page = page;
140 IPython.page = page;
140 IPython.layout_manager = layout_manager;
141 IPython.layout_manager = layout_manager;
141 IPython.notebook = notebook;
142 IPython.notebook = notebook;
142 IPython.contents = contents;
143 IPython.contents = contents;
143 IPython.pager = pager;
144 IPython.pager = pager;
144 IPython.quick_help = quick_help;
145 IPython.quick_help = quick_help;
145 IPython.login_widget = login_widget;
146 IPython.login_widget = login_widget;
146 IPython.menubar = menubar;
147 IPython.menubar = menubar;
147 IPython.toolbar = toolbar;
148 IPython.toolbar = toolbar;
148 IPython.notification_area = notification_area;
149 IPython.notification_area = notification_area;
149 IPython.keyboard_manager = keyboard_manager;
150 IPython.keyboard_manager = keyboard_manager;
150 IPython.save_widget = save_widget;
151 IPython.save_widget = save_widget;
151 IPython.config = user_config;
152 IPython.config = user_config;
152 IPython.tooltip = notebook.tooltip;
153 IPython.tooltip = notebook.tooltip;
153
154
154 events.trigger('app_initialized.NotebookApp');
155 events.trigger('app_initialized.NotebookApp');
155 notebook.load_notebook(common_options.notebook_path);
156 notebook.load_notebook(common_options.notebook_path);
156
157
157 });
158 });
@@ -1,104 +1,104 b''
1 <!DOCTYPE HTML>
1 <!DOCTYPE HTML>
2 <html>
2 <html>
3
3
4 <head>
4 <head>
5 <meta charset="utf-8">
5 <meta charset="utf-8">
6
6
7 <title>{% block title %}IPython Notebook{% endblock %}</title>
7 <title>{% block title %}IPython Notebook{% endblock %}</title>
8 <link rel="shortcut icon" type="image/x-icon" href="{{static_url("base/images/favicon.ico") }}">
8 <link rel="shortcut icon" type="image/x-icon" href="{{static_url("base/images/favicon.ico") }}">
9 <meta http-equiv="X-UA-Compatible" content="chrome=1">
9 <meta http-equiv="X-UA-Compatible" content="chrome=1">
10 <link rel="stylesheet" href="{{static_url("components/jquery-ui/themes/smoothness/jquery-ui.min.css") }}" type="text/css" />
10 <link rel="stylesheet" href="{{static_url("components/jquery-ui/themes/smoothness/jquery-ui.min.css") }}" type="text/css" />
11 <meta name="viewport" content="width=device-width, initial-scale=1.0">
11 <meta name="viewport" content="width=device-width, initial-scale=1.0">
12
12
13 {% block stylesheet %}
13 {% block stylesheet %}
14 <link rel="stylesheet" href="{{ static_url("style/style.min.css") }}" type="text/css"/>
14 <link rel="stylesheet" href="{{ static_url("style/style.min.css") }}" type="text/css"/>
15 {% endblock %}
15 {% endblock %}
16 <link rel="stylesheet" href="{{ static_url("custom/custom.css") }}" type="text/css" />
16 <link rel="stylesheet" href="{{ static_url("custom/custom.css") }}" type="text/css" />
17 <script src="{{static_url("components/es6-promise/promise.min.js")}}" type="text/javascript" charset="utf-8"></script>
17 <script src="{{static_url("components/es6-promise/promise.min.js")}}" type="text/javascript" charset="utf-8"></script>
18 <script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
18 <script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
19 <script>
19 <script>
20 require.config({
20 require.config({
21 baseUrl: '{{static_url("", include_version=False)}}',
21 baseUrl: '{{static_url("", include_version=False)}}',
22 paths: {
22 paths: {
23 nbextensions : '{{ base_url }}nbextensions',
23 nbextensions : '{{ base_url }}nbextensions',
24 underscore : 'components/underscore/underscore-min',
24 underscore : 'components/underscore/underscore-min',
25 backbone : 'components/backbone/backbone-min',
25 backbone : 'components/backbone/backbone-min',
26 jquery: 'components/jquery/jquery.min',
26 jquery: 'components/jquery/jquery.min',
27 bootstrap: 'components/bootstrap/js/bootstrap.min',
27 bootstrap: 'components/bootstrap/js/bootstrap.min',
28 bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
28 bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
29 jqueryui: 'components/jquery-ui/ui/minified/jquery-ui.min',
29 jqueryui: 'components/jquery-ui/ui/minified/jquery-ui.min',
30 moment: "components/moment/moment",
30 moment: 'components/moment/moment',
31 codemirror: 'components/codemirror',
31 codemirror: 'components/codemirror',
32 termjs: "components/term.js/src/term",
32 termjs: 'components/term.js/src/term',
33 contents: '{{ contents_js_source }}',
33 contents: '{{ contents_js_source }}',
34 },
34 },
35 shim: {
35 shim: {
36 underscore: {
36 underscore: {
37 exports: '_'
37 exports: '_'
38 },
38 },
39 backbone: {
39 backbone: {
40 deps: ["underscore", "jquery"],
40 deps: ["underscore", "jquery"],
41 exports: "Backbone"
41 exports: "Backbone"
42 },
42 },
43 bootstrap: {
43 bootstrap: {
44 deps: ["jquery"],
44 deps: ["jquery"],
45 exports: "bootstrap"
45 exports: "bootstrap"
46 },
46 },
47 bootstraptour: {
47 bootstraptour: {
48 deps: ["bootstrap"],
48 deps: ["bootstrap"],
49 exports: "Tour"
49 exports: "Tour"
50 },
50 },
51 jqueryui: {
51 jqueryui: {
52 deps: ["jquery"],
52 deps: ["jquery"],
53 exports: "$"
53 exports: "$"
54 }
54 }
55 }
55 }
56 });
56 });
57 </script>
57 </script>
58
58
59 {% block meta %}
59 {% block meta %}
60 {% endblock %}
60 {% endblock %}
61
61
62 </head>
62 </head>
63
63
64 <body {% block params %}{% endblock %}>
64 <body {% block params %}{% endblock %}>
65
65
66 <noscript>
66 <noscript>
67 <div id='noscript'>
67 <div id='noscript'>
68 IPython Notebook requires JavaScript.<br>
68 IPython Notebook requires JavaScript.<br>
69 Please enable it to proceed.
69 Please enable it to proceed.
70 </div>
70 </div>
71 </noscript>
71 </noscript>
72
72
73 <div id="header" class="navbar navbar-static-top">
73 <div id="header" class="navbar navbar-static-top">
74 <div class="container">
74 <div class="container">
75 <div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="{{base_url}}tree" alt='dashboard'><img src='{{static_url("base/images/ipynblogo.png") }}' alt='IPython Notebook'/></a></div>
75 <div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="{{base_url}}tree" alt='dashboard'><img src='{{static_url("base/images/ipynblogo.png") }}' alt='IPython Notebook'/></a></div>
76
76
77 {% block login_widget %}
77 {% block login_widget %}
78
78
79 <span id="login_widget">
79 <span id="login_widget">
80 {% if logged_in %}
80 {% if logged_in %}
81 <button id="logout">Logout</button>
81 <button id="logout">Logout</button>
82 {% elif login_available and not logged_in %}
82 {% elif login_available and not logged_in %}
83 <button id="login">Login</button>
83 <button id="login">Login</button>
84 {% endif %}
84 {% endif %}
85 </span>
85 </span>
86
86
87 {% endblock %}
87 {% endblock %}
88
88
89 {% block header %}
89 {% block header %}
90 {% endblock %}
90 {% endblock %}
91 </div>
91 </div>
92 </div>
92 </div>
93
93
94 <div id="site">
94 <div id="site">
95 {% block site %}
95 {% block site %}
96 {% endblock %}
96 {% endblock %}
97 </div>
97 </div>
98
98
99 {% block script %}
99 {% block script %}
100 {% endblock %}
100 {% endblock %}
101
101
102 </body>
102 </body>
103
103
104 </html>
104 </html>
General Comments 0
You need to be logged in to leave comments. Login now