##// 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 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 245 .CodeMirror span {
246 246 vertical-align: bottom;
247 247 }
248 248
249 249 .CodeMirror {
250 250 line-height: 1.231; /* Changed from 1em to our global default */
251 251 }
252 252
253 253 .CodeMirror-scroll {
254 254 height: auto; /* Changed to auto to autogrow */
255 255 /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/
256 256 /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/
257 257 overflow-y: hidden;
258 258 overflow-x: auto; /* Changed from auto to remove scrollbar */
259 259 }
260 260
261 261 /* CSS font colors for translated ANSI colors. */
262 262
263 263
264 264 .ansiblack {color: black;}
265 265 .ansired {color: darkred;}
266 266 .ansigreen {color: darkgreen;}
267 267 .ansiyellow {color: brown;}
268 268 .ansiblue {color: darkblue;}
269 269 .ansipurple {color: darkviolet;}
270 270 .ansicyan {color: steelblue;}
271 271 .ansigrey {color: grey;}
272 272 .ansibold {font-weight: bold;}
273 273
274 274 .completions {
275 275 position: absolute;
276 276 z-index: 10;
277 277 overflow: auto;
278 278 border: 1px solid grey;
279 279 }
280 280
281 281 .completions select {
282 282 background: white;
283 283 outline: none;
284 284 border: none;
285 285 padding: 0px;
286 286 margin: 0px;
287 287 font-family: monospace;
288 288 }
289 289
290 290 option.context {
291 291 background-color: #DEF7FF;
292 292 }
293 293 option.introspection {
294 294 background-color: #EBF4EB;
295 295 }
296 296
297 297 /*fixed part of the completion*/
298 298 .completions p b {
299 299 font-weight:bold;
300 300 }
301 301
302 302 .completions p {
303 303 background: #DDF;
304 304 /*outline: none;
305 305 padding: 0px;*/
306 306 border-bottom: black solid 1px;
307 307 padding: 1px;
308 308 font-family: monospace;
309 309 }
310 310
311 311 pre.dialog {
312 312 background-color: #f7f7f7;
313 313 border: 1px solid #ddd;
314 314 border-radius: 3px;
315 315 padding: 0.4em;
316 316 padding-left: 2em;
317 317 }
318 318
319 319 p.dialog {
320 320 padding : 0.2em;
321 321 }
322 322
323 323 .shortcut_key {
324 324 display: inline-block;
325 325 width: 15ex;
326 326 text-align: right;
327 327 font-family: monospace;
328 328 }
329 329
330 330 .shortcut_descr {
331 331 }
332 332
333 333 /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems
334 334 to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do.
335 335 */
336 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 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 $('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 72 if(IPython.read_only){
39 73 // hide various elements from read-only view
40 74 $('div#pager').remove();
41 75 $('div#pager_splitter').remove();
42 76
43 77 // set the notebook name field as not modifiable
44 78 $('#notebook_name').attr('disabled','disabled')
45 79 }
46 80
47 81 IPython.page.show();
48 82
49 83 IPython.layout_manager.do_resize();
50 84 $([IPython.events]).on('notebook_loaded.Notebook', function () {
51 85 IPython.layout_manager.do_resize();
52 86 IPython.save_widget.update_url();
53 87 })
54 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