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