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