##// END OF EJS Templates
Alternative solution: silently apply some CSS instead of a dialog box.
mcelrath -
Show More
@@ -1,340 +1,347 b''
1 1 /**
2 2 * Primary styles
3 3 *
4 4 * Author: IPython Development Team
5 5 */
6 6
7 7
8 8 body {
9 9 overflow: hidden;
10 10 }
11 11
12 12 span#save_widget {
13 13 padding: 5px;
14 14 margin: 0px 0px 0px 300px;
15 15 display:inline-block;
16 16 }
17 17
18 18 span#notebook_name {
19 19 height: 1em;
20 20 line-height: 1em;
21 21 padding: 3px;
22 22 border: none;
23 23 font-size: 146.5%;
24 24 }
25 25
26 26 .ui-menubar-item .ui-button .ui-button-text {
27 27 padding: 0.4em 1.0em;
28 28 font-size: 100%;
29 29 }
30 30
31 31 .ui-menu {
32 32 -moz-box-shadow: 0px 6px 10px -1px #adadad;
33 33 -webkit-box-shadow: 0px 6px 10px -1px #adadad;
34 34 box-shadow: 0px 6px 10px -1px #adadad;
35 35 }
36 36
37 37 .ui-menu .ui-menu-item a {
38 38 border: 1px solid transparent;
39 39 padding: 2px 1.6em;
40 40 }
41 41
42 42 .ui-menu hr {
43 43 margin: 0.3em 0;
44 44 }
45 45
46 46 #menubar_container {
47 47 position: relative;
48 48 }
49 49
50 50 #notification {
51 51 position: absolute;
52 52 right: 3px;
53 53 top: 3px;
54 54 height: 25px;
55 55 padding: 3px 6px;
56 56 z-index: 10;
57 57 }
58 58
59 59 #toolbar {
60 60 padding: 3px 15px;
61 61 }
62 62
63 63 #cell_type {
64 64 font-size: 85%;
65 65 }
66 66
67 67
68 68 div#main_app {
69 69 width: 100%;
70 70 position: relative;
71 71 }
72 72
73 73 span#quick_help_area {
74 74 position: static;
75 75 padding: 5px 0px;
76 76 margin: 0px 0px 0px 0px;
77 77 }
78 78
79 79 .help_string {
80 80 float: right;
81 81 width: 170px;
82 82 padding: 0px 5px;
83 83 text-align: left;
84 84 font-size: 85%;
85 85 }
86 86
87 87 .help_string_label {
88 88 float: right;
89 89 font-size: 85%;
90 90 }
91 91
92 92 div#notebook_panel {
93 93 margin: 0px 0px 0px 0px;
94 94 padding: 0px;
95 95 }
96 96
97 97 div#notebook {
98 98 overflow-y: scroll;
99 99 overflow-x: auto;
100 100 width: 100%;
101 101 /* This spaces the cell away from the edge of the notebook area */
102 102 padding: 5px 5px 15px 5px;
103 103 margin: 0px
104 104 background-color: white;
105 105 }
106 106
107 107 div#pager_splitter {
108 108 height: 8px;
109 109 }
110 110
111 111 div#pager {
112 112 padding: 15px;
113 113 overflow: auto;
114 114 display: none;
115 115 }
116 116
117 117 div.ui-widget-content {
118 118 border: 1px solid #aaa;
119 119 outline: none;
120 120 }
121 121
122 122 .cell {
123 123 border: 1px solid transparent;
124 124 }
125 125
126 126 div.cell {
127 127 width: 100%;
128 128 padding: 5px 5px 5px 0px;
129 129 /* This acts as a spacer between cells, that is outside the border */
130 130 margin: 2px 0px 2px 0px;
131 131 }
132 132
133 133 div.code_cell {
134 134 background-color: white;
135 135 }
136 136 /* any special styling for code cells that are currently running goes here */
137 137 div.code_cell.running {
138 138 }
139 139
140 140 div.prompt {
141 141 /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */
142 142 width: 11ex;
143 143 /* This 0.4em is tuned to match the padding on the CodeMirror editor. */
144 144 padding: 0.4em;
145 145 margin: 0px;
146 146 font-family: monospace;
147 147 text-align:right;
148 148 }
149 149
150 150 div.input {
151 151 page-break-inside: avoid;
152 152 }
153 153
154 154 /* input_area and input_prompt must match in top border and margin for alignment */
155 155 div.input_area {
156 156 color: black;
157 157 border: 1px solid #ddd;
158 158 border-radius: 3px;
159 159 background: #f7f7f7;
160 160 }
161 161
162 162 div.input_prompt {
163 163 color: navy;
164 164 border-top: 1px solid transparent;
165 165 }
166 166
167 167 div.output {
168 168 /* This is a spacer between the input and output of each cell */
169 169 margin-top: 5px;
170 170 }
171 171
172 172 div.output_prompt {
173 173 color: darkred;
174 174 }
175 175
176 176 /* This class is the outer container of all output sections. */
177 177 div.output_area {
178 178 padding: 0px;
179 179 page-break-inside: avoid;
180 180 }
181 181
182 182 /* This class is for the output subarea inside the output_area and after
183 183 the prompt div. */
184 184 div.output_subarea {
185 185 padding: 0.4em 0.4em 0.4em 0.4em;
186 186 }
187 187
188 188 /* The rest of the output_* classes are for special styling of the different
189 189 output types */
190 190
191 191 /* all text output has this class: */
192 192 div.output_text {
193 193 text-align: left;
194 194 color: black;
195 195 font-family: monospace;
196 196 }
197 197
198 198 /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */
199 199 div.output_stream {
200 200 padding-top: 0.0em;
201 201 padding-bottom: 0.0em;
202 202 }
203 203 div.output_stdout {
204 204 }
205 205 div.output_stderr {
206 206 background: #fdd; /* very light red background for stderr */
207 207 }
208 208
209 209 div.output_latex {
210 210 text-align: left;
211 211 color: black;
212 212 }
213 213
214 214 div.output_html {
215 215 }
216 216
217 217 div.output_png {
218 218 }
219 219
220 220 div.output_jpeg {
221 221 }
222 222
223 223 div.text_cell {
224 224 background-color: white;
225 225 padding: 5px 5px 5px 5px;
226 226 }
227 227
228 228 div.text_cell_input {
229 229 color: black;
230 230 border: 1px solid #ddd;
231 231 border-radius: 3px;
232 232 background: #f7f7f7;
233 233 }
234 234
235 235 div.text_cell_render {
236 236 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
237 237 outline: none;
238 238 resize: none;
239 239 width: inherit;
240 240 border-style: none;
241 241 padding: 5px;
242 242 color: black;
243 243 }
244 244
245 .CodeMirror span {
246 vertical-align: bottom;
247 }
245 /* The following gets added to the <head> if it is detected that the user has a
246 * monospace font with inconsistent normal/bold/italic height. See
247 * notebookmain.js. Such fonts will have keywords vertically offset with
248 * respect to the rest of the text. The user should select a better font.
249 * See: https://github.com/ipython/ipython/issues/1503
250 *
251 * .CodeMirror span {
252 * vertical-align: bottom;
253 * }
254 */
248 255
249 256 .CodeMirror {
250 257 line-height: 1.231; /* Changed from 1em to our global default */
251 258 }
252 259
253 260 .CodeMirror-scroll {
254 261 height: auto; /* Changed to auto to autogrow */
255 262 /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/
256 263 /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/
257 264 overflow-y: hidden;
258 265 overflow-x: auto; /* Changed from auto to remove scrollbar */
259 266 }
260 267
261 268 /* CSS font colors for translated ANSI colors. */
262 269
263 270
264 271 .ansiblack {color: black;}
265 272 .ansired {color: darkred;}
266 273 .ansigreen {color: darkgreen;}
267 274 .ansiyellow {color: brown;}
268 275 .ansiblue {color: darkblue;}
269 276 .ansipurple {color: darkviolet;}
270 277 .ansicyan {color: steelblue;}
271 278 .ansigrey {color: grey;}
272 279 .ansibold {font-weight: bold;}
273 280
274 281 .completions {
275 282 position: absolute;
276 283 z-index: 10;
277 284 overflow: auto;
278 285 border: 1px solid grey;
279 286 }
280 287
281 288 .completions select {
282 289 background: white;
283 290 outline: none;
284 291 border: none;
285 292 padding: 0px;
286 293 margin: 0px;
287 294 font-family: monospace;
288 295 }
289 296
290 297 option.context {
291 298 background-color: #DEF7FF;
292 299 }
293 300 option.introspection {
294 301 background-color: #EBF4EB;
295 302 }
296 303
297 304 /*fixed part of the completion*/
298 305 .completions p b {
299 306 font-weight:bold;
300 307 }
301 308
302 309 .completions p {
303 310 background: #DDF;
304 311 /*outline: none;
305 312 padding: 0px;*/
306 313 border-bottom: black solid 1px;
307 314 padding: 1px;
308 315 font-family: monospace;
309 316 }
310 317
311 318 pre.dialog {
312 319 background-color: #f7f7f7;
313 320 border: 1px solid #ddd;
314 321 border-radius: 3px;
315 322 padding: 0.4em;
316 323 padding-left: 2em;
317 324 }
318 325
319 326 p.dialog {
320 327 padding : 0.2em;
321 328 }
322 329
323 330 .shortcut_key {
324 331 display: inline-block;
325 332 width: 15ex;
326 333 text-align: right;
327 334 font-family: monospace;
328 335 }
329 336
330 337 .shortcut_descr {
331 338 }
332 339
333 340 /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems
334 341 to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do.
335 342 */
336 343 pre, code, kbd, samp { white-space: pre-wrap; }
337 344
338 345 #fonttest {
339 346 font-family: monospace;
340 347 }
@@ -1,91 +1,68 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 // On document ready
10 10 //============================================================================
11 11
12 12
13 13 $(document).ready(function () {
14 14
15 15 IPython.init_mathjax();
16 16
17 17 IPython.read_only = $('body').data('readOnly') === 'True';
18 18 $('div#main_app').addClass('border-box-sizing ui-widget');
19 19 $('div#notebook_panel').addClass('border-box-sizing ui-widget');
20 20 // The header's bottom border is provided by the menu bar so we remove it.
21 21 $('div#header').css('border-bottom-style','none');
22 22
23 23 IPython.page = new IPython.Page();
24 24 IPython.markdown_converter = new Markdown.Converter();
25 25 IPython.layout_manager = new IPython.LayoutManager();
26 26 IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
27 27 IPython.quick_help = new IPython.QuickHelp('span#quick_help_area');
28 28 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
29 29 IPython.notebook = new IPython.Notebook('div#notebook');
30 30 IPython.save_widget = new IPython.SaveWidget('span#save_widget');
31 31 IPython.menubar = new IPython.MenuBar('#menubar')
32 32 IPython.toolbar = new IPython.ToolBar('#toolbar')
33 33 IPython.tooltip = new IPython.Tooltip()
34 34 IPython.notification_widget = new IPython.NotificationWidget('#notification')
35 35
36 36 IPython.layout_manager.do_resize();
37 37
38 38 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
39 39 '<span id="test2" style="font-weight: bold;">x</span>'+
40 40 '<span id="test3" style="font-style: italic;">x</span></pre></div>')
41 41 var nh = $('#test1').innerHeight();
42 42 var bh = $('#test2').innerHeight();
43 43 var ih = $('#test3').innerHeight();
44 var dialog = $('<div/>');
45 44 if(nh != bh || nh != ih) {
46 dialog.html('We have detected that your browser is using a '+
47 '<span style="font-family: monospace;">monospace</span> font that has an '+
48 'inconsistent size between '+
49 '<span style="font-family: monospace;">normal</span>, '+
50 '<span style="font-family: monospace; font-weight: bold;">bold</span>, and '+
51 '<span style="font-family: monospace; font-style: italic;">italic</span> '+
52 'variants, which are used by IPython for syntax highlighting. '+
53 'This will cause visual artifacts. (The font is probably "Courier New") '+
54 'We recommend that you configure your browser to use a different '+
55 'monospace font.<br/><br/>'+
56 'normal='+String(nh)+'px bold='+String(bh)+'px italic='+String(ih)+'px');
57 $(document).append(dialog);
58 dialog.dialog({
59 resizable: false,
60 modal: true,
61 title: "Bad fonts detected",
62 closeText: '',
63 buttons : {
64 "Ok": function () {
65 $(this).dialog('close');
66 }
67 }
68 });
45 $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
69 46 $('#fonttest').remove();
70 47 }
71 48
72 49 if(IPython.read_only){
73 50 // hide various elements from read-only view
74 51 $('div#pager').remove();
75 52 $('div#pager_splitter').remove();
76 53
77 54 // set the notebook name field as not modifiable
78 55 $('#notebook_name').attr('disabled','disabled')
79 56 }
80 57
81 58 IPython.page.show();
82 59
83 60 IPython.layout_manager.do_resize();
84 61 $([IPython.events]).on('notebook_loaded.Notebook', function () {
85 62 IPython.layout_manager.do_resize();
86 63 IPython.save_widget.update_url();
87 64 })
88 65 IPython.notebook.load_notebook($('body').data('notebookId'));
89 66
90 67 });
91 68
General Comments 0
You need to be logged in to leave comments. Login now