Show More
@@ -1,68 +1,68 | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | //---------------------------------------------------------------------------- | |
2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
2 | // Copyright (C) 2008-2011 The IPython Development Team | |
3 | // |
|
3 | // | |
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | // Distributed under the terms of the BSD License. The full license is in | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | // the file COPYING, distributed as part of this software. | |
6 | //---------------------------------------------------------------------------- |
|
6 | //---------------------------------------------------------------------------- | |
7 |
|
7 | |||
8 | //============================================================================ |
|
8 | //============================================================================ | |
9 | // On document ready |
|
9 | // On document ready | |
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 |
|
12 | |||
13 | $(document).ready(function () { |
|
13 | $(document).ready(function () { | |
14 |
|
14 | |||
15 | IPython.init_mathjax(); |
|
15 | IPython.init_mathjax(); | |
16 |
|
16 | |||
17 | IPython.read_only = $('body').data('readOnly') === 'True'; |
|
17 | IPython.read_only = $('body').data('readOnly') === 'True'; | |
18 | $('div#main_app').addClass('border-box-sizing ui-widget'); |
|
18 | $('div#main_app').addClass('border-box-sizing ui-widget'); | |
19 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); |
|
19 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); | |
20 | // The header's bottom border is provided by the menu bar so we remove it. |
|
20 | // The header's bottom border is provided by the menu bar so we remove it. | |
21 | $('div#header').css('border-bottom-style','none'); |
|
21 | $('div#header').css('border-bottom-style','none'); | |
22 |
|
22 | |||
23 | IPython.page = new IPython.Page(); |
|
23 | IPython.page = new IPython.Page(); | |
24 | IPython.markdown_converter = new Markdown.Converter(); |
|
24 | IPython.markdown_converter = new Markdown.Converter(); | |
25 | IPython.layout_manager = new IPython.LayoutManager(); |
|
25 | IPython.layout_manager = new IPython.LayoutManager(); | |
26 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); |
|
26 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); | |
27 | IPython.quick_help = new IPython.QuickHelp('span#quick_help_area'); |
|
27 | IPython.quick_help = new IPython.QuickHelp('span#quick_help_area'); | |
28 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); |
|
28 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); | |
29 | IPython.notebook = new IPython.Notebook('div#notebook'); |
|
29 | IPython.notebook = new IPython.Notebook('div#notebook'); | |
30 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); |
|
30 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); | |
31 | IPython.menubar = new IPython.MenuBar('#menubar') |
|
31 | IPython.menubar = new IPython.MenuBar('#menubar') | |
32 | IPython.toolbar = new IPython.ToolBar('#toolbar') |
|
32 | IPython.toolbar = new IPython.ToolBar('#toolbar') | |
33 | IPython.tooltip = new IPython.Tooltip() |
|
33 | IPython.tooltip = new IPython.Tooltip() | |
34 | IPython.notification_widget = new IPython.NotificationWidget('#notification') |
|
34 | IPython.notification_widget = new IPython.NotificationWidget('#notification') | |
35 |
|
35 | |||
36 | IPython.layout_manager.do_resize(); |
|
36 | IPython.layout_manager.do_resize(); | |
37 |
|
37 | |||
38 | $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+ |
|
38 | $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+ | |
39 | '<span id="test2" style="font-weight: bold;">x</span>'+ |
|
39 | '<span id="test2" style="font-weight: bold;">x</span>'+ | |
40 | '<span id="test3" style="font-style: italic;">x</span></pre></div>') |
|
40 | '<span id="test3" style="font-style: italic;">x</span></pre></div>') | |
41 | var nh = $('#test1').innerHeight(); |
|
41 | var nh = $('#test1').innerHeight(); | |
42 | var bh = $('#test2').innerHeight(); |
|
42 | var bh = $('#test2').innerHeight(); | |
43 | var ih = $('#test3').innerHeight(); |
|
43 | var ih = $('#test3').innerHeight(); | |
44 | if(nh != bh || nh != ih) { |
|
44 | if(nh != bh || nh != ih) { | |
45 | $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>'); |
|
45 | $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>'); | |
46 | $('#fonttest').remove(); |
|
|||
47 | } |
|
46 | } | |
|
47 | $('#fonttest').remove(); | |||
48 |
|
48 | |||
49 | if(IPython.read_only){ |
|
49 | if(IPython.read_only){ | |
50 | // hide various elements from read-only view |
|
50 | // hide various elements from read-only view | |
51 | $('div#pager').remove(); |
|
51 | $('div#pager').remove(); | |
52 | $('div#pager_splitter').remove(); |
|
52 | $('div#pager_splitter').remove(); | |
53 |
|
53 | |||
54 | // set the notebook name field as not modifiable |
|
54 | // set the notebook name field as not modifiable | |
55 | $('#notebook_name').attr('disabled','disabled') |
|
55 | $('#notebook_name').attr('disabled','disabled') | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
58 | IPython.page.show(); |
|
58 | IPython.page.show(); | |
59 |
|
59 | |||
60 | IPython.layout_manager.do_resize(); |
|
60 | IPython.layout_manager.do_resize(); | |
61 | $([IPython.events]).on('notebook_loaded.Notebook', function () { |
|
61 | $([IPython.events]).on('notebook_loaded.Notebook', function () { | |
62 | IPython.layout_manager.do_resize(); |
|
62 | IPython.layout_manager.do_resize(); | |
63 | IPython.save_widget.update_url(); |
|
63 | IPython.save_widget.update_url(); | |
64 | }) |
|
64 | }) | |
65 | IPython.notebook.load_notebook($('body').data('notebookId')); |
|
65 | IPython.notebook.load_notebook($('body').data('notebookId')); | |
66 |
|
66 | |||
67 | }); |
|
67 | }); | |
68 |
|
68 |
General Comments 0
You need to be logged in to leave comments.
Login now