Show More
@@ -1,96 +1,99 b'' | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // MenuBar |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | var IPython = (function (IPython) { |
|
13 | 13 | |
|
14 | 14 | var FullEditWidget = function (selector) { |
|
15 | 15 | this.selector = selector; |
|
16 | 16 | this.opened = false; |
|
17 | 17 | if (this.selector !== undefined) { |
|
18 | 18 | this.element = $(selector); |
|
19 | 19 | this.style(); |
|
20 | 20 | this.bind_events(); |
|
21 | 21 | } |
|
22 | 22 | }; |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | FullEditWidget.prototype.style = function () { |
|
26 | 26 | var that = this; |
|
27 | 27 | this.element.find('#close_fulledit').button().on('click', function (){ |
|
28 | 28 | that.close(); |
|
29 | 29 | }) |
|
30 | // this.element.find('#fulledit_widget').addClass('ui-widget ui-widget-content'); | |
|
31 | 30 | this.element.find('#fulledit_header').addClass('ui-widget ui-widget-header'); |
|
32 | 31 | this.element.find('#fulledit_editor').addClass('ui-widget ui-widget-content'); |
|
33 | 32 | this.ace_editor = ace.edit("fulledit_editor"); |
|
34 | 33 | this.ace_editor.setTheme("ace/theme/textmate"); |
|
35 | 34 | var PythonMode = require("ace/mode/python").Mode; |
|
36 | 35 | this.ace_editor.getSession().setMode(new PythonMode()); |
|
37 | 36 | this.ace_editor.getSession().setTabSize(4); |
|
38 | 37 | this.ace_editor.getSession().setUseSoftTabs(true); |
|
39 | 38 | this.ace_editor.setHighlightActiveLine(false); |
|
39 | // Ace sets its css dynamically, so we need to do this here. These | |
|
40 | // values are chosen to match those of our CodeMirror editors. | |
|
41 | $('.ace_editor').css({fontFamily: 'monospace', fontSize: '110%', | |
|
42 | lineHeight: '1.231'}); | |
|
40 | 43 | }; |
|
41 | 44 | |
|
42 | 45 | |
|
43 | 46 | FullEditWidget.prototype.bind_events = function () { |
|
44 | 47 | |
|
45 | 48 | }; |
|
46 | 49 | |
|
47 | 50 | |
|
48 | 51 | FullEditWidget.prototype.open = function () { |
|
49 | 52 | var cell = IPython.notebook.selected_cell(); |
|
50 | 53 | if (!this.opened && cell instanceof IPython.CodeCell) { |
|
51 | 54 | $('#fulledit_widget').show(); |
|
52 | 55 | $('#main_app').hide(); |
|
53 | 56 | $('#menubar').hide(); |
|
54 | 57 | $('body').css({overflow : 'auto'}); |
|
55 | 58 | var code = cell.get_code(); |
|
56 | 59 | this.ace_editor.getSession().setValue(code); |
|
57 | 60 | this.ace_editor.focus(); |
|
58 | 61 | // On Safari (and Chrome/FF on Linux) the editor doesn't get |
|
59 | 62 | // focus unless there is a window resize. For now, we trigger it |
|
60 | 63 | // by hand until the bug is fixed upstream. |
|
61 | 64 | window.resizeBy(0,1); |
|
62 | 65 | window.resizeBy(0,-1); |
|
63 | 66 | this.opened = true; |
|
64 | 67 | }; |
|
65 | 68 | }; |
|
66 | 69 | |
|
67 | 70 | |
|
68 | 71 | FullEditWidget.prototype.close = function () { |
|
69 | 72 | if (this.opened) { |
|
70 | 73 | $('#fulledit_widget').hide(); |
|
71 | 74 | $('#main_app').show(); |
|
72 | 75 | $('#menubar').show(); |
|
73 | 76 | $('body').css({overflow : 'hidden'}); |
|
74 | 77 | var code = this.ace_editor.getSession().getValue(); |
|
75 | 78 | var cell = IPython.notebook.selected_cell(); |
|
76 | 79 | cell.set_code(code); |
|
77 | 80 | cell.select(); |
|
78 | 81 | this.opened = false; |
|
79 | 82 | }; |
|
80 | 83 | }; |
|
81 | 84 | |
|
82 | 85 | |
|
83 | 86 | FullEditWidget.prototype.toggle = function () { |
|
84 | 87 | if (this.opened) { |
|
85 | 88 | this.close(); |
|
86 | 89 | } else { |
|
87 | 90 | this.open(); |
|
88 | 91 | }; |
|
89 | 92 | }; |
|
90 | 93 | |
|
91 | 94 | |
|
92 | 95 | IPython.FullEditWidget = FullEditWidget; |
|
93 | 96 | |
|
94 | 97 | return IPython; |
|
95 | 98 | |
|
96 | 99 | }(IPython)); |
@@ -1,206 +1,208 b'' | |||
|
1 | 1 | <!DOCTYPE HTML> |
|
2 | 2 | <html> |
|
3 | 3 | |
|
4 | 4 | <head> |
|
5 | 5 | <meta charset="utf-8"> |
|
6 | 6 | |
|
7 | 7 | <title>IPython Notebook</title> |
|
8 | 8 | |
|
9 | 9 | {% if mathjax_url %} |
|
10 | 10 | <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML" charset="utf-8"></script> |
|
11 | 11 | {% end %} |
|
12 | 12 | <script type="text/javascript"> |
|
13 | 13 | // MathJax disabled, set as null to distingish from *missing* MathJax, |
|
14 | 14 | // where it will be undefined, and should prompt a dialog later. |
|
15 | 15 | window.mathjax_url = "{{mathjax_url}}"; |
|
16 | 16 | </script> |
|
17 | 17 | |
|
18 | 18 | <link rel="stylesheet" href="/static/jquery/css/themes/base/jquery-ui.min.css" type="text/css" /> |
|
19 | 19 | <link rel="stylesheet" href="/static/codemirror/lib/codemirror.css"> |
|
20 | 20 | <link rel="stylesheet" href="/static/codemirror/mode/markdown/markdown.css"> |
|
21 | 21 | <link rel="stylesheet" href="/static/codemirror/mode/rst/rst.css"> |
|
22 | 22 | <link rel="stylesheet" href="/static/codemirror/theme/ipython.css"> |
|
23 | 23 | <link rel="stylesheet" href="/static/codemirror/theme/default.css"> |
|
24 | 24 | |
|
25 | 25 | <link rel="stylesheet" href="/static/prettify/prettify.css"/> |
|
26 | 26 | |
|
27 | 27 | <link rel="stylesheet" href="/static/css/boilerplate.css" type="text/css" /> |
|
28 | 28 | <link rel="stylesheet" href="/static/css/layout.css" type="text/css" /> |
|
29 | 29 | <link rel="stylesheet" href="/static/css/base.css" type="text/css" /> |
|
30 | 30 | <link rel="stylesheet" href="/static/css/notebook.css" type="text/css" /> |
|
31 | 31 | <link rel="stylesheet" href="/static/css/renderedhtml.css" type="text/css" /> |
|
32 | 32 | |
|
33 | 33 | {% comment In the notebook, the read-only flag is used to determine %} |
|
34 | 34 | {% comment whether to hide the side panels and switch off input %} |
|
35 | 35 | <meta name="read_only" content="{{read_only and not logged_in}}"/> |
|
36 | 36 | |
|
37 | 37 | </head> |
|
38 | 38 | |
|
39 | 39 | <body |
|
40 | 40 | data-project={{project}} data-notebook-id={{notebook_id}} |
|
41 | 41 | data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}} |
|
42 | 42 | > |
|
43 | 43 | |
|
44 | 44 | <div id="header"> |
|
45 | 45 | <span id="ipython_notebook"><h1><a href='..' alt='dashboard'><img src='/static/ipynblogo.png' alt='IPython Notebook'/></a></h1></span> |
|
46 | 46 | <span id="save_widget"> |
|
47 | 47 | <span id="notebook_name"></span> |
|
48 | 48 | <span id="save_status"></span> |
|
49 | 49 | </span> |
|
50 | 50 | |
|
51 | 51 | <span id="login_widget"> |
|
52 | 52 | {% comment This is a temporary workaround to hide the logout button %} |
|
53 | 53 | {% comment when appropriate until notebook.html is templated %} |
|
54 | 54 | {% if logged_in %} |
|
55 | 55 | <button id="logout">Logout</button> |
|
56 | 56 | {% elif not logged_in and login_available %} |
|
57 | 57 | <button id="login">Login</button> |
|
58 | 58 | {% end %} |
|
59 | 59 | </span> |
|
60 | 60 | |
|
61 | 61 | <span id="kernel_status">Idle</span> |
|
62 | 62 | </div> |
|
63 | 63 | |
|
64 | 64 | <div id="menubar"> |
|
65 | 65 | <ul id="menus"> |
|
66 | 66 | <li><a href="#">File</a> |
|
67 | 67 | <ul> |
|
68 | 68 | <li id="new_notebook"><a href="#">New</a></li> |
|
69 | 69 | <li id="open_notebook"><a href="#">Open...</a></li> |
|
70 | 70 | <hr/> |
|
71 | 71 | <li id="copy_notebook"><a href="#">Make a Copy...</a></li> |
|
72 | 72 | <li id="rename_notebook"><a href="#">Rename...</a></li> |
|
73 | 73 | <li id="save_notebook"><a href="#">Save</a></li> |
|
74 | 74 | <hr/> |
|
75 | 75 | <li><a href="#">Download as</a> |
|
76 | 76 | <ul> |
|
77 | 77 | <li id="download_ipynb"><a href="#">IPython (.ipynb)</a></li> |
|
78 | 78 | <li id="download_py"><a href="#">Python (.py)</a></li> |
|
79 | 79 | </ul> |
|
80 | 80 | </li> |
|
81 | 81 | <hr/> |
|
82 | 82 | <li id="print_notebook"><a href="/{{notebook_id}}/print" target="_blank">Print View</a></li> |
|
83 | 83 | </ul> |
|
84 | 84 | </li> |
|
85 | 85 | <li><a href="#">Edit</a> |
|
86 | 86 | <ul> |
|
87 | 87 | <li id="cut_cell"><a href="#">Cut</a></li> |
|
88 | 88 | <li id="copy_cell"><a href="#">Copy</a></li> |
|
89 | 89 | <li id="paste_cell" class="ui-state-disabled"><a href="#">Paste</a></li> |
|
90 | 90 | <li id="paste_cell_above" class="ui-state-disabled"><a href="#">Paste Above</a></li> |
|
91 | 91 | <li id="paste_cell_below" class="ui-state-disabled"><a href="#">Paste Below</a></li> |
|
92 | 92 | <li id="delete_cell"><a href="#">Delete</a></li> |
|
93 | 93 | <hr/> |
|
94 | 94 | <li id="split_cell"><a href="#">Split</a></li> |
|
95 | 95 | <li id="merge_cell_above"><a href="#">Merge Above</a></li> |
|
96 | 96 | <li id="merge_cell_below"><a href="#">Merge Below</a></li> |
|
97 | 97 | <hr/> |
|
98 | 98 | <li id="move_cell_up"><a href="#">Move Up</a></li> |
|
99 | 99 | <li id="move_cell_down"><a href="#">Move Down</a></li> |
|
100 | 100 | <hr/> |
|
101 | 101 | <li id="select_previous"><a href="#">Select Previous</a></li> |
|
102 | 102 | <li id="select_next"><a href="#">Select Next</a></li> |
|
103 | 103 | </ul> |
|
104 | 104 | </li> |
|
105 | 105 | <li><a href="#">Insert</a> |
|
106 | 106 | <ul> |
|
107 | 107 | <li id="insert_cell_above"><a href="#">Insert Cell Above</a></li> |
|
108 | 108 | <li id="insert_cell_below"><a href="#">Insert Cell Below</a></li> |
|
109 | 109 | </ul> |
|
110 | 110 | </li> |
|
111 | 111 | <li><a href="#">Cell</a> |
|
112 | 112 | <ul> |
|
113 | 113 | <li id="full_edit_cell"><a href="#">Edit in Ace</a></li> |
|
114 | 114 | <hr/> |
|
115 | 115 | <li id="run_cell"><a href="#">Run</a></li> |
|
116 | 116 | <li id="run_cell_in_place"><a href="#">Run in Place</a></li> |
|
117 | 117 | <li id="run_all_cells"><a href="#">Run All</a></li> |
|
118 | 118 | <hr/> |
|
119 | 119 | <li id="to_code"><a href="#">Code Cell</a></li> |
|
120 | 120 | <li id="to_markdown"><a href="#">Markdown Cell</a></li> |
|
121 | 121 | <hr/> |
|
122 | 122 | <li id="toggle_output"><a href="#">Toggle Output</a></li> |
|
123 | 123 | <li id="clear_all_output"><a href="#">Clear All Output</a></li> |
|
124 | 124 | </ul> |
|
125 | 125 | </li> |
|
126 | 126 | <li><a href="#">Kernel</a> |
|
127 | 127 | <ul> |
|
128 | 128 | <li id="int_kernel"><a href="#">Interrupt</a></li> |
|
129 | 129 | <li id="restart_kernel"><a href="#">Restart</a></li> |
|
130 | 130 | </ul> |
|
131 | 131 | </li> |
|
132 | 132 | <li><a href="#">Help</a> |
|
133 | 133 | <ul> |
|
134 | 134 | <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li> |
|
135 | 135 | <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li> |
|
136 | 136 | <li id="keyboard_shortcuts"><a href="#">Keyboard Shortcuts</a></li> |
|
137 | 137 | <hr/> |
|
138 | <li><a href="https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts" target="_blank">Ace Keyboard Shortcuts</a></li> | |
|
139 | <hr/> | |
|
138 | 140 | <li><a href="http://docs.python.org" target="_blank">Python</a></li> |
|
139 | 141 | <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li> |
|
140 | 142 | <li><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></li> |
|
141 | 143 | <li><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></li> |
|
142 | 144 | <li><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a></li> |
|
143 | 145 | </ul> |
|
144 | 146 | </li> |
|
145 | 147 | </ul> |
|
146 | 148 | |
|
147 | 149 | </div> |
|
148 | 150 | |
|
149 | 151 | <div id="main_app"> |
|
150 | 152 | |
|
151 | 153 | <div id="notebook_panel"> |
|
152 | 154 | <div id="notebook"></div> |
|
153 | 155 | <div id="pager_splitter"></div> |
|
154 | 156 | <div id="pager"></div> |
|
155 | 157 | </div> |
|
156 | 158 | |
|
157 | 159 | </div> |
|
158 | 160 | |
|
159 | 161 | <div id="fulledit_widget" > |
|
160 | 162 | <div id="fulledit_header"> |
|
161 | 163 | <button id="close_fulledit">Close</button> |
|
162 | 164 | </div> |
|
163 | 165 | <div id="fulledit_editor">some text</div> |
|
164 | 166 | </div> |
|
165 | 167 | |
|
166 | 168 | <script src="/static/jquery/js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script> |
|
167 | 169 | <script src="/static/jquery/js/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script> |
|
168 | 170 | |
|
169 | 171 | <script src="/static/codemirror/lib/codemirror.js" charset="utf-8"></script> |
|
170 | 172 | <script src="/static/codemirror/mode/python/python.js" charset="utf-8"></script> |
|
171 | 173 | <script src="/static/codemirror/mode/htmlmixed/htmlmixed.js" charset="utf-8"></script> |
|
172 | 174 | <script src="/static/codemirror/mode/xml/xml.js" charset="utf-8"></script> |
|
173 | 175 | <script src="/static/codemirror/mode/javascript/javascript.js" charset="utf-8"></script> |
|
174 | 176 | <script src="/static/codemirror/mode/css/css.js" charset="utf-8"></script> |
|
175 | 177 | <script src="/static/codemirror/mode/rst/rst.js" charset="utf-8"></script> |
|
176 | 178 | <script src="/static/codemirror/mode/markdown/markdown.js" charset="utf-8"></script> |
|
177 | 179 | |
|
178 | 180 | <script src="/static/ace/ace.js" type="text/javascript" charset="utf-8"></script> |
|
179 | 181 | <script src="/static/ace/mode-python.js" type="text/javascript" charset="utf-8"></script> |
|
180 | 182 | <script src="/static/ace/theme-textmate.js" type="text/javascript" charset="utf-8"></script> |
|
181 | 183 | |
|
182 | 184 | <script src="/static/pagedown/Markdown.Converter.js" charset="utf-8"></script> |
|
183 | 185 | |
|
184 | 186 | <script src="/static/prettify/prettify.js" charset="utf-8"></script> |
|
185 | 187 | <script src="/static/dateformat/date.format.js" charset="utf-8"></script> |
|
186 | 188 | |
|
187 | 189 | <script src="/static/js/namespace.js" type="text/javascript" charset="utf-8"></script> |
|
188 | 190 | <script src="/static/js/utils.js" type="text/javascript" charset="utf-8"></script> |
|
189 | 191 | <script src="/static/js/cell.js" type="text/javascript" charset="utf-8"></script> |
|
190 | 192 | <script src="/static/js/codecell.js" type="text/javascript" charset="utf-8"></script> |
|
191 | 193 | <script src="/static/js/textcell.js" type="text/javascript" charset="utf-8"></script> |
|
192 | 194 | <script src="/static/js/kernel.js" type="text/javascript" charset="utf-8"></script> |
|
193 | 195 | <script src="/static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> |
|
194 | 196 | <script src="/static/js/layout.js" type="text/javascript" charset="utf-8"></script> |
|
195 | 197 | <script src="/static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> |
|
196 | 198 | <script src="/static/js/quickhelp.js" type="text/javascript" charset="utf-8"></script> |
|
197 | 199 | <script src="/static/js/loginwidget.js" type="text/javascript" charset="utf-8"></script> |
|
198 | 200 | <script src="/static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
|
199 | 201 | <script src="/static/js/menubar.js" type="text/javascript" charset="utf-8"></script> |
|
200 | 202 | <script src="/static/js/notebook.js" type="text/javascript" charset="utf-8"></script> |
|
201 | 203 | <script src="/static/js/notebookmain.js" type="text/javascript" charset="utf-8"></script> |
|
202 | 204 | <script src="/static/js/fulleditwidget.js" type="text/javascript" charset="utf-8"></script> |
|
203 | 205 | |
|
204 | 206 | </body> |
|
205 | 207 | |
|
206 | 208 | </html> |
General Comments 0
You need to be logged in to leave comments.
Login now